-
Notifications
You must be signed in to change notification settings - Fork 26
DotNetHost path when compiling with Mono's MSBuild #75
Description
Visual Studio for Mac uses MSBuild that ships with Mono 4.8.0 to compile .NET Core projects. With F# projects this currently fails since the FSharp.NET.Core.Sdk.targets assume that the dotnet host executable ships with MSBuild which is not the case for Mono.
Building with Mono:
Set Property: _DotNetHostExecutableName=dotnet
Set Property: _DotNetHostExecutableDirectory=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/../..
Set Property: _DotNetHostExecutablePath=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/../../dotnet
Set Property: _FscTask_FscToolExe=dotnet
Set Property: _FscTask_FscToolPath=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/../..
Set Property: _FscTask_DotnetFscCompilerPath= "~/.nuget/packages/fsharp.compiler.tools/4.1.0/build/netcoreapp1.0/fsc.dll"
Build FAILED.
~/.nuget/packages/fsharp.net.sdk/1.0.0/build/FSharp.NET.Core.Sdk.targets(122,9): error MSB6004: The specified task executable location "/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/../../dotnet" is invalid.
Building with dotnet:
Set Property: _DotNetHostExecutableName=dotnet
Set Property: _DotNetHostExecutableDirectory=/usr/local/share/dotnet/sdk/1.0.0-rc4-004771/../..
Set Property: _DotNetHostExecutablePath=/usr/local/share/dotnet/sdk/1.0.0-rc4-004771/../../dotnet
Set Property: _FscTask_FscToolExe=dotnet
Set Property: _FscTask_FscToolPath=/usr/local/share/dotnet/sdk/1.0.0-rc4-004771/../..
Set Property: _FscTask_DotnetFscCompilerPath= "~/.nuget/packages/fsharp.compiler.tools/4.1.0/build/
FSharp.NET.Core.Sdk.targets:
<_DotNetHostExecutableName>dotnet</_DotNetHostExecutableName>
<_DotNetHostExecutableName Condition=" '$(OS)' == 'Windows_NT' ">$(_DotNetHostExecutableName).exe</_DotNetHostExecutableName>
<_DotNetHostExecutableDirectory>$(MSBuildExtensionsPath)/../..</_DotNetHostExecutableDirectory>
<_DotNetHostExecutablePath>$(_DotNetHostExecutableDirectory)/$(_DotNetHostExecutableName)</_DotNetHostExecutablePath>
Visual Studio for Mac can compile F# .NET Core projects if the MSBuildExtensionsPath property is set to point to the correct .NET Core Sdk folder. However I am wondering if this the best way to solve this. Would it be possible to configure _DotNetHostExecutableDirectory property through another MSBuild property other than MSBuildExtensionsPath? So the FSharp.NET.Core.Sdk.targets would have something like:
<_DotNetHostExecutableDirectory Condition="$(_DotNetHostExecutableDirectory ) == '' ">$(MSBuildExtensionsPath)/../..</_DotNetHostExecutableDirectory>
Or perhaps better use the MSBuildSDKsPath property which is used with the Microsoft.NET.Sdk MSBuild targets:
<_DotNetHostExecutableDirectory>$(MSBuildSDKsPath)/../../..</_DotNetHostExecutableDirectory>
The MSBuildSDKsPath points at the Sdks directory:
/usr/local/share/dotnet/sdk/1.0.0-rc4-004771/Sdks/