I ran into this error after playing with the installation of .Net Core 2.0 and seemingly messed it up. I would get the same error for dotnet restore , dotnet build or dotnet msbuild . In fact, everything related to .Net Core and msbuild.
The error occurred because the MSBuildSDKsPath environment MSBuildSDKsPath was still pointing to the old .Net Core 1.1 SDK.
To fix this problem, I manually set the MSBuildSDKsPath environment variable to specify the 2.0.0 SDK path, which for me with x64 was as follows: C:\Program Files\dotnet\sdk\2.0.0\Sdks .
Basically, if you have Sdk="Microsoft.NET.Sdk" in your .csproj , then a folder with the same name should exist in your MSBuildSDKsPath location.
Sebastian nemeth
source share