Version: 1.0.0-preview2-1-003177
Commit SHA-1 hash: a2df9c2576
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
VS Code version: 1.7.2
C# Extension version: 1.5.3
I get the following error when opening my Unity (5.4.1f1) project in vscode:
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#ProjectFileInfo] Using tools version: 15.0
[ERROR:OmniSharp#ProjectFileInfo] The reference assemblies for framework ".NETFramework,Version=v2.0" 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.
[WARNING:OmniSharp#MSBuild] Failed to process project file '/Users/abc/Unity/temp/Assembly-CSharp.csproj'.
/Users/abc/Unity/temp/Assembly-CSharp.csproj
get the same error but complains of .NET framework v3.5 not found
Hi @ViktorEvil -- in order for the C# extension to provide IntelliSense for Unity, Mono needs to be installed somewhere on the system. Otherwise, it can't find the assemblies that your projects reference. You can install Mono by downloading it from http://www.mono-project.com/download/ or install it via Howebrew.
@klase I had this same issue, I think it was from multiple mono installs. Installing mono from the download didn't work, but doing:
brew install mono
brew link --overwrite mono
fixed it for me.
It can also happen if "mono" isn't on your path. In order to provide IntelliSense, we attempt to locate the folder that Mono puts target frameworks from the location of "mono". (Essentially, we execute "which mono" and then execute "readlink" a number of times to find the real canonicalized path.)
@DustinCampbell Thanks :)
@Figbash cheers that did it for me as well :)
@DustinCampbell thanks for your help feel free to close this.
Glad to hear you got it working.
@DustinCampbell Thanks very much. brew install mono works for me.
Awesome! Thanks for verifying.
Hello, I know that this is old, and there is already a recommended solution,
but it looks to me that in my setup I shouldn't need to install mono over brew,
since I have mono on my Path, and it looks like I have the reference assemblies
I did not install mono directly, it was installed by Xamarin Studio v6.3.
Do I really need to install mono over brew and overwrite my current installation?

--
joao:/Library$ which mono
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
/Library/Frameworks/Mono.framework/Commands/mono
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Commands/mono
mono-sgen
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Commands/mono-sgen
mono-sgen32
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Commands/mono-sgen32
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Commands/mono-sgen32
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Commands
/Library/Frameworks/Mono.framework/Versions/Current/bin
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Versions/Current/bin/
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Versions/Current/
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Versions/Current
/Library/Frameworks/Mono.framework/Versions/4.8.1
joao:/Library$ readlink /Library/Frameworks/Mono.framework/Versions/4.8.1
joao:/Library$ readlink* /Library/Frameworks/Mono.framework/Versions/4.8.1/
joao:/Library$ **cd /Library/Frameworks/Mono.framework/Versions/4.8.1/
joao:/Library/Frameworks/Mono.framework/Versions/4.8.1$ find . -name "mscorlib.dll"
./lib/mono/2.0-api/mscorlib.dll
./lib/mono/4.0/mscorlib.dll
./lib/mono/4.0-api/mscorlib.dll
./lib/mono/4.5/mscorlib.dll
./lib/mono/4.5-api/mscorlib.dll
[ ... ]
joao:~$ mono --version
Mono JIT compiler version 4.8.1 (mono-4.8.0-branch/22a39d7 Fri Apr 7 12:00:08 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-master/8b1520c)
GC: sgen
I tried what @Figbash suggested which was close but what ended up doing it for me was:
brew unlink mono && brew link mono
Holy Moly! I got this nasty error after installing Visual Studio 2017 for Mac. Then I find it sucks, I uninstalled it, which caused VSCode & OmniSharp this error. Shouldn't have mess with MS products.
brew unlink mono && brew link mono
saved my night, it's 2:32 AM now
I only get this working when after installing something on xcode xcode-select --install and then brew install mono
Most helpful comment
@klase I had this same issue, I think it was from multiple mono installs. Installing mono from the download didn't work, but doing:
brew install mono
brew link --overwrite mono
fixed it for me.