-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet tool run and install roll-forward option #37231
dotnet tool run and install roll-forward option #37231
Conversation
Seems related to #26824 but that one is for all runtime-options, not just --roll-forward. |
How about |
This is a good thing to verify - |
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.
I'd want to use Major
roll-forward rather than LatestMajor
, to minimize the risk that installing a later version of .NET Runtime breaks some tool that previously worked via roll-forward. RollForwardOptionDescription in install/LocalizableStrings.resx looks like --roll-forward=Major
should work; but ToolInstallCommandParser.RollForwardOption is defined as a CliOption<bool>
, and ToolPackageDownloader.UpdateRuntimeConfigFile can only set "LatestMajor".
src/Cli/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/CommandFactory/CommandResolution/MuxerCommandSpecMaker.cs
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-tool/install/LocalizableStrings.resx
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-tool/run/LocalizableStrings.resx
Outdated
Show resolved
Hide resolved
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.
Some more tests to be covered
src/Cli/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs
Show resolved
Hide resolved
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.
Thank you for the detailed description and coverage of the various scenarios! I'm excited for this first step along the road of making tools easier to use.
src/Cli/dotnet/CommandFactory/CommandResolution/MuxerCommandSpecMaker.cs
Outdated
Show resolved
Hide resolved
Implemented in [dotnet tool run and install roll-forward option][1]. Supported [since the .NET SDK v8.0.300][2]. Documented in [ .NET tool roll-forward][3]. [1]: dotnet/sdk#37231 [2]: dotnet/sdk@dc2a5fe [3]: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/sdk#net-tool-roll-forward
Implemented in [dotnet tool run and install roll-forward option][1]. Supported [since the .NET SDK v8.0.300][2]. Documented in [ .NET tool roll-forward][3]. [1]: dotnet/sdk#37231 [2]: dotnet/sdk@dc2a5fe [3]: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/sdk#net-tool-roll-forward
dotnet tool run and install --roll-forward option
dotnet tool run
--allow-roll-forward
optionFor
dotnet tool run
command, a--allow-roll-forward
Option to parse the--allow-roll-forward
option anywhere in the command usingSystem.CommandLine
is included, and it feed the value of this option (if any) into the actualProcess.Start
calls to launch tools (e.g. in theToolRunCommand
. Note that the--allow-roll-forward
parsed is always inserted into the 'final' dotnet command first for positional argument purposes.Use case
When the user has the local tool
sample
installed, and they invoke is usingdotnet tool run sample --allow-roll-forward LatestMajor
. This code rewrites that intodotnet --roll-forward Major <path to sampleEntryPoint.dll in the tool storage location>
.dotnet tool install
--allow-roll-forward
option for global toolsFor
dotnet tool install
command for global tools, a--allow-roll-forward
option to parse the--allow-roll-forward
option anywhere in the dotnet tool install command for global tools is included. It updates the runtime config file for the tool to include arollForward
property set toMajor
according to the documentation of roll forward selection.Use case
When the user is installing the global tool sample, and they install it using
dotnet tool install sample -g --allow-roll-forward
. This code will rewrite the runtimeConfig the for tool and setrollForward
property toMajor
.dotnet tool install
--allow-roll-forward
option for local toolsFor
dotnet tool install
command for local tools, a--allow-roll-forward
option to parse the--allow-roll-forward
option anywhere in the dotnet tool install command for local tools is included. It stores the rollForward state in the local tool manifest file using theAdd
function inToolManifestEditor
, and read from theToolManifestPackage
usingToolManifestFinder
. TherollForward
is set toMajor
according to the documentation of roll forward selection.Note that for tools in the same directory with same tool command, it returns the tool that has been added first. For tools installed then later installed with the
--allow-roll-forward
option. It updates the manifest to change the rollForward property to True. Note that to run the tool withdotnet [toolname]
, the rollForward does not work.Use case
When the user is installing the local tool sample, and they install it using
dotnet tool install sample --allow-roll-forward
. This code will store the state in the manifest file and read from manifest file when runningdotnet tool run [sampleToolCommand]