diff --git a/src/Aspire.Cli/Commands/AddCommand.cs b/src/Aspire.Cli/Commands/AddCommand.cs index b530c14b279..9fb1bac6910 100644 --- a/src/Aspire.Cli/Commands/AddCommand.cs +++ b/src/Aspire.Cli/Commands/AddCommand.cs @@ -49,10 +49,6 @@ public AddCommand(IDotNetCliRunner runner, INuGetPackageCache nuGetPackageCache, versionOption.Description = "The version of the integration to add."; Options.Add(versionOption); - var prereleaseOption = new Option("--prerelease"); - prereleaseOption.Description = "Include pre-release versions of the integration when searching."; - Options.Add(prereleaseOption); - var sourceOption = new Option("--source", "-s"); sourceOption.Description = "The NuGet source to use for the integration."; Options.Add(sourceOption); @@ -79,13 +75,15 @@ protected override async Task ExecuteAsync(ParseResult parseResult, Cancell return ExitCodeConstants.FailedToFindProject; } - var prerelease = parseResult.GetValue("--prerelease"); - var source = parseResult.GetValue("--source"); var packages = await _interactionService.ShowStatusAsync( "Searching for Aspire packages...", - () => _nuGetPackageCache.GetIntegrationPackagesAsync(effectiveAppHostProjectFile.Directory!, prerelease, source, cancellationToken) + () => _nuGetPackageCache.GetIntegrationPackagesAsync( + workingDirectory: effectiveAppHostProjectFile.Directory!, + prerelease: true, + source: source, + cancellationToken: cancellationToken) ); var version = parseResult.GetValue("--version"); diff --git a/src/Aspire.Cli/Commands/NewCommand.cs b/src/Aspire.Cli/Commands/NewCommand.cs index ea4978b0e58..d7bb0dc8760 100644 --- a/src/Aspire.Cli/Commands/NewCommand.cs +++ b/src/Aspire.Cli/Commands/NewCommand.cs @@ -55,10 +55,6 @@ public NewCommand(IDotNetCliRunner runner, INuGetPackageCache nuGetPackageCache, var templateVersionOption = new Option("--version", "-v"); templateVersionOption.Description = "The version of the project templates to use."; Options.Add(templateVersionOption); - - var prereleaseOption = new Option("--prerelease"); - prereleaseOption.Description = "Include prerelease versions when searching for project templates."; - Options.Add(prereleaseOption); } private async Task<(string TemplateName, string TemplateDescription, Func PathDeriver)> GetProjectTemplateAsync(ParseResult parseResult, CancellationToken cancellationToken) @@ -141,9 +137,8 @@ protected override async Task ExecuteAsync(ParseResult parseResult, Cancell var template = await GetProjectTemplateAsync(parseResult, cancellationToken); var name = await GetProjectNameAsync(parseResult, cancellationToken); var outputPath = await GetOutputPathAsync(parseResult, template.PathDeriver, name, cancellationToken); - var prerelease = parseResult.GetValue("--prerelease"); var source = parseResult.GetValue("--source"); - var version = await GetProjectTemplatesVersionAsync(parseResult, prerelease, source, cancellationToken); + var version = await GetProjectTemplatesVersionAsync(parseResult, prerelease: true, source: source, cancellationToken: cancellationToken); var templateInstallCollector = new OutputCollector(); var templateInstallResult = await _interactionService.ShowStatusAsync<(int ExitCode, string? TemplateVersion)>( diff --git a/src/Aspire.Cli/DotNetCliRunner.cs b/src/Aspire.Cli/DotNetCliRunner.cs index 6f7788dca4e..179289d0db4 100644 --- a/src/Aspire.Cli/DotNetCliRunner.cs +++ b/src/Aspire.Cli/DotNetCliRunner.cs @@ -592,7 +592,6 @@ public async Task AddPackageAsync(FileInfo projectFilePath, string packageN public async Task<(int ExitCode, NuGetPackage[]? Packages)> SearchPackagesAsync(DirectoryInfo workingDirectory, string query, bool prerelease, int take, int skip, string? nugetSource, DotNetCliRunnerInvocationOptions options, CancellationToken cancellationToken) { using var activity = _activitySource.StartActivity(); - List cliArgs = [ "package", "search",