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

Option for using global mono installation when starting the omnisharp language server #60

Open
ryanwebber opened this issue Jun 19, 2021 · 0 comments

Comments

@ryanwebber
Copy link

ryanwebber commented Jun 19, 2021

I was hitting omnisharp errors loading my Unity project:

This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code)

This comment in the omnisharp-roslyn repo suggests that omnisharp ships with a version of mono that intentionally omits the reference assemblies, and that vscode users should toggle this setting to use global mono (which tells the omnisharp vscode extension to use the version of mono on the users PATH to start the omnisharp server). I don't see any equivalent options here.

The workaround I came up with was to hack the run script (https://github.com/OmniSharp/omnisharp-roslyn/blob/master/mono-packaging/run) of the omnisharp language server download to use my globally installed mono, at which point things seemed to start working.

The run script provided by omnisharp-roslyn doesn't have any options for supplying a custom mono executable, but one possible solution would be to ship a custom run script with this extension and use that instead of the run script provided by omnisharp-roslyn, which would let users supply a custom mono path via coc-settings.json. But ideally this extension would do something similar to whatever the omnisharp vscode extension is doing when omnisharp.useGlobalMono is set.

edit: Looks like the vscode extension uses the packaged run script on windows but on *nix systems it launches OmniSharp.exe with either the packaged version of mono or the globally available mono depending on that config option (see https://github.com/OmniSharp/omnisharp-vscode/blob/3534e25767984104d0748cf45457b51d8a598e59/src/omnisharp/launcher.ts#L276). Seems reasonable to try and do the same thing here?

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

1 participant