Bug 57771 - F#.NET Core 2.0 projects do not compile
Summary: F#.NET Core 2.0 projects do not compile
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.2 (2017-04)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.4
Assignee: Jason Imison
Depends on:
Reported: 2017-06-26 18:19 UTC by Matt Ward
Modified: 2017-09-27 14:41 UTC (History)
4 users (show)

Tags: No_Shiproom
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Matt Ward 2017-06-26 18:19:10 UTC
To repro:

1) Install .NET Core 2.0 preview 2 (2.0.0-preview2-006497):
2) dotnet new console -lang f#
3) msbuild /t:Build ProjectName.fsproj

Expected result:

Project compiles.

Actual result:

 error MSB4057: The target "Build" does not exist in the project.

Note that building the solution works but it does not actually build anything. The bin/netcoreapp20 folder is not created.


Run two exports before running the build:

export FSharpPropsShim=/usr/local/share/dotnet/sdk/2.0.0-preview2-006497/FSharp/Microsoft.FSharp.NetSdk.props
export FSharpTargetsShim=/usr/local/share/dotnet/sdk/2.0.0-preview2-006497/FSharp/Microsoft.FSharp.NetSdk.targets

Initial investigation:

Latest .NET Core projects for F# do not have an FSharp.NET.Sdk Sdk attribute in the project. They look the same as a C# project:

<Project Sdk="Microsoft.NET.Sdk">


    <Compile Include="Program.fs" />


Instead the FSharp targets are imported based on the project file extension. However they fail since they do not define the FSharpPropsShim property. Searching the .NET Core sdk files we see:


     <FSharpPropsShim Condition = " '$(FSharpPropsShim)' == '' and Exists('$(MSBuildToolsPath)\FSharp\Microsoft.FSharp.NetSdk.props') ">$(MSBuildToolsPath)\FSharp\Microsoft.FSharp.NetSdk.props</FSharpPropsShim>

     <FSharpPropsShim Condition = " '$(FSharpPropsShim)' == '' and Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.NetSdk.props') ">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.NetSdk.props</FSharpPropsShim>

  <Import Condition=" '$(UseBundledFSharpTargets)' == 'true' and Exists('$(FSharpPropsShim)') " Project="$(FSharpPropsShim)" />

So presumably we need to ship the Microsoft.FSharp.NetSdk.props file that is used by .NET Core 2.0 somewhere in Mono. The MSBuildToolsPath is set to "/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin" when building with Mono
Comment 2 Ankit Jain 2017-06-26 19:47:44 UTC
This ('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.NetSdk.props) should be installed by our fsharp build, AFAICS. Maybe an update is required? Passing this to Jason.
Comment 5 Neeraj Deshmukh 2017-09-21 09:54:18 UTC
Verified on 15.4 build, issue is not reproducible.

Steps Performed:
1. Install .Netcore 2.0 and Create .Net new console app (f# language)
2. Build project and observe bin/netcoreapp20 folder
Visual Studio Enterprise 2017 for Mac (Preview)
Version 7.2 Preview (7.2 build 617)
Mono (2017-06/7d788778005) (64-bit)
Xamarin.Android Version: (Visual Studio Enterprise)
Xamarin.iOS Version: (Visual Studio Enterprise)
Xamarin.Mac Version: (Visual Studio Enterprise)
Operating System Mac OS X 10.12.6

Build Info : https://gist.github.com/neerajdeshmukh/10e01593e96222b944c30f2f35999de3

Screencast : https://www.screencast.com/t/vsVapdoaH

Kindly let me know if anything else is required as a validation process.
Comment 6 Matt Ward 2017-09-21 15:03:40 UTC
@Neerja - Building with VS Mac does not verify the bug is fixed. VS Mac has a workaround to avoid the bug. The repro steps for the bug make no mention of VS Mac.
Comment 7 Neeraj Deshmukh 2017-09-21 15:12:50 UTC
Oh I See. I will re verify it again.
Comment 8 Neeraj Deshmukh 2017-09-21 15:14:10 UTC
Changing status to Resolved fix for now