Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update to .NETStandard 2.0 NuGet Package

I've a good old .NET Framework 4.7 Class Library in Visual Studio 2015 currently using Microsoft.Extensions.Configuration NuGet package version 1.1.2. I'm trying to update this to version 2.0, but I'm getting this error:

Microsoft.Extensions.Configuration 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7', 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.

I see that the new version only supports .NETStandard 2.0. Do I have to convert all my project to either .NET Core or .NET Standard in Visual Studio 2017?

like image 981
dhrm Avatar asked Sep 01 '17 05:09

dhrm


People also ask

Is .NET standard 2.0 compatible with .NET framework?

NET Standard 2.0 specification is now complete. It is supported in . NET Core 2.0, in the . NET Framework 4.6.

Is .NET standard 2.1 compatible with .NET framework?

You cannot consume a . Net Standard 2.1 assembly in any . Net Framework Version because the . NET Framework (even the last ever version, 4.8) does not implement .


2 Answers

.NET Framework versions 4.6.1 and higher do support .NET Standard 2.0+, but only when using new tooling. Make sure you update to VS 2017 version 15.3.0 or higher and have the .NET Core SDK 2.0.0 installed and no global.json in your solution's directory hierarchy pinning a lower SDK version.

You may also need to install the .NET Core workload in VS 2017

like image 178
Martin Ullrich Avatar answered Oct 12 '22 18:10

Martin Ullrich


Yes you have to convert your project to .Net standard 2.0 to use the Microsoft.Extensions.Configuration 2.0.0 package.

Check out the below link for .Net standard 2.0 supported .Net framework version as of now the, .Net standard 2.0 supports only up to .Net framework 4.6.1

.Net standard 2.0 supported api

like image 42
Sriram Avatar answered Oct 12 '22 17:10

Sriram