-
Notifications
You must be signed in to change notification settings - Fork 418
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
Is it possible to have omnisharp-roslyn target .NET Core? #1703
Comments
yes OmniSharp ships with its own bundled Mono runtime so global Mono installation is not required |
Omnisharps bundled mono runtime does not work on NixOS (this is an inherent thing that can not be worked around). Guix, other architectures and various other setups will also run Core fine but can't run mono.I am asking about running core without mono. This means that users on such systems will have to rebuild mono from source (if even supported at all) if they want to have C# navigation in vscode. |
oh I thought the question was if global Mono was mandatory. If by "Core" you mean ".NET Core" then the answer is currently no, OmniSharp is by design built on top of Mono to provide better/full coverage of the wide variety of MSBuild tasks and projects (.NET Core, Unity, desktop .NET and so on). This would not be possible if it was a .NET Core application since it wouldn't be able to i.e. run arbitrary code that could be part of MSBuild tasks. In fact, it was a .NET Core application at some point in the past but we moved away from it. For NixOS I know that some people used to do some unofficial stuff like building Mono specifically there to work around the fact the original would be built on a differently configured system etc. There was also this package but it's out of date too https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/omnisharp-roslyn/default.nix I can't help here much since we really currently support OmniSharp on GuixSD/Nix like systems. |
Ah, it sounds kind of weird to me that you wouldn't be able to do any of those things from .NET Core (you can still have the entrypoint in .NET Core and run other binaries for .NET Framework when required, no?), but I guess that's just blissful ignorance on my side! Take this as a feature request to drop the mono requirement, then I guess! |
I will move this to omnisharp-roslyn repo. |
Seems it'll be possible when .NET 5 released, am I right? |
Also consider Alpine linux which is very common these days and not glibc-based. Would not not be possible to use multi targeting (or add the mono stuff as a soft dependency and fail gracefully for mono e.g Xamarin projects) and support a reduced feature set (.NET core projects only) with only .net core installed. The only cases of needing anything beyond that I know of is Unity and Xamarin (IIRC, desktop is now supported on .net core), and there is a ton of projects out there not needing those. I understand that supporting multiple targets adds complexity, but I think the case of using Alpine-based containers in VS Code devcontainer.json is (or will be) quite common. |
no there are still issues in terms of executing msbuild tasks that are desktop .NET |
@filipw IMHO the project would benefit greatly from a clear strategy for developing .NET core web/backend services using OmniSharp. Depending on Mono severely restricts the set of containers that can be used. |
like I said, it's not impossible, it just means we would need to have a dual model:
The major problem, however, is that with how things stand at the moment debugger and test execution are also coupled to "full" version due to VS dependencies. Under the hood OmniSharp is not really fully independent of VS. |
" |
Any updates on this subject. Dragging along the full mono-devel dependency for this is becoming increasingly heavy for a very small gain in functionality, especially now with .net 5 and .net 6 on the way. Maybe maintaining the current version for Unity and focusing on .net-framework-less .net 5/6 for future development would make sense? |
OmniSharp ships with its own custom build of Mono which is only ~5MB in size, so I wouldn't call this "heavy" However, yes there is a plan for .NET 5.0 (probably already 6.0) version. FWIW I am running it daily for all my development these days and it seems quite stable 😊It is also a drop-in replacement for the version used at the moment in terms of extension compatibility. Though we don't have a fixed plan when it will be available. |
@filipw As other people pointed out earlier, the embedded version isn't portable. For example IIRC there's still not an aarch64 version (maybe fixed now?) and it's not compatible with Alpine Linux. For a .net 5 dev container, removing the Mono dependency makes a lot of sense. Sounds promising that there is work on .net 5/6 support though! |
hey @filipw,
Am I doing something wrong? |
The generic publish task doesn't work on that branch, try running Also, I am not sure it will work on Linux - I've only been using it on a Mac 🙂 |
Now I'm having another issue. There are dozens of this exceptions in the log and no intellisense at all:
I don't have |
Any ideas why |
|
Cool. Do I need to specify some special target or just
and it worked |
you should set However it was only tested on Windows and MacOS so far so not sure if it will work on Linux |
Yes, as I said, you should find the published x-plat under artfiacts in the platform specific folder. In this case I have no idea what you have under The steps are:
If it doesn't work, then it is because this branch is not supported 😀 |
as I wrote before this is not really an OmniSharp error, it means your configuration is incorrect and you are pointing to a non-existing path. |
your screenshot showed you set |
This is because you have SDK |
ok, I'll try it with older SDK later. Is there a reason it's pinned to a specific version? |
or not. I don't feel like randomly trying all of these to find which one has |
If you don't need to use csx/cake, you can use my fork of omnisharp. "omnisharp.path": "<RepoRootPath>\\artifacts\\omnilight\\OmniSharp.exe", p.s. I use it with 6.0.100-rc.2.21505.57 |
Also, is it expected that Omnisharp breaks even when patch version of SDK changes? E.g. 5.0.401 works but 5.0.402 does not. I've tried to find/replace all 5.0.401 with 5.0.402 but it still doesn't work. Is there a guide what exactly do I need to change to make it work with a specific SDK version? |
This is a current limitation, because OmniSharp loads NuGet assemblies for its own purposes. On the vNext branch (currently .NET 5, to be .NET 6) it would use MSBuild from SDK and it is possible that after an SDK update, the SDK would have newer NuGet binary dependencies that what OmniSharp has and that is the reason for the error. |
Yep, I understand this. I'm trying to figure out what changes do I need to make to get it working with newer SDK versions. Do I need to update NuGet packages? Get newer Nuget binaries somewhere? What do I do to make it work with newer SDKs? Our team is required to update containers from time to time because of vulnerabilities and I don't want to be blocked from doing so because I don't know how to build Omnisharp. |
resolved by #2291 |
Is it possible to use the C# vscode extension without mono at all? On nixos the mono package in repos rarely gets updated and it's a pain to have the extension broken with every other update. I'd wager most users of this extension have 0 use for mono.
The text was updated successfully, but these errors were encountered: