Improve dotnet resolution when using multiple dotnet SDKs - #2
Open
jelenv wants to merge 2 commits into
Open
Conversation
Motivation: support mixed SDK setups reliably, such as .NET 10 primary with .NET 8 for older repositories, without coupling behavior to one SDK manager.\n\nChanges:\n- Add optional setting use_worktree_dotnet_env to run dotnet commands with worktree shell environment when explicitly enabled.\n- Align SDK lookup, runtime root detection, tool install/update, and Razor build to the same selected dotnet context.\n- Keep default behavior global and manager-agnostic; detect DOTNET_ROOT from dotnet info and cache successful global lookups.\n- Return stdout/stderr for failed tool install/update and Razor build to improve diagnosability.\n- Remove duplicated command construction paths via a shared optional-environment helper.
Align SDK path selection with list-sdks output by parsing installed SDK entries and selecting the latest listed entry. This keeps Razor compiler/targets lookup tied to the newest installed SDK in the selected dotnet environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This change makes the extension more reliable for mixed dotnet SDK setups (for example .NET 10
primary and .NET 8 for older repos).
In my setup I have dotnet 10 and 8 installed via mise on linux and without these changes, I was not able to use the extension, because it was trying to use incorrect dotnet SDKs.
What changed
dotnet --infoand successful global lookups are cacheduse_worktree_dotnet_envsetting so dotnet commands can run in the worktree shell environment when explicitly enabled.Disclaimer
I am not experienced with Rust, let me know if there is any slop or something to improve.