-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
SDK resolver does not work with snap installations of SDK on Linux #10403
Comments
I don't think only the snap is affected. |
Thanks, @Torquerrr, I'd seen the arch/manjaro issues, but thought it was something with mono there. Now we have the simpler explanation, and so I think even if we handle snap more efficiently we should have the ultimate fallback to slow path of shelling out. That said, would it be hard to make that a symlink on arch? That will resolve faster. |
If you see other reports of arch/manjaro issues, can you link here? |
I forgot to mention that I do have the latest Mono (5.20) installed, as well as
@alucryd could you please provide your thoughts on that? |
I read too quickly and was mistaken here, it sets DOTNET_ROOT. There is a better solution for this now to store where dotnet is installed globally for apphosts. Looking for the docs. |
https://github.com/dotnet/designs/blob/master/accepted/install-locations.md Instead of DOTNET_ROOT, /opt/dotnet can be written to /etc/dotnet/install_location However, this will require updating to 3.0 |
@nguerrera Just tried to manually create a symbolic link instead of .sh file pointing to |
What version is |
|
Hmm, do you have "Microsoft.DotNet.MSBuildSdkResolver.dll" under /usr/lib/mono/msbuild? |
@nguerrera Nope. I've checked in |
OK, that is actually a problem here on top of the symlink or lack thereof. That mono has the web sdk baked into it, no razor sdk, and no resolver to find dotnet. cc @radical |
(I really wish mono would stop baking sdks into its msbuild and using the resolver always, same as VS msbuild.) |
cc @livarcocc |
@nguerrera Made a full filesystem search just to be sure and found only these two:
|
Those are with the private mono in omnisharp so it's an issue that it's missing in the real mono. Out of curiosity, does it work if you temporarily uninstall mono? Are you able to upgrade mono to more recent version and does that help? |
@Torquerrr how did you install mono? It is supposed to include the resolver. |
@nguerrera Here's the OmniSharp Log after OmniSharp LogStarting OmniSharp server at 8/10/2019, 10:31:48 AM Target: /home/torquerrr/Projects/NET Projects/NewWebAppOmniSharp server started. Starting OmniSharp on manjaro 0.0 (x64) Attempted to update project that is not loaded: /home/torquerrr/Projects/NET Projects/NewWebApp/NewWebApp.csproj Edit: It looks like now it fails to find The project was created with
@radical I install it with |
@nguerrera, @radical
Looks like it's a known issue? |
It looks like the C# plugin / omnisharp is not up to date. How are you installing that? Can you try the scenario:
As for the scenario with a mono, with a proper resolver, that NETSDK1061 is not in itself an issue. The linked doc would explain the the cases where that can happen and how to avoid it. But, if there's something about how restore is happening in VS Code that is triggering it, that is not known. |
@nguerrera You can find the log attached above by me showing how does it look like without mono installed (https://github.com/dotnet/cli/issues/12110#issuecomment-520127598) |
My bad, I misread the latest version of the C# plugin elsewhere. I will try to spin up an arch VM to play with some of this, but it won't be too quick to be able to do that. Thank you for all of the extra info. |
@nguerrera Sure, thanks in advance! I am also thinking of spinning a clean Manjaro installation in the VM. So we can compare installed packages' versions. |
@nguerrera
And one can run into three types of errors with this (OmniSharp):
But then I set And immediately I've embraced them all: Last week I tried creating a symlink for Unfortunately you cannot remove Mono completely. First, because it is used as a base for MSBuild (correct me if I am wrong), second - Mono is required for Unity development workflows (but it seem to work if you just turn the Mono off globally as I showed above). Bottom line:
I will try to let the
So I guess it behaves the way that it is able to find the
P.S. I don't think that this approach is much better than setting the |
getting similar problem with error
|
For anyone else having this problem after installing the dotnet sdk using apt on ubuntu, I found that having dotnet at /usr/share/dotnet doesn't work on its own. However, if I create a symlink from /usr/share/dotnet to ~/dotnet, it works. I also have set the MSBuildSdksPath:
|
I was struggling with omnisharp not resolving the dotnet-sdk snap on 20.04 until I discovered that a simple
did the trick. No need for msbuild path exports or an omnisharp json legacy resolver. |
Thanks! It's works as a charm! Only, I found other problem, for example, if you want execute your project from command line: p.d: My apologies, but my English is not very good. |
@jeffkhull I solve the problem only exporting the variable export MSBuildSDKsPath="/usr/share/dotnet/sdk/$(dotnet --version)/Sdks" Thanks a lot!!! |
DO NOT USE Ubuntu. I have no problems using the .net5 RC1 on Fedora 33 beta. Download the dotnet-sdk SDK manually. Start VSCode with a script file with this content: where you have to adapt XXX and YYY to your case. DO NOT USE Ubuntu snap. From my console: xxx:~$ dotnet Usage: dotnet [options] Options: path-to-application: Previously: I made this post already here and here. On Ubuntu 20.04.1, the problem is the snap alias. Do not install it. Instead do this: sudo snap install dotnet-sdk --channel=5.0/beta --classic DO NOT install the alias because it makes Omnisharp not find the SDK. It can be removed with: Start VSCode with a script file with this content: You have to adapt the second line, that starts VSCode insiders, to your case. |
Would it be possible to look for the SDK in the DOTNET_ROOT environment variable? Adding the SDK to the path causes a lot of problems (at least the snap installation) but having it in a separate variable should be a good 'workaraound'. |
Fantastic. This solved for me too. Thank you |
Getting following error when running
|
Open a new issue. This doesn't seem at all related to the topic of this issue. |
Similar problem on arm64 Mac, with vscode Insiders. Running
My dotnet was installed by UnrealEngine. Is this an incompatible version? Why is
|
Snap installs are managed by canonical, so we created a new issue here canonical/dotnet-snap#13 and also updated the documentation. |
See dotnet/vscode-csharp#3160
When installed via snap:
Then
dotnet
on PATH resolves to a realpath of /usr/bin/snap and not to a dotnet executable next to the sdk foler.This breaks an assumption of the resolver that we can use realpath on dotnet on PATH to find the SDK.
We could maybe implement something like the much slower option of shelling out to dotnet --info as msbuildlocator and legacy omnisharp do. Or we would need a way to resolve to the real directory somehow. I am not sure if snap gives us this ability. Is there a way to query snap to know if there is a dotnet-sdk installed and where can we find it's real directory. Can we do this without forking processes and parsing stdout?
The slow path could be a fallback. If there is a dotnet on PATH, but it does not resolve to a realpath with an sdk directory, try running it with --info. This would fix other hypothetical deployments like a dotnet that is a shell script that execs dotnet with custom args or whatever. It may make sense to keep this as an ultimate fallback even if we find a more efficient way to handle the snap case.
The text was updated successfully, but these errors were encountered: