Open debanne opened 7 years ago
Do you want this to work on a machine without MSBuild installed on it, or would it be OK if when you call the MSBuild APIs it used an installed version of MSBuild with the targets and SDK you need?
Ultimately my tool will be run on developer and CI machines. If a requirement is to install some tools like Build Tools or dotnet CLI, I'm fine with it (it will just add a requirement to the configuration of the machine). I noticed that my code is already calling the external compiler of Build Tools:
Csc: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn\csc.exe
I have just uninstalled Build Tools 2017 RC, and the compiler from Visual Studio is now used:
Csc: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\csc.exe
Another consequence is that the "Restore" target is now working. The problem is that Visual Studio 2017 cannot be a requirement for the CI machines.
Right now, the Build Tools installer doesn't have a checkbox to enable .NET Core scenarios. Ideally it would, but that will have to wait until some post-RTW release.
Setting MSBuildSdksPath
isn't sufficient because the Build Tools copy of Visual Studio also doesn't have NuGet installed, which is how the Restore
target is delivered to the individual projects.
The only current ways to get the Sdk + NuGet installed in the right place relative to MSBuild is through the VS installer (for full-framework MSBuild) and through the dotnet
CLI installation (for .NET Core MSBuild).
I'm trying to build a .NET Core csproj using directly the Microsoft.Build API. The attempt can be seen here: https://github.com/debanne/dotnet-builder/blob/master/Builder/Program.cs I know that there is no nuget providing the targets (until issue #300 is solved), so I configured the "MSBuildSDKsPath" environment variable as a workaround.
My problem is that MSBuild complains when building the "Restore" target with this message:
The "Build" target works correctly though if I have run first a "dotnet restore". I see the Restore target is present in dotnet/sdk/1.0.0-rc4-004771/Nuget.targets. Is there a way to make the Microsoft.Build API use it?
The full output is in attachment: builder_log.txt