-
Notifications
You must be signed in to change notification settings - Fork 14
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
PATH, dotnet.dotnetPath, dotnetAcquisition.existingDotnetPath Usage is not Standardized #1243
Comments
Tagging area-project-cps as I believe the project system server uses one or more of these settings. |
To summarize my own thoughts: RuntimeTLDR: I believe the runtime selection should be influenced by VS Code settings to be consistent across Microsoft extensions, insofar as the user-selected runtime is compatible with what the extension requires. We should document the behavior when an incompatible runtime is found there. Runtime for the extensionThe runtime that C# Dev Kit uses is an implementation detail of the extension and the user shouldn't be setting it at all, IMO. While it used to be a private runtime installation, customers complained (time to install, offline usage, etc.) so we added the ability to use a machine-wide installation of the runtime if one were found that was compatible. We still fallback to the private runtime when necessary. Runtime to execute the customer's codeI believe this setting should have no impact on how we select the runtime that is used on F5 to run the customer's code. But I'm open to discussion on this if folks feel differently. Runtime to execute customer testsBecause we run SDKTLDR: I believe SDK discovery and selection should be entirely independent of any VS Code setting. I suspect these settings were supposed to point to a runtime -- not an SDK. If that's true, there's no guarantee there's even an SDK there. C# Dev Kit strives to work with the user's chosen SDK version (as set by global.json, or by the latest version installed if not specified in global.json). We limit our supported SDK versions to just those that .NET itself supports. So today we support .NET 6 and 8 (not 7), and we presumably support .NET 9 prereleases. The .NET team already provides a few means to find the .NET SDK to be used for command line builds, and they are working to introduce more to support repo-local SDK directories. I believe C# Dev Kit should honor and reuse these conventions rather than supplant or augment them with new ones based on VS Code settings. C# Dev Kit internally operates by spawning any of several For reference, the .NET SDK selection at the CLI is comprised of a few environment variables including PATH, DOTNET_ROOT, and DOTNET_MULTILEVEL_LOOKUP. There are more. |
Describe the Issue
dotnet.dotnetPath
is a setting in the C# extension. This is only for the language server.dotnetAcquisitionExtension.ExistingDotnetPath
anddotnetAcquisitionExtension.sharedExistingDotnetPath
are settings in the .NET Install Tool. This is returned to api callers as the dotnet to use when acquisition is called.Both settings apply to the SDK and Runtime.
However, ATM they dont take effect in many parts of CDK or C#. For example, CDK does not check the existing Path setting if a PATH setting exists.
The PATH lookup is very different across the product, within C#, C# DevKit, and other places, the dotnet.dotnetPath setting, existingDotnetPathSetting, PATH, etc, can all take different priority and work with different levels of effectiveness in different
This has led to a lot of customer confusion.
(Examples: [BUG] C# Dev Kit does not respect local .NET installation configurations · Issue #1094 · microsoft/vscode-dotnettools (github.com) and [BUG] C# dev kit should respect the
dotnet.dotnetPath
set by C# extension · Issue #792 · microsoft/vscode-dotnettools (github.com), [BUG]dotnet.dotnetpath
does not support relative paths (unlike omnisharp.dotnetpath) · Issue #53 · microsoft/vscode-dotnettools (github.com)).We documented the manual path setting (here and here and here).
This is a very confusing UX. I think we need to find all of the places in C# and C# DevKit where these lookups happen. I can think of a few places but I don't know them all. I know @peterwald added one for the test explorer and @AArnott did for CDK.
Some people think the PATH should take precedence over the setting so the terminal behavior is the same.
Other people suggest the setting is more user friendly and if you set the setting, you probably want it to take over the PATH.
Alternatively, we could make the setting edit the PATH to satisfy both constraints.
In addition, we need to decide if these settings should impact both sdk and runtime lookup. Some suggest the runtime should use the setting and the SDK should not, and use the PATH. Not many people understand what the difference between dotnet.exe and the runtime or sdk is, and how they get selected, so this may be a bit moot.
Steps To Reproduce
No response
Expected Behavior
No response
Environment Information
cc @arkalyanms
No response
The text was updated successfully, but these errors were encountered: