antonio
antonio

Reputation: 11110

MSBuild: imported project ... Sdk.props was not found

I installed Build Tools for Visual Studio 2017 and tried to build the DiscUtils solution with:

& "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" DiscUtils.sln

I get for all 51 C# projects:

error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props" was not found.
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Upvotes: 6

Views: 7987

Answers (2)

antonio
antonio

Reputation: 11110

In short MSBuild is broken, see @Martin Ullrich.

To build use:

choco install dotnetcore-sdk
& "C:\Program Files\dotnet\dotnet.exe"  restore  DiscUtils.sln
& "C:\Program Files\dotnet\dotnet.exe" msbuild DiscUtils.sln -p:FrameworkPathOverride="c:\Windows\Microsoft.NET\Framework64\v4.0.30319"

If you don't use Chocolatey, download manually the .NET Core SDK

FrameworkPathOverride is necessary if you don't have Visual Studio. VS solutions expects to find reference assemblies in:

C:\Program Files\Reference Assemblies\Microsoft\Framework\v*

Without VS, you can resort to those in c:\Windows\Microsoft.NET\Framework64\v4.0.30319

Note that, if the solutions generates different assembly for different targets frameworks and you need them, you need to install related SDKs.

Upvotes: 5

Martin Ullrich
Martin Ullrich

Reputation: 100543

At the time of writing, the VS 2017 Build Tools are missing critical components necessary for building SDK-based ("new-world") csproj files (to be specific: the SDKs and integrated NuGet are missing).

See this GitHub issue for tracking and a few workarounds: https://github.com/Microsoft/msbuild/issues/1697

Upvotes: 7

Related Questions