Hybrid DotNet Core / .NET Framework Build with MSBuild
dotnet msbuild
from sln directory works
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
from solution directory works
I don't want VS 2017 to have to be installed on the build machine, so I installed "Build Tools for Visual Studio 2017" from https://www.visualstudio.com/downloads/ .
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe
bombards every project in sln with the error:
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. Make sure the path in the declaration is correct and that the file exists on disk.
In truth, it doesn't exist on disk. It only exists in the VS subfolder in
C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Enterprise \ MSBuild \ Sdks
I have manually tried installing .NET 4.6 SDK, .NET Core 1.0 SDK, and .NET Core 1.0.1 SDK (x86 and x64 versions).
Is there a way to make the MSBuild function correct, or is it just unrecoverable like so much more?
source to share
The only way I have found so far is to create a compile config where I target all .NetCore and .net Standard projects and another one for all .Net projects (or just use the release config).
Then I use MsBuild twice to build.
MSBuild.exe MySolution.sln / p: Configuration = DotNetCore
MSBuild.exe MySolution.sln / p: Configuration = Release
It works for VS2017 solutions.
source to share
The Build Tools installer does not currently support .NET Core workloads. At this point, you should have Visual Studio installed on your build machines (or, as you've noticed, install the .NET Core SDK and call dotnet msbuild
instead msbuild.exe
).
This issue is tracked on the MSBuild GitHub repository: https://github.com/Microsoft/msbuild/issues/1697 .
source to share