编译错误

Severity Code Description Project File Line Suppression State
Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. TestApp C:\Program Files\dotnet\sdk\2.1.504\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 137

 

官方只提供了 .net core 2.2

https://dotnet.microsoft.com/download

The current .NET SDK does not support targeting .NET Core 3.0_html

仔细查看后,发现置顶了preview The current .NET SDK does not support targeting .NET Core 3.0_编译错误_02

 

 

 

打开project,查看项目的target framework,有install other frameworks的选项

The current .NET SDK does not support targeting .NET Core 3.0_html_03

https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral

.NET Core 3.0.0 Preview 2 - January 29, 2019

https://github.com/dotnet/core/blob/master/release-notes/3.0/preview/3.0.0-preview2.md  

 The current .NET SDK does not support targeting .NET Core 3.0_.net_04

https://github.com/dotnet/core/blob/master/release-notes/3.0/preview/3.0.0-preview8-download.md

 dotnet-sdk-3.0.100-preview8-013656-win-x64.exe

 

解决方法

安装 dotnet-sdk-3.0.100-preview-010184-win-x64.exe

 The current .NET SDK does not support targeting .NET Core 3.0_github_05

 

打开preview的开关

安装了上面的preview,vs里面才会有勾选。另外升级vs16.2.2会导致这个失效?

The current .NET SDK does not support targeting .NET Core 3.0_.net_06

新版本换了配置的地方https://developercommunity.visualstudio.com/content/problem/388470/target-framework-net-core-30-not-available.html

Have you enabled previews of .NET Core in Visual Studio: tools -> options -> environment -> preview features?

The current .NET SDK does not support targeting .NET Core 3.0_github_07

 

 

安装vs2019

To create or open applications targeting .NET Core 3.0, Visual Studio 2019 or newer is required. Click the following link to download the latest version of Visual Studio 2019. If you are after an offline installation follow these instructions on how to install offline.