Package restore failed. Rolling back package changes - Serilog.AspNetCore

不羁的心 提交于 2019-12-21 09:27:28

问题


I have an asp.net Core project and I'm trying to add a logger to it. I choose SeriLog which I used in other projects.

But when I'm trying to add the "Serilog.AspNetCore" package version 2.0.0 I'm getting"

Package restore failed. Rolling back package changes for 'BackEnd'.

My csproj contain the following settings:

<PropertyGroup>
   <TargetFramework>netcoreapp2.0</TargetFramework>
   <DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
   <AssemblyName>BackEnd</AssemblyName>
  <RootNamespace>BackEnd</RootNamespace>
</PropertyGroup>

Allready tried to clear all nuget cache, rebuilding, restart VS

Running on Win10, Visual Studio 2017 15.3.0

Is there a log that can give me more details why I'm getting this error? Any suggestions how to fix it?

*Update - the detailed build log (Thanks @Leo-MSFT for that):

...

Checking compatibility for System.Security.Cryptography.Csp 4.3.0 with .NETCoreApp,Version=v2.0.

Checking compatibility for runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple 4.3.0 with .NETCoreApp,Version=v2.0.

All packages and projects are compatible with .NETCoreApp,Version=v2.0.

Detected package downgrade: Microsoft.Extensions.DependencyInjection from 2.0.0 to 1.1.1. Reference the package directly from the project to select a different version.

BackEnd (>= 1.0.0) -> Serilog.AspNetCore (>= 2.0.0) -> Microsoft.Extensions.DependencyInjection (>= 2.0.0)

BackEnd (>= 1.0.0) -> Microsoft.Extensions.DependencyInjection (>= 1.1.1)

Package restore failed. Rolling back package changes for 'BackEnd'.

Time Elapsed: 00:00:01.4928161

========== Finished ==========

Yep it seems that it's related to "Microsoft.Extensions.DependencyInjection"


回答1:


Solved by updating all my existence Nuget packages to the latest version available. Including those 5 packages:

<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />

The problem was the version of "Microsoft.Extensions.DependencyInjection" but I update all of them.



来源:https://stackoverflow.com/questions/46169561/package-restore-failed-rolling-back-package-changes-serilog-aspnetcore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!