-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dependency specification of logging packages to the exact same explicit version of Castle.Core package #292
Comments
You should not mix different versions of Castle Core's packages, i.e. if you use It unfortunately wasn't mentioned in the Windsor 4.0.0 release notes but we dropped those logging dependency packages ( Are you following a tutorial somewhere that we need to get updated? |
I'm not sure how to get the new .NET CLI MSBuild-based tools to create an output package with the dependency version set as requiring an exact version not a range. Currently The project file uses a project reference so not sure how to override the output dependency range: |
jonorossi, Thanks for your reply. Castle.Core v4.0.0 I have removed the redirects in my app.config an it works like a charm. Thanks P.S. For some reason, I hadn't seen Castle.Core-NLog 4.0.0, which added to my confusion. Furthermore, I'm using Moq, which was asking for Castle 4.1.1.0. I've now downgraded to Moq v4.7.25, the last version that works with Castle 4.0.0.0. Hope this helps someone in the future :) |
Is there a specific reason why a project reference is used? Given that Castle.LoggingFacility and Castle.Windsor end up being separately distributed artifacts on NuGet, I would expect that the former depends on the latter via a package reference. I understand project references to be references to an "internal" dependency that will be included in the distribution, while package references are for "external" (i.e. separate) dependencies. One solution might be to turn the You might end up with something like this:
|
@DianaKoenraadt Castle Core and Castle Windsor are separate projects, their versions don't have to match. You can upgrade Castle Core to 4.1.1, Castle Windsor's most recent release is 4.0.0 which supports Castle Core 4.1.1. |
@stakx good question. We've always used project references for projects in the same Git repo because tooling always stuffed up without doing that, e.g. MSBuild wouldn't detect the dependency had changed when you rebuilt or ran unit tests. I don't know how the tooling works for If we did make this change we'd have to use the MSBuild property we've got for the version: https://github.com/castleproject/Core/blob/v4.1.1/buildscripts/common.props#L14. It looks like others are using project references and also trying to lock the version, there is a workaround in one of the following issues but completely ugly:
With the new MSBuild tooling can you even pack two assemblies into the same package? When should project references be used, only for applications where you don't pack but publish? |
Lol - So it is not just me then. I had to write this to make things work for fluentwindsor. Would you guys like me to raise a PR that does this with a custom MsBuild task for now? *** Edited *** Failing that we can wait for v2.0 of netcore |
We could revert back to packing using nuspec files. The custom MsBuild task would then consistently include explicit versions as pre-build step honoring the BuildVersion property. This would mean taking a step back from where we are when it comes to NuGet packing and versioning and using the SDK(or the dotnet cli for that matter). The release for dotnet core 2.0 appears to be very close though, anyone played with version suffixes yet? |
Are you saying this is fixed with the .NET CLI 2.0 tooling? |
@jonorossi - I am currently investigating this, will ping back if I hit a positive result. |
@fir3pho3nixx did you get a chance to look at this one? It sounds like project references are going to deprecated, and we should be moving to package references anyway: |
@jonorossi - this is all starting to come together nicely. We had some uglyness in that crept up with logging down in Windsor here which might have been the root cause of this issue. We have hard coded assembly references in the LoggingFacility which means no matter what every new Core release will break Castle.Facilities.Logging on NuGet when people upgrade. My fix is nuclear, it requires a breaking change to facilities logging in windsor. I have a PR ready here It did however lead me to the conclusion that all that facility stuff should live in a separate repository anyway and we should use Castle.Windsor in the facilities repo as a Thoughts? |
@fir3pho3nixx you've mentioned a whole bunch of stuff which I've responded to in their own issues. The logging facility has been that way for over a decade, the only reason things are breaking now is that the new build scripts were doing the wrong thing with the assembly version which we've now fixed. I still think we want our packages with dependencies in lockstep, if you are using the |
Spent the
Yes, build scripts, my fault, sorry everyone. Feel free to send hate mail to fir3pho3nixx@gmail.com. However before we go off half cocked blaming my work let's consider my conclusion below.
Lock step perhaps, not my call (I would do it differently). ConclusionWhat I eventually saw here was Castle.LoggingFacility v4.0.0 had a hardcoded reference:
and
in the LoggingFacility for Castle.Facilities.Logging. This eventually runs the |
Hello.I'm having the same problem.
Any ideas on how i can fix this? |
Try this in your config: <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime> |
I don't know what i'm doing wrong but i get the same error. |
Sure ... |
I have emailed it to you.Thanks... |
From what I can see, you got the assembly binding correct. You were missing a NuGet reference to NLog in packages.config. <package id="Castle.Core-NLog" version="4.1.1" targetFramework="net461" /> |
Thank you very much for your help :) |
I'm very sorry but the fixed project didn't work again. |
Hello again.I fixed it like this. The problem is as @fir3pho3nixx had mentioned already. ps:i have replied with an alternative account that i own...my mistake! |
@fir3pho3nixx No need for hate mail, when I said this:
... I forgot to mention what was obvious to me, that the logging facility has always done annoying reflection to create the loggers using its list of loggers ( @tasoss @tasosss you'd be best served to use the Instead of:
... use:
The See the new notes in the Windsor documentation that resulted from this issue's changes. |
Now that the underlying logging facility problem that also surfaced is solved (castleproject/Windsor#336) by deprecating We need to block people being able to specify this:
The easiest way is to make Castle Core's packages depend on the one exact version of Castle Core it is versioned as, i.e. forces upgrades of Castle Core's packages in lockstep. I don't see any disadvantage to doing this. @fir3pho3nixx you've voiced objection to doing this for which I don't understand, I'd still like to understand why, I'm obviously missing something, and I'd love to hear if you've got a better suggestion. |
@jonorossi ok thanks for the info! |
Lock stepping versions of vendor specific logging abstractions with something as important as Castle.Core should not be happening IMHO. Castle.Core should be set free from it's NLog/log4net/serilog vendor/versioning shackles (or Let's think about this for a second. If Default NuGet behaviour is to always take latest of any. I think this is correct. We need to embrace this and start getting our releases/versioning/dependencies in order and start explicit versioning but we have to break things apart first. We need a way of releasing Castle.Core without any baggage what so ever. It is consumed by vendor frameworks and Castle.Windsor alike. Castle.Windsor keeps Castle.Core honest in terms of how it is consumed and at the moment it is exposing problems with what I feel is lock stepped versioning. I think the real question we need to be asking ourselves here is: How important are the logging abstractions when it comes to Castle.Core vs everything else? To quote @stakx: One solution might be to turn the You might end up with something like this:
This to me means, separate repositories/release cycles with separate NuGet publications/versions. Thoughts? |
As discussed We'll look at the future of the logging integration packages for v5. |
Fixed in #302. |
A bit late to the party, but I wanted to let you all know that I really appreciate that my "I'm trying to do this, what am I doing wrong?"-issue was taken up in such a serious and constructive manner. Kudos |
Hi all,
I had some trouble getting Castle NLog integration to work.
I'm using:
Castle.Core v4.1.1
Castle.Core-NLog v3.3.3
Castle.LoggingFacility v4.0.0
Castle.Windsor v4.0.0
Castle.Windsor-NLog v3.4.0
NLog v4.4.1.1
NLog.Config v4.4.1.1
NLog.Schema v4.4.1.1
Now, when I setup a simple installer:
and write a straightforward test
I got the error:
Could not convert string 'Castle.Services.Logging.NLogIntegration.NLogFactory,Castle.Services.Logging.NLogIntegration,Version=4.0.0.0, Culture=neutral,PublicKeyToken=407dd0808d44fbdc' to a type. ---> System.IO.FileLoadException: Could not load file or assembly 'Castle.Services.Logging.NLogIntegration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
In order to resolve this, I had to add in app.config:
What is causing this behavior? How can I resolve it in a better way? Or is this the right way?
The text was updated successfully, but these errors were encountered: