On the first few days after we released .NET Standard 2.0 (and a wave of new packages that target it) we have seen several customer reports for this kind of error:
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.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.
We believe a significant number of customers are now seeing this error because they have older NuGet client or dotnet CLI bits that are not aware of .NET Standard 2.0 and its compatible TFMs.
For these customers, the recommendation in the error message is misleading and ideally we would be prompting them to upgrade NuGet client or dotnet CLI.
Presumably, this can still happen again in the future:
Setting MinClientVersion in the nuspec file will help avoid this:
https://docs.microsoft.com/en-us/nuget/schema/nuspec
For NETStandard 2.0 the MinClientVersion would be 3.6.0 which is the lowest version on VS 2015 supporting that framework.
cc @bricelam, I think you had similar thoughts about MinClientVersion.
@emgarten would setting MinClientVersion to 3.6 help if I am running on a 4.x version of NuGet that is not the latest and doesn't know about .NET Standard 2.0 list of compatible TFMs and I actually need to update VS?
@divega no, unfortunately there isn't a way to define multiple ranges of allowed clients. Example: >= 3.6.0 && < 4.0.0 or >= 4.3.0
We have been investigating how to improve this, and if we could allow for these ranges or add a capability check to the nuget client, but it doesn't exist currently.
@emgarten thanks. In that case I would still like to propose the error is improved.
What we are seeing right now is customers complaining to package authors that their libraries targeting .NET Standard 2.0 are not supported in .NET Framework 4.6.1 and up, when the reality is that they are.
@divega - are your packages that are targeting NetStandard 2.0 using MinClientVersion of 3.6? If not, please do that, as the best way to help get old nuget clients to update.
@divega - how would you suggest we improve the error?
@karann-msft - can we please work on a doc issue to make sure that our docs provide guidance for NetStandard 2.0-only package publishers use MinClientVersion=3.6.0?
@rrelyea
are your packages that are targeting NetStandard 2.0 using MinClientVersion of 3.6?
I have created https://github.com/aspnet/EntityFrameworkCore/issues/9668 for this.
how would you suggest we improve the error?
It depends on whether it would make sense for NuGet client to handle .NET Standard versions that it doesn't know about in a special way. E.g. if NuGet client encounters the condition under which it now returns this error, but it finds that the package targets any version of .NET Standard that it doesn't know about, it could return an error saying something like this:
Could not install package ‘Microsoft.EntityFrameworkCore.SqlServer 2.0.0’. The package targets .NET Standard 2.0, which is not supported by this version of NuGet client. Please make sure you are using an up to date version of NuGet Client. For more information, see https://www.nuget.org/downloads.
Otherwise I would go with modifying the existing error to say something like this:
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.7’, but the package does not appear to contain any assembly references or content files that are compatible with that framework. This could happen if NuGet client is not up to date. Please make sure you are using an up to date version of NuGet client (see https://www.nuget.org/downloads), and if the problem persists, consider contacting the package author.
@rrelyea we discussed add MinClientVersion 3.6 to our packages as a partial mitigation for this issue. Before we do it, we need to know for certain that no version of NuGet 2.x will ever add support for .NET Standard 2.0. Is that guaranteed?
@divega - We are not planning on shipping another update to 2.12. It was determined out of scope in discussions with NetStandard and NuGet folks at the beginning of the NS2 effort.
Right now, we don't plan to update the message. But we will listen to feedback over the next several months.
@emgarten
With NuGet 3.6 I get a strange error message in VS2015 with NuGet 3.6 when trying to update the Firebird Provider which sets minClientVersion="3.6" telling me that I need NuGet 3.6.0 while I have 3.6.0-RTM-2511 installed. So I have the required version in 2015 but setup still fail. Is this a NuGet 3.6 bug for VS2015?
@MagicAndre1981 open a new issue for that please.