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

.NET v3.5 issues with Emacs 25.3.1 and Unity3D #426

Closed
ijacquez opened this issue Mar 7, 2018 · 12 comments
Closed

.NET v3.5 issues with Emacs 25.3.1 and Unity3D #426

ijacquez opened this issue Mar 7, 2018 · 12 comments

Comments

@ijacquez
Copy link

ijacquez commented Mar 7, 2018

Here are all the versions of Mono installed:

  • 2.11.4
  • 3.12.0
  • 3.12.1
  • 4.3.2
  • 5.8.0

Version of Omnisharp: v1.26.3

*omnisharp-log* buffer shows

[12:23:33] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, 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.

I tried to clear the GAC via gacutil. I even cleared the GAC.

Is there anything else worth trying?

@GroundCombo
Copy link

I have the same problem. Omnisharp v1.26.3 installed via M-x omnisharp-install-server.

The interesting thing is that omnisharp seems to start fine from the command line in the .emacs.d/cache directory: ./run -s <path-to-solution>. However, using M-x omnisharp-start-omnisharp-server from emacs results in the same error message as above.

Which magic mono bits or paths would I have to twiddle to make it find the framework when run inside emacs? Full log attached.

omnisharp-log.txt

@razzmatazz
Copy link
Contributor

razzmatazz commented Mar 12, 2018

I am not sure what could be wrong here, but here are a couple of options, off my mind..

  • customize the omnisharp-expected-server-version variable to a newer omnisharp server version (the default ATM is "1.26.3") – one of versions from https://github.com/OmniSharp/omnisharp-roslyn/releases, sans the 'v' prefix, e.g. "1.29.1"; and then do M-x omnisharp-install-server to update the server;
  • install MS dotnet core sdk, maybe it has SDK integrated that will be picked by msbuild for your project properly;
  • report an issue to https://github.com/OmniSharp/omnisharp-roslyn/issues as they are maintaining the actual omnisharp server and they might have a better idea what a proper fix would be..

@razzmatazz
Copy link
Contributor

razzmatazz commented Mar 12, 2018

@GroundCombo do you mean you don't get any errors when starting the server from console/terminal, compared to what you get on omnisharp-log?

then the only difference there is (I think) is that omnisharp passes "--encoding utf-8" to the server command line as well.. can you check if starting it from console with --encoding flag breaks it on console too?

@GroundCombo
Copy link

GroundCombo commented Mar 12, 2018

./run --encoding utf-8 -s <solution> works fine, omnisharp reads the project without errors and I can see the source files in the log. I assume this has to be some kind of environmental difference between the shell and the Emacs application, but I don't really know what to look for. omnisharp-start-omnisharp-server seems to use the correct script and mono.osx executable.

edit: I also tried installing v1.29.1 - same thing.

@razzmatazz
Copy link
Contributor

can you check those with ps eww $PID ?

@GroundCombo
Copy link

Well this looks like another facepalmingly simple issue. $PATH for the emacs process didn't contain any paths with mono executables, so I added /Library/Frameworks/Mono.framework/Versions/Current/Commands to the path and restarted the server; completion works now. Thanks for prodding me in the right direction.

@razzmatazz
Copy link
Contributor

Great! Do you think we should add a warning or something on a mac in omnisharp-emacs? At least a couple of persons tripped on it, might be worth it? Or something like 'M-x omnisharp-doctor'?

@GroundCombo
Copy link

Couldn't hurt, I suppose. I don't know how tough it would be to catch the potential gotchas with mono and emacs installations, but checking some common errors would be helpful especially to Unity developers whose exposure to mono might be limited to one-channel audio.
M-x omnisharp-install-server is really nice, though.

@ijacquez
Copy link
Author

Thanks guys. I'll try it out. Wouldn't setting a default path to Mono in run be sufficient?

@razzmatazz
Copy link
Contributor

@ijacquez that script is served by omnisharp-roslyn server binary. I could try to override it in omnisharp-emacs but it is probably better to refer to maintainers of https://github.com/OmniSharp/omnisharp-roslyn

razzmatazz added a commit to razzmatazz/omnisharp-emacs that referenced this issue Mar 13, 2018
razzmatazz added a commit that referenced this issue Mar 13, 2018
README.md: add troubleshooting note on macos $PATH issue (#426)
@ijacquez
Copy link
Author

I can confirm that all works. For those looking for a quick fix:

;; For OmniSharp, place this before (require `omnisharp)
(setenv "PATH" (concat (getenv "PATH") ":/Library/Frameworks/Mono.framework/Versions/Current/Commands"))
(setq exec-path (append exec-path '("/Library/Frameworks/Mono.framework/Versions/Current/Commands")))

@razzmatazz
Copy link
Contributor

razzmatazz commented Mar 15, 2018

@ijacquez thanks! will add this note to README.md in the troubleshooting section

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

No branches or pull requests

3 participants