Unable to upgrade or downgrade NuGet package

I have an ASP.NET Core website and it relies on 2 class libraries.

They all refer to Microsoft.NETCore, but the versions somehow messed up and led me to warnings:

Detected Package Downgrade: Microsoft.NETCore.App 1.1.0 to 1.0.3

NuGet will not let me change the version of Microsoft.NetCore.App :

Cant update package

If I try to upgrade or downgrade, I get an error message

The following versions are not available due to additional restrictions in the project or packages.config

How to solve this error?

My csproj file:

 <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp1.0</TargetFramework> <PreserveCompilationContext>true</PreserveCompilationContext> <AssemblyName>AutomotiveWebPortalCore</AssemblyName> <OutputType>Exe</OutputType> <PackageId>AutomotiveWebPortalCore</PackageId> <UserSecretsId>aspnet-AutomotiveWebPortalCore-20170223120414</UserSecretsId> <RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion> <PackageTargetFallback>$(PackageTargetFallback);dotnet</PackageTargetFallback> </PropertyGroup> <ItemGroup> <Content Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json;web.config"> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> </Content> </ItemGroup> <ItemGroup> <PackageReference Include="AutoMapper" Version="5.2.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="1.2.0" /> <PackageReference Include="DevExtreme.AspNet.Core" Version="16.2.4" /> <PackageReference Include="DevExtreme.AspNet.Data" Version="1.2.4" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.2" /> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.1" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.0.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.0.1" /> <PackageReference Include="bootstrap" Version="3.3.7" /> <PackageReference Include="HubSpot.Tether" Version="1.1.1" /> </ItemGroup> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> </Target> <ItemGroup> <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\AutomotiveDAL\AutomotiveDAL.csproj" /> <ProjectReference Include="..\AutomotiveDTO\AutomotiveDTO.csproj" /> </ItemGroup> </Project> 

Edit:

Here are the links to my class libraries:

Data Access Level:

 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp1.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="AutoMapper" Version="5.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-msbuild3-final" /> </ItemGroup> </Project> 

Data Transfer Objects:

 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp1.0</TargetFramework> </PropertyGroup> </Project> 
+7
asp.net-core nuget visual-studio-2017 .net-core
source share
1 answer

“The following versions are not available due to additional restrictions”, it seems that the message even occurs in a completely new, empty ASP.NET Core project. I think this is either a bug or a feature of the NuGet GUI. (I am using the final version of Visual Studio 2017)

You can work around this by directly editing the .csproj file: right-click the project in Solution Explorer and select Change (project name) .csproj .

You can increase the version of Microsoft.NETCore.App (and the target structure) in the first PropertyGroup:

 <PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> <!-- snip --> <RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion> <!-- snip --> </PropertyGroup> 

Then close the file and rebuild the project. I tested this with all the (public) dependencies you mentioned in your question and did not see any package version conflicts.

+6
source share

All Articles