.net – 包恢复失败.回滚包更改 – Serilog.AspNetCore

前端之家收集整理的这篇文章主要介绍了.net – 包恢复失败.回滚包更改 – Serilog.AspNetCore前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个asp.net核心项目,我正在尝试添加一个记录器.
我选择了我在其他项目中使用过的SeriLog.

但是,当我试图添加“Serilog.AspNetCore”软件包版本2.0.0时,我正在“

Package restore Failed. Rolling back package changes for ‘BackEnd’.

我的csproj包含以下设置:

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

Allready已经尝试清除所有nuget缓存,重建,重启VS.

在Win10上运行,Visual Studio 2017 15.3.0

是否有日志可以提供更多详细信息,为什么我收到此错误
任何建议如何解决

*更新 – 详细的构建日志(感谢@ Leo-MSFT):

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 ==========

是的,它似乎与“Microsoft.Extensions.DependencyInjection”有关

解决方法

通过将我所有存在的Nuget包更新到最新版本来解决.
包括那5个包:
<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" />

问题是“Microsoft.Extensions.DependencyInjection”的版本,但我更新了所有这些.

猜你在找的asp.Net相关文章