-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document breaking change: dotnet.acquire API no longer always downloads latest #49618
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
09b467e
Initial plan
Copilot d897dc9
Add breaking change documentation for dotnet.acquire API
Copilot 6783e1d
Fix writing style issues in breaking change doc
Copilot b47e8c1
human edits
gewarren 320f0d1
fix links
gewarren 145d313
more edits
gewarren be568fa
Apply suggestions from code review
gewarren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
73 changes: 73 additions & 0 deletions
73
docs/core/compatibility/install-tool/3.0.0/vscode-dotnet-acquire-no-latest.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: "Breaking change: dotnet.acquire API for VS Code no longer always downloads latest" | ||
| description: "Learn about the breaking change where the dotnet.acquire VS Code API no longer always checks for the latest runtime version before returning a path." | ||
| ms.date: 11/04/2025 | ||
| ai-usage: ai-assisted | ||
| ms.custom: https://github.com/dotnet/docs/issues/49127 | ||
| --- | ||
|
|
||
| # dotnet.acquire API for VS Code no longer always downloads latest | ||
|
|
||
| The .NET Install Tool Extension for VS Code provides the `dotnet.acquire` command to install a .NET runtime for VS Code extensions. Starting in version 3.0.0 of the .NET Install Tool, calling `dotnet.acquire` no longer always checks for the latest runtime version. Instead, it uses existing runtime installations and checks daily for newer versions after a configurable delay. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET Install Tool 3.0.0 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| Up until version 3.0.0 of the .NET Install Tool (or prerelease version 2.4.1), calling `dotnet.acquire` always triggered a check to see what the latest runtime version was, given the user was online and did not specify any settings to do otherwise. If that latest runtime wasn't available on the machine, it was installed, and the path to it was returned. | ||
|
|
||
| This runtime is used for C# Dev Kit, C#, and other VS Code extensions to run internal C# code and processes, such as the language server host. | ||
|
|
||
| ## New behavior | ||
|
|
||
| Starting with .NET Install Tool 3.0.0, `dotnet.acquire` no longer always checks for a newer runtime version before returning the path to a runtime that matches the `major.minor`. Instead, the tool: | ||
|
|
||
| 1. Uses existing runtime installations it made. | ||
| 1. Checks daily for a new runtime after `runtimeUpdateDelaySeconds` (defaults to 5 minutes). This setting can be changed in the VS Code Extension Settings. | ||
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 1. After the delay, checks for newer runtime versions and installs the new runtime if needed. | ||
| 1. After installation, automatically uninstalls all remaining .NET runtimes that aren't *in-use* and aren't the latest patch for a specific `major.minor`, `architecture`, and `mode` (`runtime` or `aspnetcore` runtime) combination. | ||
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| *In-use* means that the executable path to that .NET runtime install was: | ||
|
|
||
| - Returned by a command through the .NET Install Tool in any session of VS Code, VS Code Insiders, or otherwise that has a currently live, running process. Commands include `dotnet.acquire`, `dotnet.acquireStatus`, `dotnet.availableInstalls`, and `dotnet.findPath`. | ||
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Part of the `PATH` or `DOTNET_ROOT` environment variable in which VS Code is operating. | ||
|
|
||
| Additionally, the `dotnet.uninstall` command no longer allows uninstalling an install that's *in-use*. | ||
|
|
||
| ## Type of breaking change | ||
|
|
||
| This change is a [behavioral change](../../categories.md#behavioral-change). | ||
|
|
||
| ## Reason for change | ||
|
|
||
| This change speeds up the developer loop by deferring the network call and installation time away from the launch of extensions that utilize .NET. For users in the worst 3% of networks who didn't have their own .NET runtime that matched the requirements of any extension's .NET version, the download time alone created a 9-36 second delay at startup. For the median user, this represented a 287 ms delay. | ||
|
|
||
| ## Recommended action | ||
|
|
||
| If you rely on `dotnet.acquire` and want to enforce that a new runtime is used every single time, use `forceUpdate: true` in your call to `dotnet.acquire`. This is generally not recommended unless a runtime security patch, feature, or bug is dramatic enough to warrant downloading the latest runtime. | ||
|
|
||
| Example: | ||
|
|
||
| ```javascript | ||
| const dotnetRuntimePath = (await vscode.commands.executeCommand<IDotnetAcquireResult>( | ||
| 'dotnet.acquire', | ||
| { version: '9.0', requestingExtensionId, forceUpdate: true } | ||
| )).dotnetPath; | ||
| ``` | ||
|
|
||
| Make sure you don't cache or reuse any path from the .NET Install Tool without calling `dotnet.availableInstalls` again (to demonstrate that you're using the installation in a given session) if it's not in the `PATH`. | ||
|
|
||
| Continue to use `dotnet.uninstall` as you did previously to decrement the reference counts of the installs you own. However, this is less vital since uninstallation happens when the older version is replaced with the newer version. | ||
|
|
||
| Avoid relying on hard-coded private runtime installations managed by the .NET Install Tool as that isn't the intended purpose of these runtimes. If you must, set the `PATH` or `DOTNET_ROOT` for your VS Code instances such that the install doesn't get cleaned up automatically. | ||
gewarren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Affected APIs | ||
|
|
||
| None. | ||
|
|
||
| ## See also | ||
|
|
||
| - [.NET Install Tool for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-runtime) | ||
| - [.NET Install Tool commands documentation](https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/commands.md) | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the warning is coming from the folder name. That should be addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @BillWagner. Can you take a look at my comment at #49618 (comment) and see if you agree?