Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

msbuild

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.
like image 585
antonio Avatar asked May 03 '17 10:05

antonio


2 Answers

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

like image 51
Martin Ullrich Avatar answered Oct 08 '22 12:10

Martin Ullrich


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.

like image 26
antonio Avatar answered Oct 08 '22 13:10

antonio