Skip to content

[main] Source code updates from dotnet/dotnet #49740

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

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
0414488
[VMR] Codeflow 9503f97-9503f97
dotnet-maestro[bot] Jul 11, 2025
5cec064
Merge main into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
dotnet-maestro[bot] Jul 11, 2025
095ecec
Update dependencies from https://github.com/dotnet/dotnet build 274788
dotnet-maestro[bot] Jul 11, 2025
a2f525e
Merge branch 'main' of https://github.com/dotnet/sdk into darc-main-7…
Jul 11, 2025
7370852
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Jul 11, 2025
fd55f8e
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Jul 12, 2025
abfefb6
[VMR] Codeflow 86117ef-095ecec
dotnet-maestro[bot] Jul 13, 2025
492cbbc
Merge main into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
dotnet-maestro[bot] Jul 13, 2025
96d5126
Update dependencies from https://github.com/dotnet/dotnet build 275021
dotnet-maestro[bot] Jul 13, 2025
de61845
[VMR] Codeflow 1414d33-1414d33
dotnet-maestro[bot] Jul 14, 2025
bc3cfec
Update dependencies from https://github.com/dotnet/dotnet build 275039
dotnet-maestro[bot] Jul 14, 2025
4b0ed21
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
GangWang01 Jul 14, 2025
9cd3be5
Merge branch 'main' into darc-main-824d2701-0e73-4e18-807f-03f48c21d676
GangWang01 Jul 14, 2025
5974af0
Fix build errors
jjonescz Jul 14, 2025
3f4cb48
Merge branch 'main' into darc-main-824d2701-0e73-4e18-807f-03f48c21d676
nagilson Jul 14, 2025
aa010d3
Update dependencies from https://github.com/dotnet/dotnet build 275143
dotnet-maestro[bot] Jul 15, 2025
ef8f5ef
Merge branch 'main' of https://github.com/dotnet/sdk into darc-main-7…
Jul 15, 2025
f30d509
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Jul 15, 2025
0a84676
Merge branch 'main' into darc-main-824d2701-0e73-4e18-807f-03f48c21d676
nagilson Jul 15, 2025
50c7955
Update dependencies from https://github.com/dotnet/dotnet build 275313
dotnet-maestro[bot] Jul 16, 2025
f875477
Merge branch 'main' of https://github.com/dotnet/sdk into darc-main-8…
Jul 16, 2025
8f5b9fd
Merge branch 'main' of https://github.com/dotnet/sdk into darc-main-7…
Jul 16, 2025
69eee35
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Jul 16, 2025
748c337
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
jjonescz Jul 16, 2025
b8b8392
Merge branch 'darc-main-824d2701-0e73-4e18-807f-03f48c21d676' into da…
jjonescz Jul 16, 2025
6aaeaf4
Merge main into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
dotnet-maestro[bot] Jul 17, 2025
2f0dda7
Update dependencies from https://github.com/dotnet/dotnet build 275513
dotnet-maestro[bot] Jul 17, 2025
cfa1db0
Merge branch 'main' of https://github.com/dotnet/sdk into darc-main-7…
Jul 17, 2025
f9c7580
Avoid empty string option
jjonescz Jul 17, 2025
6f6da05
Update CLI schema snapshots
jjonescz Jul 17, 2025
e5e9d2c
Update forwarded bool casing
jjonescz Jul 17, 2025
0765d80
Use InvocationConfiguration in Main
jjonescz Jul 17, 2025
cdc1385
Update `dotnet new` snapshots
jjonescz Jul 17, 2025
faca450
Prune for .NET 8 and above only
nkolev92 Jul 18, 2025
869d644
more test fixes
nkolev92 Jul 18, 2025
bc0fb77
Merge main into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
dotnet-maestro[bot] Jul 18, 2025
3113110
Update dependencies from https://github.com/dotnet/dotnet build 275638
dotnet-maestro[bot] Jul 18, 2025
5996aaf
Fix CliSchema Clean test after S.CL behavioral update
baronfel Jul 18, 2025
dba7b07
Fix test baseline now that we're modeling info/option correctly for w…
baronfel Jul 18, 2025
1c28ab8
Fix help output baselines now that argument is correctly reporting op…
baronfel Jul 18, 2025
3ee3fbb
Update TemplateEngine snapshots
jjonescz Jul 17, 2025
238c060
Update diffs for easier comparisons, and fix sln help output tests
baronfel Jul 18, 2025
6c1520d
bump SDK version so we get MSBuild updates to Microsoft.Common.targets
baronfel Jul 18, 2025
69291e4
Merge remote-tracking branch 'upstream/main' into darc-main-7628065e-…
mmitche Jul 18, 2025
3c15958
Correct version props/details element changes
mmitche Jul 18, 2025
ce72e9b
Merge branch 'darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53' of http…
mmitche Jul 18, 2025
9dbf1c3
Baseline new trim warning intentionally left in product
sbomer Jul 18, 2025
9f32baa
Fix dotnet watch ProjectChange_Update test
tmat Jul 18, 2025
c006f69
Fix test
nkolev92 Jul 18, 2025
12bb1aa
Fully fix CLI Schema tests
baronfel Jul 19, 2025
fe9027e
Blazor boot config libraryInitializers in new format
maraf Jul 20, 2025
35f0293
Fix tests ready libraryInitializers
maraf Jul 21, 2025
23375d1
Remove hash validation because we no longer have hash for libraryInit…
maraf Jul 21, 2025
e056612
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
nagilson Jul 21, 2025
0fbdf16
Update MSBuild logic to get fix for FileWritesShareable
baronfel Jul 21, 2025
99ad077
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
baronfel Jul 21, 2025
1daaffe
try to write binlog so we can diagnose the ci hosts
baronfel Jul 21, 2025
f8aac61
disable compose store tests that are flaky
baronfel Jul 22, 2025
f07bd95
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
marcpopMSFT Jul 22, 2025
d7dfc4c
Fix one test by disabling package pruning so we can continue to rely …
baronfel Jul 23, 2025
490b5a5
Remove old win7 test that no longer is relevant.
baronfel Jul 23, 2025
3e4fcd1
Temporarily skip runfile precedence tests while waiting for VMR flow
baronfel Jul 23, 2025
b559584
temporarily bump xunit runner version to workaround crash
baronfel Jul 23, 2025
96ac3ff
Merge branch 'main' into darc-main-7628065e-94f2-4f11-a6d5-3ab587167c53
baronfel Jul 23, 2025
493992f
Fix merge to use new name
baronfel Jul 23, 2025
803ba88
Missed a runfile test
baronfel Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions eng/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<!-- Packages must be set to their package version property if it exists (ex. BenchmarkDotNetVersion) since source-build uses
these properties to override package versions if necessary. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PackageVersion Update="Verify.XUnit" Condition="'$(VerifyXUnitVersion)' != ''" Version="$(VerifyXUnitVersion)" />
<PackageVersion Update="Verify.DiffPlex" Condition="'$(VerifyDiffPlexVersion)' != ''" Version="$(VerifyDiffPlexVersion)" />
<PackageVersion Update="DiffPlex" Condition="'$(DiffPlexVersion)' != ''" Version="$(DiffPlexVersion)" />
<PackageVersion Update="FakeItEasy" Condition="'$(FakeItEasyVersion)' != ''" Version="$(FakeItEasyVersion)" />
<PackageVersion Update="Verify.DiffPlex" Condition="'$(VerifyDiffPlexVersion)' != ''" Version="$(VerifyDiffPlexVersion)" />
<PackageVersion Update="Verify.XUnit" Condition="'$(VerifyXUnitVersion)' != ''" Version="$(VerifyXUnitVersion)" />
<PackageVersion Update="Wcwidth.Sources" Condition="'$(WcwidthSourcesVersion)' != ''" Version="$(WcwidthSourcesVersion)" />
</ItemGroup>
</Project>
532 changes: 262 additions & 270 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

