-
Notifications
You must be signed in to change notification settings - Fork 11
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
[BUG] Cannot find .NET SDK installation from PATH environment (macOS) #1471
Comments
Nothing in this area has changed yet, but I would expect it to in October. Do the workarounds in the above isue work for you @jaraco ? |
The workaround I've been using is to launch VS Code from a shell that has PATH defined.
I was hoping not to have to rely on C# Dev kit to install the SDK, because that gives me less control and visibility into where it's installed and how. Ideally, I'd prefer to manage packages through homebrew for consistency and visibility. For example, if I have the .NET Install tool install .NET, I'm not sure whether or how that configures the installation to be in the PATH (for other environments). I did try applying the Shared Existing Dotnet Path: (I also tried I then tried adding the setting specific to the csdevkit: But it resulted in the same error.
This workaround won't help me, as the shell environment isn't coming into play (I don't know where I'd put the |
Something else I noticed in the OUTPUT when the error occurs... right after it reports the error and the path it's searching, it emits a message that it's using a .NET runtime:
Yet still, the errors are emitted during startup. |
The installation UI uses the .NET Installer. The .NET Installer edits the system machine wide. Which yes would impact the PATHs of your environments. That is a valid concern. For the 2nd message, the reason that happens is the Install Tool downloaded a runtime for C# DevKit to run under as C# DevKit is really written in a mix of Typescript and C#. But it still couldnt find the SDK for your project to run under. The existingPath setting is only for the runtime for DevKit to run under, so it wouldnt fix this behavior. We are fixing the messaging for that setting this week. |
Anyway, I agree with your conclusion that the PATH lookup should use I don't actually work on the code that's related to this and it's part of the project system, except I am writing an API to replace that code which is supposed to do a better job at finding the dotnet on the PATH. So your timing is quite helpful as I will be sure to include this change in our API. After that is released, the DevKit and C# team will have to remove their code and move to our API. |
I did this to resolve my problem |
the bug is that the script that looks for donet doesn't start a default login shell (it always just runs /bin/sh), so .bash_profile isn't run, and the PATH isn't configured correctly. if the
|
Thank you for the helpful comment. You're right, I think bash also looks at /etc/profile and ~/.profile first, which would match the behavior of sh. We might have to execute both approaches and try the other if one doesn't work... I would lean towards trying the existing behavior first since it would break less people... but not sure if that's the correct behavior, if bash also checks this path first. I couldn't find adoption statistics with bash vs sh usage. Not sure if thatd help zsh though. Would that cover your case @jaraco? If not, One question I have that would be helpful is, with your suggested approach of using path_helper , how would we determine which things on the PATH are related to dotnet ? I dont see any option on path_helper to ask it to only return things linked to a certain string, such as dotnet. And in fact, if we scanned your path output from path_helper , there is no string with 'dotnet' in it. I can't think of any way to feed that path string output into the which command. So I'm not sure how that'd be elegantly done in a secure way. |
By "that", you mean to override the shell used? It might work. On my system, But yes, if I've generally tried to avoid using
My feeling is - search the
Note that approach doesn't honor PATHEXT on Windows. I see there is a If it were me, I'd:
Alternatively, it does appear as if
I do think you want to search for |
Describe the Issue
When launching VS Code directly using the application launcher or Spotlight (and not from a shell environment), I see this error message:
I've installed dotnet through Homebrew (
brew install dotnet
), and dotnet is available in the shell environment:As you can see, however, the path that VS Code gets does not include even the paths found at
/etc/paths
:Nor those found from the path helper:
My default shell is not a standard shell, and I previously contributed to an issue where VS Code didn't recognize the shell environment. That issue has since been fixed and VS Code is able to resolve the shell environment, yet somehow the dot net tools are not resolving the PATH and are getting a very primitive PATH and thereafter failing to initialize dotnet.
Steps To Reproduce
dotnet new console -n HelloWorld
Expected Behavior
.Net should find the
dotnet
command on the path found frompath_helper
or by inspecting thexonsh
orzsh
shells (the same environment found by other parts of VS Code).Environment Information
The text was updated successfully, but these errors were encountered: