編譯錯誤
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
仔細查看后,發現置頂了preview
打開project,查看項目的target framework,有install other frameworks的選項
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
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
打開preview的開關
安裝了上面的preview,vs里面才會有勾選。另外升級vs16.2.2會導致這個失效?
Have you enabled previews of .NET Core in Visual Studio: tools -> options -> environment -> preview features?
安裝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.