Reputation: 5994
How can we set netstandard 2.1 preview as target framework within a csproj file?
The following does not work:
<TargetFramework>netstandard2.1</TargetFramework>
dotnet core 2.1 preview sdk is installed.
Upvotes: 5
Views: 8399
Reputation: 148
How can we set netstandard 2.1 preview as target framework within a csproj file?
Until this very moment NetStandard 2.1 is still in preview. To target NetStandard 2.1 preview:
<TargetFramework>netstandard2.1</TargetFramework>
To install NETStandard.Library using package manager console:
Install-Package NETStandard.Library -Version 2.1.0-preview1-27119-01 -Source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
.
refer to this link for more details regarding acquiring NetStandard 2.1 preview. And to this link for general information regarding using NetStandard 2.1 preview and how it relates to other Net frameworks.
dotnet core 2.1 preview sdk is installed.
don't confuse .Net frameworks. NetStandard 2.1 is only supported by dotnet core 3 and later. read here for NetStandard support by other Net frameworks.
Upvotes: 0
Reputation: 21568
.NET Core and .NET Standard numbering are independent of each other. In Microsoft's Announcing .NET Standard 2.1 blog post it was announced that Standard 2.1 will be implemented by .NET Core 3.0 and upcoming versions of Xamarin, Mono, and Unity (and not the legacy .NET Framework). In other words, a .NET Core 2.1 SDK will be of no use to you in this regard - to target Standard 2.1 you will need Core 3.0, not Core 2.1.
The rationale for this arguably confusing decision is explained in the .NET Standard 2.1 README on GitHub. Whilst acknowledging that giving .NET Standard vNext the version number 3.0 would "[align] with .NET Core, which will be released at the same time as .NET Standard vNext", they concluded:
Ultimately, we decided to go with 2.1 because in the end all versioning schemes have pros & cons and thus will cause some confusion, so we went with the versioning scheme that felt most natural for .NET Standard.
Upvotes: 2
Reputation: 1178
It seems there is no way to do it right now. The netstandard2.1 is still on the way while the .NET Core 3.0 preview had been released.
Upvotes: 1
Reputation: 3370
.NET Standard 2.0 is the latest available .NET Standard. Libraries targeting .NET Standard 2.0 can be used by .NET Core 2.1 and all frameworks that support .NET Standard 2.0.
If you would like to target .NET Core 2.1, use this TargetFramework: netcoreapp2.1
Upvotes: 2
Reputation: 42062
Somewhat confusingly, early 2.1.x versions of the dotnet core SDK didnt support targetting netcoreapp 2.1. The latest preview version (2.1.300) does support targetting netcoreapp 2.1.
Upvotes: 1