-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
BUG: SDK-3.1.300 dotnet publish .sln now chooses the older DLL in version conflict #11953
Comments
dotnet publish .sln
now chooses the older DLL in version conflict
dotnet publish .sln
now chooses the older DLL in version conflictSDK-3.1.300 dotnet publish .sln now chooses the older DLL in version conflict: dotnet/sdk#11953
I am having this issue, too. |
@dsplaisted Is any progress being made on this issue? We've run into the same problem on our Azure Pipelines builds using dotnet publish. |
Try running the publish command with "-v d" (verbose detailed) and look for the line that says "copy xx/Newtonsoft.Json.dll to xx/publish..." I experienced this problem with a nuget package that package the dll without defining it as a nuget dependency. |
Try publishing without overriding the output folder. It works for me |
The problem is likely that you have multiple projects publishing to the same output folder, and its a matter of timing which one wins in copying its version of Newtonsoft.Json.dll. As @blacksnake-rus mentions, you can probably fix this by avoiding using the If you can share a binlog of the publish operation where it's copying the wrong thing, it will be possible to verify whether this is the case. |
The obvious workaround would of course be to just publish the single project and not a solution. Quitting the -o option is imo. way more destructive for existing build pipelines. I find this problem way too consistent over projects and computers to simply be a timing issue. Here are binlogs, where 300 has the wrong older DLL in the output: https://github.com/vidarw/dotnet-sdk-3.1.300-nuget-issue/blob/master/202-msbuild.binlog |
I looked at the binlogs and they confirm that the issue is both projects are trying to write to the same folder. If you open up the 300 log in MSBuild Structured Log Viewer, you will see that it reports double writes for the different versions of the DLL to the same path: I wasn't able to determine what is different about the 202 build, but I think it is probably just a matter of timing - ie the ModernApp project finishes publishing more quickly so that by the time the LegacyApp publishes, it already sees the newer version of the DLL and thus doesn't copy it. Or the LegacyApp finishes first and then the ModernApp overwrites the DLL. |
Come on... This is clearly a issue that should be handled by the SDK/compiler in some way or form? I certainly understand that the problem is caused by stupid build practices - but it should at least produce a warning when you |
@dsplaisted I think closing this is premature. Publishing a solution to one folder may not be the perfect way to work with your files, but if you won't support it it should be removed from the sdk. |
I agree we should fix something with the @Erythnul If you can share more details along with a binlog or a repro of your issue I can take a look. Are you specifying an output path as a command-line parameter when building the solution? What's the incorrect behavior you're seeing? |
SDK 3.1.300 shows a different behavior when running
dotnet publish
on the solution file.3.1.300 now selects the lowest versioned DLL when there is a version conflict between projects. This causes the projects depending on the newer DLLs to break, where the old bevhavior usually is expected to work fine due to a >= version dependency. We have seen this behavior both on direct package dependencies, but also on implicit dependencies from installed packages.
SDK 3.1.202 and earlier work as expected by selecting the most recent version of the two conflicting DLL versions to the publishing directory.
I have uploaded an example repository to demonstrate the behavior with a Modern App with a dependency on Newtonsoft.Json 12.0.x living in the same solution as a Legacy App with the same Newtonsoft.Json dependency targeting the older 10.0.x version.
Project can be found here: https://github.com/vidarw/dotnet-sdk-3.1.300-nuget-issue
vs.
and compare the version of the dlls. In my example the Newtonsoft.Json.dll will return 12.0.3 in 3.1.202 and 10.0.3 in 3.1.300 respectively.
The expected behavior is to get the most recent version in the published directory. If the change in behavior for some reason is intentional - a warning should be added to the console output.
The text was updated successfully, but these errors were encountered: