by

Unity3D, VSCode, OS X and ‘The reference assemblies for framework “.NETFramework,Version=v3.5” were not found’ error

This happened to me in this environment:
* OS X 10.10.5
* Unity 5.6.0b7
* VSCode 1.9.1 with C# extension 1.7.0

I had this error inside of VSCode when I opened up a Unity project:

The reference assemblies for framework “.NETFramework,Version=v3.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.

Also, VSCode’s code completion did not work. Even with the right version of OpenSSL:

$openssl version
OpenSSL 1.0.2k  26 Jan 2017

and dotnet:

$dotnet

Microsoft .NET Core Shared Framework Host

  Version  : 1.1.0
  Build    : 928f77c4bc3f49d892459992fb6e1d5542cb5e86

I found this fix here:
https://github.com/OmniSharp/omnisharp-vscode/issues/1004

I had to install mono with

brew install mono

with that, I could run mono

$mono --version
Mono JIT compiler version 4.6.2 (Stable 4.6.2.16/ac9e222 Sun Jan  8 00:00:20 GMT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug
    LLVM:          supported, not enabled.
    GC:            sgen

just to prove it is installed. VSCode’s OmniSharp found acknowledged it found in its own output window while starting up and loading the project:

Discovered Mono file path: /usr/local/bin/mono
Resolved symbolic link for Mono file path: /usr/local/Cellar/mono/4.6.2.16/bin/mono-sgen

Then my code completion worked. Yay!