Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "NETSDK1045 The current .NET SDK does not support .NET Core 3.0 as a target" when using Blazor Asp.NetCore hosted template

I've installed the preview of .NetCore 3.0 and tried to run the blazor template Blazor (ASP.NET Core hosted) in Visual Studio 2019:

enter image description here

The error that occured, was the following:

NETSDK1045 The current .NET SDK does not support .NET Core 3.0 as a target. Either target .NET Core 2.2 or lower, or use a .NET SDK version that supports .NET Core 3.0.

like image 749
FranzHuber23 Avatar asked Apr 18 '19 08:04

FranzHuber23


2 Answers

During these days I had to overcome this issue on a number of different development machines/containers: eventually, I found no less than 6 different reasons that could cause this kind of error:

  1. Missing .NET Core 3 SDK (x86 or x64)
  2. .NET Core SDK preview support not enabled in VS2019
  3. VS2017 instead of VS2019
  4. Wrong SDK path in PATH environment variable(s)
  5. Wrong SDK path in MSBuildSDKsPath environment variable(s)
  6. Wrong SDK version in the project's global.json file

The workarounds for those scenarios are pretty easy to understand, you basically have to either install the proper SDK or remove the "offending" SDK reference(s). However, I did my best to document them all in this post on my blog.

like image 98
Darkseal Avatar answered Sep 30 '22 17:09

Darkseal


Following this comment, I managed to resolve the problem by installing the x86 version of the .NET Core 3.0 additionally to the x64 version. The build worked after restarting Visual Studio (2019).

like image 27
FranzHuber23 Avatar answered Sep 30 '22 15:09

FranzHuber23