3
votes

How do I target .Net Core 2.1 on a Mac? When I change the .csproj content to target netstandard2.1 I get the following error

"/usr/local/share/dotnet/sdk/2.1.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(150,5): error : The current .NET SDKdoes not support targeting .NET Standard 2.1. Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [/Users/user/Documents/Projects/vsCode/DotNet/AlexaDemo/data/data.csproj]"

Dotnet --info returns

dotnet --info .NET Core SDK (reflecting any global.json): Version:
2.1.300 Commit: adab45bf0c

Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS Platform: Darwin RID: osx.10.13-x64 Base Path:
/usr/local/share/dotnet/sdk/2.1.300/

Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba

.NET Core SDKs installed: 2.0.0 [/usr/local/share/dotnet/sdk] 2.1.4 [/usr/local/share/dotnet/sdk] 2.1.300 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

I am using vsCode on Mac if that makes any difference. Thanks

2

2 Answers

0
votes

The answer is there is no dotnetstandard2.1 as of yet. classlib projects should target NET Standard 2.0 and console, mvc and api projects should target netcoreapp2.1.

-1
votes

I believe targeting a specific release of dotnet Core is not available on VS or VSCode for mac. However, using Rider #jetbrains, I was able to choose the framework version when creating a new solution.

Best