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:
- Missing .NET Core 3 SDK (x86 or x64)
- .NET Core SDK preview support not enabled in VS2019
- VS2017 instead of VS2019
- Wrong SDK path in PATH environment variable(s)
- Wrong SDK path in MSBuildSDKsPath environment variable(s)
- 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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…