ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
859 stars 279 forks source link

Can't target older framework with new Net Core build system #672

Closed Danl2620 closed 6 years ago

Danl2620 commented 6 years ago

On macOS, after upgrading to the latest Visual Studio and converting my project files to use the Microsoft.NET.Sdk project build system and targeting net45 Framework, I get this error from Ionide (also from using dotnet build but not from msbuild)

/usr/local/share/dotnet/sdk/2.2.0-preview1-007736/Microsoft.Common.CurrentVersion.targets(1124,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" 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. 
Krzysztof-Cieslak commented 6 years ago

It's known dotnet CLI bug, the workaround is setting FrameworkPathOverride variable on the machine as described here - https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-1.0.1#using-net-framework-as-targets-framework-the-osxunix-build-fails. After setting the variable remove obj dir and then run dotnet restore again.

TheAngryByrd commented 6 years ago

@Krzysztof-Cieslak is FrameworkPathOverride worth exposing as a variable or setting for ionide? And/Or should it be documented to put in your .bashrc or .bash_profile ?