244 changes: 125 additions & 119 deletions eng/Versions.props

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions eng/dependabot/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

<ItemGroup>
<!--Test dependencies-->
<PackageVersion Include="Verify.Xunit" Version="28.7.0" />
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
<PackageVersion Include="DiffPlex" Version="1.8.0" />
<PackageVersion Include="FakeItEasy" Version="8.0.0" />
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
<PackageVersion Include="Verify.Xunit" Version="28.7.0" />
<PackageVersion Include="Wcwidth.Sources" Version="2.0.0" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"errorMessage": "The .NET SDK is not installed or is not configured correctly. Please run ./build to install the correct SDK version locally."
},
"tools": {
"dotnet": "10.0.100-preview.7.25322.101",
"dotnet": "10.0.100-preview.7.25367.101",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCorePlatformsPackageVersion)"
Expand All @@ -21,8 +21,8 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25359.101",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25359.101",
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25367.101",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25367.101",
"Microsoft.Build.NoTargets": "3.7.0",
"Microsoft.Build.Traversal": "3.4.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ public static FormatOptions ParseVerbosityOption(this ParseResult parseResult, F

public static FormatOptions ParseCommonOptions(this ParseResult parseResult, FormatOptions formatOptions, ILogger logger)
{
if (parseResult.GetResult(NoRestoreOption) is not null)
if (parseResult.GetValue(NoRestoreOption))
{
formatOptions = formatOptions with { NoRestore = true };
}

if (parseResult.GetResult(VerifyNoChanges) is not null)
if (parseResult.GetValue(VerifyNoChanges))
{
formatOptions = formatOptions with { ChangesAreErrors = true };
formatOptions = formatOptions with { SaveFormattedFiles = false };
}

if (parseResult.GetResult(IncludeGeneratedOption) is not null)
if (parseResult.GetValue(IncludeGeneratedOption))
{
formatOptions = formatOptions with { IncludeGeneratedFiles = true };
}
Expand Down Expand Up @@ -300,7 +300,7 @@ public static FormatOptions ParseWorkspaceOptions(this ParseResult parseResult,

if (parseResult.GetValue<string>(SlnOrProjectArgument) is string { Length: > 0 } slnOrProject)
{
if (parseResult.GetResult(FolderOption) is not null)
if (parseResult.GetValue(FolderOption))
{
formatOptions = formatOptions with { WorkspaceFilePath = slnOrProject };
formatOptions = formatOptions with { WorkspaceType = WorkspaceType.Folder };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ internal static Command GetCommand()
internal static void EnsureFolderNotSpecifiedWithNoRestore(CommandResult symbolResult)
{
var folder = symbolResult.GetValue(FolderOption);
var noRestore = symbolResult.GetResult(NoRestoreOption);
if (folder && noRestore != null)
var noRestore = symbolResult.GetValue(NoRestoreOption);
if (folder && noRestore)
{
symbolResult.AddError(Resources.Cannot_specify_the_folder_option_with_no_restore);
}
Expand Down
2 changes: 1 addition & 1 deletion src/BuiltInTools/dotnet-format/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class Program
private static async Task<int> Main(string[] args)
{
var rootCommand = RootFormatCommand.GetCommand();
return await rootCommand.Parse(args).InvokeAsync(CancellationToken.None);
return await rootCommand.Parse(args).InvokeAsync(null, CancellationToken.None);
}
}
}
27 changes: 17 additions & 10 deletions src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal sealed class CommandLineOptions

verboseOption.Validators.Add(v =>
{
if (v.GetResult(quietOption) is not null && v.GetResult(verboseOption) is not null)
if (v.GetValue(quietOption) && v.GetValue(verboseOption))
{
v.AddError(Resources.Error_QuietAndVerboseSpecified);
}
Expand Down Expand Up @@ -90,17 +90,14 @@ internal sealed class CommandLineOptions
var rootCommandInvoked = false;
rootCommand.SetAction(parseResult => rootCommandInvoked = true);

var cliConfig = new CommandLineConfiguration(rootCommand)
ParserConfiguration parseConfig = new()
{
Output = output,
Error = output,

// To match dotnet command line parsing (see https://github.com/dotnet/sdk/blob/4712b35b94f2ad672e69ec35097cf86fc16c2e5e/src/Cli/dotnet/Parser.cs#L169):
EnablePosixBundling = false,
};

// parse without forwarded options first:
var parseResult = rootCommand.Parse(args, cliConfig);
var parseResult = rootCommand.Parse(args, parseConfig);
if (ReportErrors(parseResult, reporter))
{
errorCode = 1;
Expand All @@ -118,15 +115,19 @@ internal sealed class CommandLineOptions
}

// reparse with forwarded options:
parseResult = rootCommand.Parse(args, cliConfig);
parseResult = rootCommand.Parse(args, parseConfig);
if (ReportErrors(parseResult, reporter))
{
errorCode = 1;
return null;
}

// invoke to execute default actions for displaying help
errorCode = parseResult.Invoke();
errorCode = parseResult.Invoke(new()
{
Output = output,
Error = output
});
if (!rootCommandInvoked)
{
// help displayed:
Expand Down Expand Up @@ -192,9 +193,15 @@ private static IReadOnlyList<string> GetCommandArguments(
continue;
}

// skip Option<bool> zero-arity options with an implicit optionresult - these weren't actually specified by the user:
if (optionResult.Option is Option<bool> boolOpt && boolOpt.Arity.Equals(ArgumentArity.Zero) && optionResult.Implicit)
{
continue;
}

// Some options _may_ be computed or have defaults, so not all may have an IdentifierToken.
// For those that do not, use the Option's Name instead.
var optionNameToForward = optionResult.IdentifierToken?.Value ?? optionResult.Option.Name;
// For those that do not, use the Option's Name instead.
var optionNameToForward = optionResult.IdentifierToken?.Value ?? optionResult.Option.Name;
if (optionResult.Tokens.Count == 0 && !optionResult.Implicit)
{
arguments.Add(optionNameToForward);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal class IncrementalMSBuildWorkspace : Workspace
public IncrementalMSBuildWorkspace(IReporter reporter)
: base(MSBuildMefHostServices.DefaultServices, WorkspaceKind.MSBuild)
{
#pragma warning disable CS0618 // https://github.com/dotnet/sdk/issues/49725
WorkspaceFailed += (_sender, diag) =>
{
// Report both Warning and Failure as warnings.
Expand All @@ -26,6 +27,7 @@ public IncrementalMSBuildWorkspace(IReporter reporter)
// https://github.com/dotnet/roslyn/issues/75170
reporter.Warn($"msbuild: {diag.Diagnostic}", "⚠");
};
#pragma warning restore CS0618

_reporter = reporter;
}
Expand Down
16 changes: 10 additions & 6 deletions src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ private MSBuildArgs(ReadOnlyDictionary<string, string>? properties, ReadOnlyDict
/// </summary>
public List<string> OtherMSBuildArgs { get; }

/// <summary>
/// Ensures that when we do our MSBuild-property re-parses we parse in the same way as the dotnet CLI's parser.
/// </summary>
private static readonly ParserConfiguration _analysisParsingConfiguration = new()
{
EnablePosixBundling = false
};

/// <summary>
/// Takes all of the unstructured properties and arguments that have been accrued from the command line
/// processing of the SDK and returns a structured set of MSBuild arguments grouped by purpose.
Expand All @@ -58,12 +66,8 @@ public static MSBuildArgs AnalyzeMSBuildArguments(IEnumerable<string> forwardedA
{
fakeCommand.Options.Add(option);
}

var propertyParsingConfiguration = new CommandLineConfiguration(fakeCommand)
{
EnablePosixBundling = false
};
var parseResult = propertyParsingConfiguration.Parse([..forwardedAndUserFacingArgs]);
;
var parseResult = fakeCommand.Parse([.. forwardedAndUserFacingArgs], _analysisParsingConfiguration);
var globalProperties = parseResult.GetResult("--property") is OptionResult propResult ? propResult.GetValueOrDefault<ReadOnlyDictionary<string, string>?>() : null;
var restoreProperties = parseResult.GetResult("--restoreProperty") is OptionResult restoreResult ? restoreResult.GetValueOrDefault<ReadOnlyDictionary<string, string>?>() : null;
var requestedTargets = parseResult.GetResult("--target") is OptionResult targetResult ? targetResult.GetValueOrDefault<string[]?>() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
for Mac and other VS scenarios. During source-build, we only have access to
the latest version, which targets NetCurrent. -->
<PropertyGroup>
<MSBuildPathInPackage>$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net9.0\MSBuild.dll</MSBuildPathInPackage>
<MSBuildPathInPackage>$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net10.0\MSBuild.dll</MSBuildPathInPackage>
<MSBuildPathInPackage Condition="'$(DotNetBuildSourceOnly)' == 'true' and !Exists($(MSBuildPathInPackage))">$(PkgMicrosoft_Build_Runtime)\contentFiles\any\$(NetCurrent)\MSBuild.dll</MSBuildPathInPackage>
</PropertyGroup>
<Error Condition="!Exists('$(MSBuildPathInPackage)')" Text="Something moved around in Microsoft.Build.Runtime, adjust code here accordingly." />
Expand Down
31 changes: 9 additions & 22 deletions src/Cli/Microsoft.TemplateEngine.Cli/Commands/ParserFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,22 @@ namespace Microsoft.TemplateEngine.Cli.Commands
{
internal static class ParserFactory
{
internal static CommandLineConfiguration CreateParser(Command command, bool disableHelp = false)
internal static readonly ParserConfiguration ParserConfiguration = new()
{
CommandLineConfiguration config = new(command)
//TODO: decide if it's needed to implement it; and implement if needed
//.UseParseDirective()
//.UseSuggestDirective()
{
EnablePosixBundling = false
};

for (int i = 0; i < command.Options.Count; i++)
{
if (command.Options[i] is HelpOption)
{
if (disableHelp)
{
command.Options.RemoveAt(i);
}
EnablePosixBundling = false,
};

return config;
}
}
internal static Command CreateParser(Command command, bool disableHelp = false)
{
// {
// EnablePosixBundling = false
// };

if (!disableHelp)
{
command.Options.Add(new HelpOption());
}

return config;
return command;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ internal static IEnumerable<CompletionItem> GetTemplateCompletions(
templateGroup,
template);

CommandLineConfiguration parser = ParserFactory.CreateParser(command);
System.CommandLine.Command parser = ParserFactory.CreateParser(command);

//it is important to pass raw text to get the completion
//completions for args passed as array are not supported
ParseResult parseResult = parser.Parse(context.CommandLineText);
ParseResult parseResult = parser.Parse(context.CommandLineText, ParserFactory.ParserConfiguration);
foreach (CompletionItem completion in parseResult.GetCompletions(context.CursorPosition))
{
////TODO: conditionals tab completion here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ private static (TemplateCommand? Command, ParseResult? ParseResult)? ReparseForT
template,
validateDefaultLanguage);

CommandLineConfiguration parser = ParserFactory.CreateParser(command);
ParseResult parseResult = parser.Parse(args.RemainingArguments ?? Array.Empty<string>());
System.CommandLine.Command parser = ParserFactory.CreateParser(command);
ParseResult parseResult = parser.Parse(args.RemainingArguments ?? Array.Empty<string>(), ParserFactory.ParserConfiguration);
return (command, parseResult);
}
catch (InvalidTemplateParametersException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public HelpBuilder Builder
/// <inheritdoc />
public override int Invoke(ParseResult parseResult)
{
var output = parseResult.Configuration.Output;
var output = parseResult.InvocationConfiguration.Output;

var helpContext = new HelpContext(
Builder,
Expand Down
11 changes: 5 additions & 6 deletions src/Cli/dotnet/Commands/Build/BuildCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine;
Expand All @@ -12,8 +12,7 @@ public static class BuildCommand
{
public static CommandBase FromArgs(string[] args, string? msbuildPath = null)
{
var parser = Parser.Instance;
var parseResult = parser.ParseFrom("dotnet build", args);
var parseResult = Parser.Parse(["dotnet", "build", ..args]);
return FromParseResult(parseResult, msbuildPath);
}

Expand All @@ -22,10 +21,10 @@ public static CommandBase FromParseResult(ParseResult parseResult, string? msbui
parseResult.ShowHelpOrErrorIfAppropriate();

CommonOptions.ValidateSelfContainedOptions(
parseResult.GetResult(BuildCommandParser.SelfContainedOption) is not null,
parseResult.GetResult(BuildCommandParser.NoSelfContainedOption) is not null);
parseResult.HasOption(BuildCommandParser.SelfContainedOption),
parseResult.HasOption(BuildCommandParser.NoSelfContainedOption));

bool noRestore = parseResult.GetResult(BuildCommandParser.NoRestoreOption) is not null;
bool noRestore = parseResult.HasOption(BuildCommandParser.NoRestoreOption);

return CommandFactory.CreateVirtualOrPhysicalCommand(
BuildCommandParser.GetCommand(),
Expand Down
3 changes: 1 addition & 2 deletions src/Cli/dotnet/Commands/Clean/CleanCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class CleanCommand(MSBuildArgs msbuildArgs, string? msbuildPath = null) :
{
public static CommandBase FromArgs(string[] args, string? msbuildPath = null)
{
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet clean", args);
var result = Parser.Parse(["dotnet", "clean", ..args]);
return FromParseResult(result, msbuildPath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Cli/dotnet/Commands/Format/FormatCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class FormatCommand(IEnumerable<string> argsToForward) : FormatForwarding
{
public static FormatCommand FromArgs(string[] args)
{
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet format", args);
var result = Parser.Parse(["dotnet", "format", ..args]);
return FromParseResult(result);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cli/dotnet/Commands/Help/HelpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public int Execute()

private static bool TryGetDocsLink(string[] command, out string docsLink)
{
var parsedCommand = Parser.Instance.Parse(["dotnet", .. command]);
var parsedCommand = Parser.Parse(["dotnet", .. command]);
if (parsedCommand?.CommandResult?.Command is ICommandDocument dc)
{
docsLink = dc.DocsLink;
Expand Down
5 changes: 2 additions & 3 deletions src/Cli/dotnet/Commands/Hidden/Complete/CompleteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public static int Run(ParseResult parseResult)

public static int RunWithReporter(string[] args, IReporter reporter)
{
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet complete", args);
var result = Parser.Parse(["dotnet", "complete", ..args]);
return RunWithReporter(result, reporter);
}

Expand Down Expand Up @@ -61,7 +60,7 @@ private static CompletionItem[] Completions(ParseResult complete)
input += " ";
}

var result = Parser.Instance.Parse(input);
var result = Parser.Parse(input);

return [.. result.GetCompletions(position).Distinct()];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public static int Run(ParseResult parseResult)

public static void ProcessInputAndSendTelemetry(string[] args, ITelemetry telemetry)
{
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet internal-reportinstallsuccess", args);
var result = Parser.Parse(["dotnet", "internal-reportinstallsuccess", ..args]);
ProcessInputAndSendTelemetry(result, telemetry);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cli/dotnet/Commands/Hidden/Parse/ParseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static int Run(ParseResult result)
result.HandleDebugSwitch();

var tokens = result.Tokens.Skip(1).Select(t => t.Value).ToArray();
var reparsed = Parser.Instance.Parse(tokens);
var reparsed = Parser.Parse(tokens);
Console.WriteLine(reparsed.ToString());


Expand Down
Loading
Loading