I'm working on a .net Core v2.1 application and during development I try to regularly update my NuGET packages.
I can't update my Microsoft.AspNetCore.App
, which is now at v2.1.1, but the latest stable is v2.1.3
I also can't update Microsoft.NETCore.App
from v2.1.0 to v2.1.3
I've been reading about this for hours. I do have all the necessary SDKs:
>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.401\
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.302 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
I'm running VS2017 Community Edition v15.8.1
When I try to update using the Manage NuGet for solution ..
I get the Blocked by project
message and can't select the newer versions.
I read using
Install-Package Microsoft.NETCore.App -Version 2.1.3
in the Package Manager Console
could also work.
But then I get this error:
NETSDK1061: The project was restored using Microsoft.NETCore.App version 2.1.3, but with current settings, version 2.1.0 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore.
I've read the page it is refering to, but don't understand what I need to do the fix this.
I also don't understand why this is made so difficult. I'm not upgrading from v2 to v3, I'm not even upgrading from v2.1 to v2.2 I'm just trying to upgrade from v2.1.0 to v2.1.3.
Any help will be much appreciated.
What you need to do is to explicitly tell Visual studio about the SDK version you wish to deal with. To achieve this, add the version tag to your project node in your .csproj file. This will tell VS to compile the project using the specified SDK version. Now you will also need to tell it which runtime version to use too, otherwise it will compile but wont run. To achieve that you will need to add a runtime node, with the version also specified therein. This will look like this...
<Project Sdk="Microsoft.NET.Sdk.Web" Version="2.1.3">
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.3</RuntimeFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
....
</PropertyGroup>
...
</Project>
Some packages, such as the Microsoft.NETCore.App can be installed via Nuget Package Manager but if they are ahead of the project's version they wont work.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With