NetCoreApp2.1 using SDK 2.1.1 package downgrade to 2.1.0
See original GitHub issue@grantwar commented on Wed Jul 04 2018
Service Fabric Service using SDK 2.1.1 has an associated test core 2.1 project which is showing up as using SDK 2.1.0, won’t allow me to upgrade via nuget (Blocked by project).
Build Error
Detected package downgrade: Microsoft.NETCore.App from 2.1.1 to 2.1.0. Reference the package directly from the project to select a different version.
Issue
I’m unable to get my solution to build due to an issue with a unit test project which references my service project forcing a package downgrade of my service project from 2.1.1 down to 2.1.0 No where have I explicitly set the dotnet core revision, and my netcoreapp projects are all 2.1 Prior to me installing dotnetcore 2.1.301, I had the 2.1.3 (RC1) and everything worked just fine. I’m unable to manually change the version of the unit test project from 2.1.0 to 2.1.1, and doing doing a install package microsoft.netcore.app -version 2.1.1 does not fix the issue either.
I can set <TargetLatestRuntimePatch>false</TargetLatestRuntimePatch>
in the service project, and this does resolve the problem, however I’m not happy having to do this in a production service which is being worked on by a team of developers.
Setup
dotnet --version
2.1.301
Service fabric service project
Service unit test project
Service unit test project nuget package manager
@agr commented on Wed Jul 04 2018
Seeing the same in my project with xUnit when specifying runtime when building. Repro:
> dotnet --version
2.1.301
mkdir 211_210
cd 211_210
mkdir mvc
cd mvc
dotnet new mvc
cd ..
mkdir test
cd test
dotnet new xunit
dotnet add reference ../mvc/mvc.csproj
dotnet build -r any
Produces the following output:
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for C:\Users\agr\Source\Repos\211_210\test\test.csproj...
Restoring packages for C:\Users\agr\Source\Repos\211_210\mvc\mvc.csproj...
Restore completed in 46.55 ms for C:\Users\agr\Source\Repos\211_210\test\test.csproj.
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.1.1 to 2.1.0. Reference the package directly from the project to select a different version.
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: test -> mvc -> Microsoft.NETCore.App (>= 2.1.1)
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: test -> Microsoft.NETCore.App (>= 2.1.0)
Restore failed in 294.47 ms for C:\Users\agr\Source\Repos\211_210\test\test.csproj.
Restore completed in 629.54 ms for C:\Users\agr\Source\Repos\211_210\mvc\mvc.csproj.
Build FAILED.
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.1.1 to 2.1.0. Reference the package directly from the project to select a different version.
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: test -> mvc -> Microsoft.NETCore.App (>= 2.1.1)
C:\Users\agr\Source\Repos\211_210\test\test.csproj : error NU1605: test -> Microsoft.NETCore.App (>= 2.1.0)
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.03
Just dotnet build
seems to work, but if any runtime is specified it fails. I tried any
, win
, win-x64
, linux-x64
. Same happens both in Linux and Windows. It worked (and still works) fine in 2.1.300
.
@rrelyea commented on Fri Jul 06 2018
This probably requires a fix in the templates or the SDK? (SDK team?)
MVC wants 2.1.1 of NetCoreApp Unit test projects wants 2.1.0 of NetCoreApp.
Normally, this is a NuGet warning, but SDK projects have turned NU1605 into an error on purpose (Warning as Error).
@rrelyea commented on Fri Jul 06 2018
My guess is that this should be closed, in favor of the following info I got from @dsplaisted in email:
This is part of a class of issues we have. If a RID is specified, and the project is an Exe, then by default we’ll use the latest patch of Microsoft.NETCore.App. We run into issues when you reference a project that uses the latest patch from one that doesn’t.
Other related issues: https://github.com/dotnet/sdk/issues/2364 https://github.com/dotnet/sdk/issues/2253
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top GitHub Comments
I believe this will be fixed in 2.2.100 by https://github.com/dotnet/sdk/pull/2395.
Until then, an alternative workaround which doesn’t involve modifying the production project is to put
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
in your test project.Worked for me when I added
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
to both parent and unit test projects. Adding to test project alone did not work.