I am trying to install the Nuget package: Microsoft.Extenstions.Logging, on my ASP.Net MVC 5 projecton, .Net 4.6, Visual Studio 2015, and keep getting this error:
Attempting to gather dependency information for package 'Microsoft.Extensions.Configuration.2.0.0' with respect to project 'ProjectName.web', targeting '.NETFramework,Version=v4.6.1' Gathering dependency information took 271.03 ms Attempting to resolve dependencies for package 'Microsoft.Extensions.Configuration.2.0.0' with DependencyBehavior 'Lowest' Resolving dependency information took 0 ms Resolving actions to install package 'Microsoft.Extensions.Configuration.2.0.0' Resolved actions to install package 'Microsoft.Extensions.Configuration.2.0.0' Retrieving package 'Microsoft.Extensions.Configuration 2.0.0' from 'nuget.org'. GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/2.0.0/microsoft.extensions.configuration.2.0.0.nupkg OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration/2.0.0/microsoft.extensions.configuration.2.0.0.nupkg 259ms Installing Microsoft.Extensions.Configuration 2.0.0. Install failed. Rolling back... Package 'Microsoft.Extensions.Configuration.2.0.0' does not exist in project 'ProjectName.web' Package 'Microsoft.Extensions.Configuration.2.0.0' does not exist in folder 'C:\Git\ProjectName\packages' Executing nuget actions took 1.27 sec Could not install package 'Microsoft.Extensions.Configuration 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. ========== Finished ========== Time Elapsed: 00:00:05.6980685
Here is another link to this problem, on Github: issue
But does not provide any solution/workaround to fix this...
So turns out that there are two things to watch for when installing: Microsoft.Extensions.Logging (and many other Microsoft.Extensions.*)...
The first issue is that you need Nuget Version 4.3.0 or higher to be able to install this package. Since I was using visual studio 2015, which comes with lower version of Nuget, I had to install: [https://dist.nuget.org/visualstudio-2015-vsix/v3.6.0/NuGet.Tools.vsix][1]
Or I could upgrade to Visual Studio 2017, which comes with Nuget 4.4.0.
The second problem that I had was that initially my .Net Framework version was 4.5, Microsoft.Extensions.Logging has a dependency on .NetStandard 2.0 and therefore, if you are using .Net Framework, you need version 4.6.1 or higher.
In my case, I installed VS 2017, changed the Target Framework to .Net Framework 4.6.1 and finally I could install the Nuget Package.