Error NU1605 trying to build Winforms.sln
See original GitHub issue-
.NET Core Version: 3.0.100-preview3-010283 [C:\Program Files\dotnet\sdk] 3.0.100-preview4-010480 [C:\Program Files\dotnet\sdk]
-
Have you experienced this same bug with .NET Framework?: No
Problem description:
After forking dotnet/winforms master Winforms.sln does not build - there are 64 cases of errors like this:
Severity Code Description Project File Line Suppression State
Error NU1605 Detected package downgrade: Microsoft.NETCore.Platforms from 3.0.0-preview4.19118.6 to 3.0.0-preview3.19115.9. Reference the package directly from the project to select a different version.
System.Windows.Forms -> System.Drawing.Common 4.6.0-preview4.19118.6 -> Microsoft.NETCore.Platforms (>= 3.0.0-preview4.19118.6)
System.Windows.Forms -> Microsoft.NETCore.Platforms (>= 3.0.0-preview3.19115.9) System.Windows.Forms.Ref C:\Users\JoeErickson\source\repos\winforms\src\System.Windows.Forms\ref\System.Windows.Forms.Ref.csproj 1
This has been an ongoing problem for a while. The workaround has been to change the ~15 C# projects to not treat NU1605 as an error.
NU1605 is explicitly set to be treated as an error in all C# projects in Winforms.sln and this makes good sense but I cannot figure out how to get the correct build of .NET Core 3. Neither the daily build nor the current Preview 3 release works. This problem has persisted for at least several weeks.
Minimal repro:
- Install latest Visual Studio 2019 Preview 3 and .NET Core 3 (Preview 3 or daily build).
- Fork and clone dotnet/winforms master.
- Load Winforms.sln into VS 2019.
- Try to build.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (11 by maintainers)

Top Related StackOverflow Question
Don’t suppress nu1605: package downgrades are bad.
Looks to be a side-effect of https://github.com/dotnet/sdk/blob/0690b28e426f5b7e6dfe7ab4200b83ce3c96bc95/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props#L81-L87. /cc @dsplaisted
The SDK you’re building with is adding a reference to it’s version of MS.NC.Platforms which is lagging behind the version that WinForms gets from the CoreFx packages.
You should be able to workaround it by updating the reference added by the SDK (looks like they don’t have a great hook for defining it).
So add Microsoft.NETCore.Platforms to the list of packages you get from darc (versions.props), then put something like the following in your root Directory.Build.targets:
I have checked out the latest master and now I can’t compile…
Attempting to compile I get a bunch of errors:
I also get the following warning: