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?
.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
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
Related
I'm just getting started in NuGet packages creation thing and I know how to create a NuGet package for .NET Framework and .NET Core applications but I'm not sure if there any way of creating the NuGet package where it will support both .NET Core as well as .NET Framework. But I've seen the NuGet packages that works with both .NET Core and Framework.
For example, if I open .nupkg file of NewtonSoft.JSON I see the something like this.
Newtonsoft.JSON hierarchy
And yes, currently I'm developing my packages using .NET Framework 4.5, so it supports both. But I want a native support for that package not with the backwards compatibility in my .NET Core applications. Also, I don't want to develop using .NET Standard, because in Newtonsoft.JSON package it looks like they are using the .NET Standard.
.NET Standard is a specification that has multiple implementations including .NET Framework and Core/5/6.
If you want to support Framework 4.5 in addition to core the most up-to-date version you can target is Standard version 1.1.
ref: https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-1-1
My project uses .net framework 4.8. After upgrading microsoft.net.sdk.functions from version 1.0.24 to 3.0.1, the build on my local machine works fine, but there are some errors on the build on VSO pipeline:
microsoft.net.sdk.functions\3.0.1\build\microsoft.net.sdk.functions.build.targets(41,5):
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.0.0' was
not found
microsoft.net.sdk.functions\3.0.1\build\microsoft.net.sdk.functions.build.targets(41,5):
metadata generation failed.
There is no version 3.0.0 for Microsoft.NetCore.App nuget package. Why would the error ask for that version? Also how can I fix the error?
Looking at the package on NuGet, version 3.0.1 is intended for use with .NET Core 3.0 and higher applications, not .NET Framework applications. Version 1.0.38 appears to be the latest version with .NET Framework support (4.6 and higher).
Imagine Jane is on Ubuntu and uses VSCode with .NET Core 2.0 SDK to create and push a NuGet package targeting netstandard2.0 to a repo.
Imagine I have a .NET 4.6.1 full framework project - its a Windows Service executable.
Since .NET Standard 2.0 is the common spec in the above and I'm using Visual Studio 2017 Update 3 and latest SDKs and stuff, I reference Jane's .nupkg.
I build and XCOPY my /bin/release to a server VM with just the .NET 4.6.1 Framework installed.
Will it run, or do I need to install anything else on the server?
All, I recently started working on a project that uses EF Core 1.1.2. I saw where 2.0 was released because I started getting errors when I tried to add EF core to a project.
I couldn't update the existing project, I created a brand new console project. Set the .Net framework to 4.6.1 and still had no luck. I always get the following message. Has anyone ran into this issue? thanks in advance
Install-Package : Could not install package 'Microsoft.EntityFrameworkCore.SqlServer 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.
EF Core 2.0 release has been officially announced and the documentation is (partially) updated.
Of course it's not NET Core only. But the actual prerequisites for targeting Full .NET Framework are as follows:
(1) Project targeting .NET Framework 4.6.1 and above.
(2) Visual Studio 2017 with (important!) 15.3.0 update (also just released) installed
Before updating the VS I was getting the same error. After updating the error is gone and EF 2.0 package is successfully installed.
EF Core 1.1.2 had a dependency on .NETStandard 1.3 or .NETFramework 4.5.1. So as you were targeting .NetFramework 4.5.2 everything is hunky dory.
EF Core 2.0 has a dependency on .NETStandard 2.0. This is not compatible with the .NETFramework, everything is far from hunky dory.
According to the source below you can get .NetFramework support with 2.0 tooling, which is in preview:
https://dotnet.myget.org/feed/dotnet-core/package/nuget/NETStandard.Library.NETFramework
The alternative would be to migrate your application so it doesn't use the .NetFramework but only targets .NETStandard libraries.
Sources
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/2.0.0
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/1.1.2
https://learn.microsoft.com/en-us/dotnet/standard/net-standard
Good luck.
EntityFramework Core 2.0.0 is not compatible with a Target framework other than Core 2.0.0. You will need to ensure your project is targetting this and install any dependancies.
It will NOT work with the (standard) .NET framework versions, it is a 'Core' specific release.
I've upgraded my project with scripting capabilities and also Microsoft.CodeAnalysis nuget and it downloaded hundred of dependent System.* packages. Before it was only Microsoft.CodeAnalysis.Common, CSharp, CSharp.Workspaces, etc. What is happening? Does it work in Visual Studio 2017 with .NET Framework 4.7? Or is it included in 4.7 (I didn't find it anywhere)? Should I wait?
Older versions of Microsoft.CodeAnalysis.Common only had a variant for .Net 4.5, with few dependencies.
But since version 1.3.0, the package also has a .Net Standard 1.3 variant, which has many dependencies, as is usual for .Net Standard 1.x packages. When installing such package into a project targeting .Net Framework 4.7, NuGet installs all the .Net Standard dependencies. As far as I know, there is nothing wrong with that and the project should work fine.