fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
515 stars 154 forks source link

Fix build of net4XXX target frameworks on mono #344

Open baronfel opened 5 years ago

baronfel commented 5 years ago

Description

When building a project generated from this repo on net46x/net47x, you get the infamous missing reference assemblies error:

/usr/share/dotnet/sdk/2.2.202/Microsoft.Common.CurrentVersion.targets(1183,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/me/Foo/tests/Foo.Tests/Foo.Tests.fsproj]

This can be fixed by setting the FrameworkPathOverride to the matching mono base library directory, the logic of which is handily captured here. This file should be copied and added as an Import include in the project files for the sample projects in this repo, like MiniScaffold does, to sidestep this very issue.