3

I'm trying to use F# with VS Code (v1.17.2) on MacOS (Sierra 10.12.6) I think i've installed latest versions of Mono and .NET SDK

I'm trying just to build the simple project described here as a test https://github.com/s952163/FSharpVSCode

after my default installation, I could do a MSBuild and run the program in the terminal without any problem. However at that stage, (1) Intellisense is not working properly, not recognizing Deedle (2) in the F# explorer it would say 'TestProject1.fsproj (load failed) when doing a right-click i got this error

Error: MSBuild failed with exitCode 1 Working Directory: '/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1' Exe Path: 'dotnet' Args: 'msbuild /Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmp52c377ed.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpfe4a2c2.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpfe4a2c2.tmp.GetProperties.txt /nologo /verbosity:quiet' Log: writing helper target file in '/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/obj/TestProject1.fsproj.proj-info.targets' /usr/local/share/dotnet/sdk/2.0.2/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" 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. [/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj]

to try to solve this, i typed in the following

export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/

but worse, after that, the project doesn't build anymore in VS Code as I get this output when trying (Cmd-Shift-P) MSBuild: Build Project

/usr/local/share/dotnet/sdk/2.0.2/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" 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. [/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj]

screenshot here https://i.stack.imgur.com/ZkQQO.jpg

Fagui Curtain
  • 1,867
  • 2
  • 19
  • 34

2 Answers2

1

VS Code environment is passed to msbuild when it invokes it, so setting environment variables on startup of VS Code does the trick:

FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/ code .

DaveC
  • 364
  • 3
  • 10
  • 1
    I'm not familiar with that. how do I do that exactly ? isn't it what I've been trying to do as per I wrote above with `export...` – Fagui Curtain Oct 31 '17 at 16:57
-1

Go to project location in the terminal and then run FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/ code . as said before.

Then you should be able to build again.