Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX + Unity error #1004

Closed
klase opened this issue Dec 1, 2016 · 14 comments
Closed

OSX + Unity error #1004

klase opened this issue Dec 1, 2016 · 14 comments

Comments

@klase
Copy link

klase commented Dec 1, 2016

Environment data

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

@ViktorEvil
Copy link

get the same error but complains of .NET framework v3.5 not found

@DustinCampbell
Copy link
Member

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.

@Figbash
Copy link

Figbash commented Dec 6, 2016

@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.

@DustinCampbell
Copy link
Member

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.)

@ViktorEvil
Copy link

@DustinCampbell Thanks :)

@klase
Copy link
Author

klase commented Dec 7, 2016

@Figbash cheers that did it for me as well :)

@klase
Copy link
Author

klase commented Dec 7, 2016

@DustinCampbell thanks for your help feel free to close this.

@DustinCampbell
Copy link
Member

Glad to hear you got it working.

@yangruihan
Copy link

@DustinCampbell Thanks very much. brew install mono works for me.

@DustinCampbell
Copy link
Member

Awesome! Thanks for verifying.

@jvlppm
Copy link

jvlppm commented Apr 15, 2017

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?

screen shot 2017-04-14 at 22 12 27

--

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

@kenmgrimm
Copy link

I tried what @Figbash suggested which was close but what ended up doing it for me was:
brew unlink mono && brew link mono

@gamefish
Copy link

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

@dalmazo
Copy link

dalmazo commented Dec 18, 2017

I only get this working when after installing something on xcode xcode-select --install and then brew install mono

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants