Install runtime(s) with dotnetup #52649
Conversation
…on components from sdk install command this makes it shareable and reduces code duplication
What we really need to verify: - uninstall of sdk or aspnetcore - does it remove the core runtime and how do we handle that? - e2e test trying to install feature band - what happens when we return null, do we have a clean error - it installs al 3 runtime types if you dont specify a runtime type - t adds to the manfiest even if the sdk had installed the runtime. It also does that if the runtime exists from the sdk instal. But verify it doesnt try to download the runtime when it doesnt have to if it alread yis there from the sdk or another install of the runtime - it gets the core runtime when you try to install another runtime
src/Installer/dotnetup/Commands/Runtime/Install/RuntimeInstallCommand.cs
Outdated
Show resolved
Hide resolved
src/Installer/dotnetup/Commands/Runtime/Install/RuntimeInstallCommandParser.cs
Outdated
Show resolved
Hide resolved
src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetArchiveExtractor.cs
Show resolved
Hide resolved
nagilson
left a comment
There was a problem hiding this comment.
ok, I should resolve the comments I added, test a little more. After that the team can more broadly review this.
The archive tests are not particularly useful as they are implemented but the ideas are good - working on this next
it is not supported
There was a problem hiding this comment.
Pull request overview
This PR implements runtime installation functionality for dotnetup, enabling users to install .NET Runtime, ASP.NET Core Runtime, and Windows Desktop Runtime through the dotnetup runtime install command. The implementation follows the specification defined in PR #52409.
Changes:
- Adds
dotnetup runtime install <type> <channel>command supportingcore,aspnetcore, andwindowsdesktopruntime types - Refactors SDK and runtime installation logic into shared components (
InstallWorkflow,InstallWalkthrough,InstallPathResolver,InstallExecutor) to eliminate code duplication - Implements component file existence checking to avoid redundant downloads when runtimes are already installed by SDK
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/dotnetup.Tests/Utilities/DotnetupTestUtilities.cs | Adds helper methods for building runtime install test arguments |
| test/dotnetup.Tests/RuntimeInstallTests.cs | Comprehensive unit tests for runtime installation including version resolution, component mapping, manifest tracking, and uninstall strategy |
| test/dotnetup.Tests/ParserTests.cs | Parser validation tests for runtime install command |
| test/dotnetup.Tests/Mocks/MockArchiveDownloader.cs | Mock implementation for testing downloads without network access |
| test/dotnetup.Tests/LibraryTests.cs | Adds runtime component tests and fixes GlobalJsonInfo.SdkPath bug test |
| test/dotnetup.Tests/DotnetArchiveExtractorTests.cs | Tests for archive extractor error handling scenarios |
| test/dotnetup.Tests/DnupE2Etest.cs | End-to-end tests for SDK and runtime installation, reuse behavior, and error handling |
| test/dotnetup.Tests/ChannelVersionResolverTests.cs | Tests for channel resolution with feature band filtering |
| src/Installer/installer.code-workspace | Adds debug configuration for runtime install |
| src/Installer/dotnetup/Parser.cs | Registers runtime command parser |
| src/Installer/dotnetup/InstallerOrchestratorSingleton.cs | Adds check for existing component files to skip redundant downloads |
| src/Installer/dotnetup/IDotnetInstallManager.cs | Fixes GlobalJsonInfo.SdkPath to use directory name instead of file path |
| src/Installer/dotnetup/CommonOptions.cs | Consolidates shared command options (install-path, set-default-install, manifest-path) |
| src/Installer/dotnetup/Commands/Shared/InstallWorkflow.cs | Shared workflow orchestrating installation process for both SDK and runtime |
| src/Installer/dotnetup/Commands/Shared/InstallWalkthrough.cs | Handles interactive prompts and decision-making during installation |
| src/Installer/dotnetup/Commands/Shared/InstallPathResolver.cs | Resolves installation path from multiple sources (global.json, explicit, current install) |
| src/Installer/dotnetup/Commands/Shared/InstallExecutor.cs | Executes installations with consistent messaging and progress handling |
| src/Installer/dotnetup/Commands/Sdk/Install/SdkInstallCommandParser.cs | Refactored to use CommonOptions |
| src/Installer/dotnetup/Commands/Sdk/Install/SdkInstallCommand.cs | Refactored to use shared InstallWorkflow |
| src/Installer/dotnetup/Commands/Runtime/RuntimeCommandParser.cs | Top-level runtime command parser |
| src/Installer/dotnetup/Commands/Runtime/Install/RuntimeInstallCommandParser.cs | Parser for runtime install command with type and channel arguments |
| src/Installer/dotnetup/Commands/Runtime/Install/RuntimeInstallCommand.cs | Implements runtime installation logic with validation for runtime types and SDK version detection |
| src/Installer/dotnetup/ArchiveInstallationValidator.cs | Adds Windows Desktop validation without muxer and ComponentFilesExist method |
| src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs | Adds IsSdkVersionOrFeatureBand method to detect SDK-specific version patterns |
| src/Installer/Microsoft.Dotnet.Installation/Internal/IArchiveDownloader.cs | New interface for archive downloading enabling testability |
| src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetReleaseInfoProvider.cs | Adds includeFeatureBands parameter |
| src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetArchiveExtractor.cs | Refactored to use IArchiveDownloader and share progress reporter |
| src/Installer/Microsoft.Dotnet.Installation/Internal/DotnetArchiveDownloader.cs | Implements IArchiveDownloader interface |
| src/Installer/Microsoft.Dotnet.Installation/Internal/ChannelVersionResolver.cs | Adds feature band filtering support |
| src/Installer/Microsoft.Dotnet.Installation/InstallComponent.cs | Adds GetDescription extension method |
| src/Installer/Microsoft.Dotnet.Installation/IDotnetReleaseInfoProvider.cs | Adds includeFeatureBands parameter |
| documentation/general/dotnetup/runtime-install.md | Comprehensive documentation of runtime installation design |
src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…up-install-runtimes-impl
The temp folder is cleaned up and can cause issues with concurrent tests https://dev.azure.com/dnceng-public/public/_build/results?buildId=1279882&view=ms.vss-test-web.build-test-results-tab&runId=35732594&resultId=100003&paneView=debug System.IO.FileNotFoundException : Unable to find the specified file. at Interop.Sys.GetCwdHelper(Byte* ptr, Int32 bufferSize) at Interop.Sys.GetCwd() at Microsoft.DotNet.Tools.Dotnetup.Tests.Utilities.DotnetupTestUtilities.RunDotnetupProcess(String[] args, Boolean captureOutput, String workingDirectory) in /Users/runner/work/1/s/test/dotnetup.Tests/Utilities/DotnetupTestUtilities.cs:line 105 at Microsoft.DotNet.Tools.Dotnetup.Tests.ParserTests.DotnetupProcess_Version_ShouldOutputExpectedVersion() in /Users/runner/work/1/s/test/dotnetup.Tests/ParserTests.cs:line 181 at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
|
I've updated this following the design discussion we had to match the specification! |
dsplaisted
left a comment
There was a problem hiding this comment.
This looks great! It's exciting to see more end-to-end functionality come online.
The implementation of the spec defined by #52409
Resolves #52409
This PR also refactors the walkthrough and install command logic into a shareable component. The first phase, 0, preserves the code in its entirety without modification. The next phase tries to reduce parameter duplication and chunk the code into logical functions, still without changing the functionality and making the diff somewhat digestible.
Note: I haven't added
dotnetup runtime installwithout aruntime_typewhere it does all 3. Let's track that separately: #52679 . It will need to be done concurrently and requires more than just a slight arity adjustment. I also think that's less valuable because the other runtimes that need the core runtime come bundled with the core runtime.