Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"

like image 544
Aviram Fireberger Avatar asked Sep 12 '17 06:09

Aviram Fireberger


1 Answers

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.

like image 119
Aviram Fireberger Avatar answered Nov 13 '22 16:11

Aviram Fireberger