question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: SDK-3.1.300 dotnet publish .sln now chooses the older DLL in version conflict

See original GitHub issue

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

docker run --rm -it -e /bin/sh -v C:\source\dotnet-sdk-3.1.300-nuget-issue:/app mcr.microsoft.com/dotnet/core/sdk:3.1.300
cd /app
dotnet publish -o ./3.1.300-docker

vs.

docker run --rm -it -e /bin/sh -v C:\source\dotnet-sdk-3.1.300-nuget-issue:/app mcr.microsoft.com/dotnet/core/sdk:3.1.202
cd /app
dotnet publish -o ./3.1.202-docker

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
vidarwcommented, Jan 31, 2021

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 dotnet publish a solution file (which is after all a valid input) using the -o parameter or produce visible warnings to the user when DoubleWrites are detected?

1reaction
dsplaistedcommented, Feb 2, 2021

I agree we should fix something with the -o option and solution files. I thought we had other issues tracking that, but when I looked I found various related issues but not one specifically for -o and solution files, so I filed #15607.

@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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

net core 3.0 (and higher) publish project with wrong ...
I updated a library called PathosChild/FluentNexus to a newer version but dotnet publish is still publishing the 1.0 version even though teh ...
Read more >
c# - dotnet publish outputs old packages
I am hitting an issue where a dotnet publish is outputting older versions of some packages (specifically Microsoft.Extensions.Configuration.dll ) ...
Read more >
MSB3277: Found conflicts between different versions of ' ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
ASP.NET 5 published folder contains wrong (old) DLLs
The DLLs in my project's bin/Debug/net5.0 and bin/Release/net5.0 are the proper versions, but the versions of some DLLs that end up my published...
Read more >
MSBuild uses .Net 5.0 SDK or .Net core SDKs for . ...
Net framework SDK for building net48 .csproj-s in the new netcore-like format. And it fails with error: C:\Program Files\dotnet\sdk\5.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found