diff --git a/src/Aspire.Cli/Commands/AppHostLauncher.cs b/src/Aspire.Cli/Commands/AppHostLauncher.cs
index 91e34889e93..3c2b80dac16 100644
--- a/src/Aspire.Cli/Commands/AppHostLauncher.cs
+++ b/src/Aspire.Cli/Commands/AppHostLauncher.cs
@@ -87,6 +87,7 @@ internal static void AddLaunchOptions(Command command)
/// Additional unmatched args to forward.
/// Optional delay after launch before stopping the AppHost.
/// Cancellation token.
+ /// Callback invoked when an AppHost project file has been selected.
/// A indicating success or failure.
public async Task LaunchDetachedAsync(
FileInfo? passedAppHostProjectFile,
@@ -97,7 +98,8 @@ public async Task LaunchDetachedAsync(
IEnumerable globalArgs,
IEnumerable additionalArgs,
TimeSpan? stopAfterLaunchDelay,
- CancellationToken cancellationToken)
+ CancellationToken cancellationToken,
+ Action? appHostSelected = null)
{
// In JSON mode or non-interactive mode, avoid interactive prompts.
var multipleAppHostBehavior = format == OutputFormat.Json || !hostEnvironment.SupportsInteractiveInput
@@ -126,6 +128,8 @@ public async Task LaunchDetachedAsync(
return CommandResult.Failure(CliExitCodes.FailedToFindProject);
}
+ appHostSelected?.Invoke(effectiveAppHostFile);
+
logger.LogDebug("Starting AppHost in background: {AppHostPath}", effectiveAppHostFile.FullName);
// Check for running instance and stop it if found (same behavior as regular run)
diff --git a/src/Aspire.Cli/Commands/BaseCommand.cs b/src/Aspire.Cli/Commands/BaseCommand.cs
index f6f74727b16..3910c1a18b7 100644
--- a/src/Aspire.Cli/Commands/BaseCommand.cs
+++ b/src/Aspire.Cli/Commands/BaseCommand.cs
@@ -18,6 +18,7 @@ internal abstract class BaseCommand : Command
private static readonly int[] s_suppressErrorLogsMessageExitCodes = [CliExitCodes.Cancelled, CliExitCodes.MissingRequiredArgument];
protected virtual bool UpdateNotificationsEnabled { get; } = true;
+ protected virtual bool IncludeAppHostUpdateCommandInUpdateNotification { get; }
///
/// Gets the help group for this command.
@@ -118,7 +119,7 @@ protected BaseCommand(string name, string description, IFeatures features, ICliU
{
try
{
- updateNotifier.NotifyIfUpdateAvailable();
+ updateNotifier.NotifyIfUpdateAvailable(IncludeAppHostUpdateCommandInUpdateNotification);
}
catch
{
diff --git a/src/Aspire.Cli/Commands/RunCommand.cs b/src/Aspire.Cli/Commands/RunCommand.cs
index b7bc2e603a2..2f0191bb399 100644
--- a/src/Aspire.Cli/Commands/RunCommand.cs
+++ b/src/Aspire.Cli/Commands/RunCommand.cs
@@ -73,6 +73,7 @@ internal sealed class RunCommand : BaseCommand
private readonly ICliHostEnvironment _hostEnvironment;
private readonly ProfilingTelemetry _profilingTelemetry;
private bool _isDetachMode;
+ private bool _hasAppHostContext;
// Guest AppHosts can bring up the temporary server/backchannel and then fail immediately
// afterward when the guest startup process hits a syntax or pre-execute error. Keep the
@@ -80,6 +81,7 @@ internal sealed class RunCommand : BaseCommand
private static readonly TimeSpan s_detachedStartupStabilityWindow = TimeSpan.FromSeconds(2);
protected override bool UpdateNotificationsEnabled => !_isDetachMode;
+ protected override bool IncludeAppHostUpdateCommandInUpdateNotification => _hasAppHostContext;
private static readonly Option s_detachOption = new("--detach")
{
@@ -132,6 +134,7 @@ public RunCommand(
protected override async Task ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
+ _hasAppHostContext = false;
var passedAppHostProjectFile = parseResult.GetValue(AppHostLauncher.s_appHostOption);
var detach = parseResult.GetValue(s_detachOption);
_isDetachMode = detach;
@@ -220,6 +223,7 @@ protected override async Task ExecuteAsync(ParseResult parseResul
runActivity?.SetTag(TelemetryConstants.Tags.ErrorType, "project_not_found");
return CommandResult.Failure(CliExitCodes.FailedToFindProject);
}
+ _hasAppHostContext = true;
// Resolve the language for this file and get the appropriate handler
var project = _projectFactory.TryGetProject(effectiveAppHostFile);
diff --git a/src/Aspire.Cli/Commands/StartCommand.cs b/src/Aspire.Cli/Commands/StartCommand.cs
index 13426fb727c..bbd1966c404 100644
--- a/src/Aspire.Cli/Commands/StartCommand.cs
+++ b/src/Aspire.Cli/Commands/StartCommand.cs
@@ -20,6 +20,9 @@ internal sealed class StartCommand : BaseCommand
private readonly AppHostLauncher _appHostLauncher;
private readonly IConfiguration _configuration;
+ private bool _hasAppHostContext;
+
+ protected override bool IncludeAppHostUpdateCommandInUpdateNotification => _hasAppHostContext;
private static readonly Option s_noBuildOption = new("--no-build")
{
@@ -48,6 +51,7 @@ public StartCommand(
protected override async Task ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
+ _hasAppHostContext = false;
var passedAppHostProjectFile = parseResult.GetValue(AppHostLauncher.s_appHostOption);
var format = parseResult.GetValue(AppHostLauncher.s_formatOption);
var isolated = parseResult.GetValue(AppHostLauncher.s_isolatedOption);
@@ -75,6 +79,7 @@ protected override async Task ExecuteAsync(ParseResult parseResul
&& ExtensionHelper.IsExtensionHost(InteractionService, out var extensionInteractionService, out _)
&& string.IsNullOrEmpty(_configuration[KnownConfigNames.ExtensionDebugSessionId]))
{
+ _hasAppHostContext = passedAppHostProjectFile is not null;
var startDebugSession = parseResult.GetValue(RootCommand.StartDebugSessionOption);
var debugSessionArgs = new List();
if (isolated)
@@ -140,6 +145,7 @@ await extensionInteractionService.StartDebugSessionAsync(
globalArgs,
additionalArgs,
stopAfterLaunchDelay,
- cancellationToken);
+ cancellationToken,
+ _ => _hasAppHostContext = true);
}
}
diff --git a/src/Aspire.Cli/Interaction/ConsoleInteractionService.cs b/src/Aspire.Cli/Interaction/ConsoleInteractionService.cs
index f241f2fdd1f..91dcbc2286e 100644
--- a/src/Aspire.Cli/Interaction/ConsoleInteractionService.cs
+++ b/src/Aspire.Cli/Interaction/ConsoleInteractionService.cs
@@ -693,15 +693,22 @@ public void DisplayEmptyLine()
private const string UpdateUrl = "https://aka.ms/aspire/update";
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null)
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false)
{
// Write to stderr to avoid corrupting stdout when JSON output is used
_errorConsole.WriteLine();
- _errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.NewCliVersionAvailable, newerVersion.EscapeMarkup()));
+ if (includeAppHostUpdateCommand)
+ {
+ _errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.NewCliVersionAvailableWithAppHostUpdateCommand, newerVersion.EscapeMarkup(), "aspire update"));
+ }
+ else
+ {
+ _errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.NewCliVersionAvailable, newerVersion.EscapeMarkup()));
+ }
if (!string.IsNullOrEmpty(updateCommand))
{
- _errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.ToUpdateRunCommand, updateCommand.EscapeMarkup()));
+ _errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.ToUpdateCliUseCommand, updateCommand.EscapeMarkup()));
}
_errorConsole.MarkupLine(string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.MoreInfoNewCliVersion, MarkupHelpers.SafeLink(this, UpdateUrl)));
diff --git a/src/Aspire.Cli/Interaction/ExtensionInteractionService.cs b/src/Aspire.Cli/Interaction/ExtensionInteractionService.cs
index 195b0d6312b..67a87b2aa7a 100644
--- a/src/Aspire.Cli/Interaction/ExtensionInteractionService.cs
+++ b/src/Aspire.Cli/Interaction/ExtensionInteractionService.cs
@@ -488,9 +488,9 @@ public void DisplayMarkupLine(string markup)
_consoleInteractionService.DisplayMarkupLine(markup);
}
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null)
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false)
{
- _consoleInteractionService.DisplayVersionUpdateNotification(newerVersion, updateCommand);
+ _consoleInteractionService.DisplayVersionUpdateNotification(newerVersion, updateCommand, includeAppHostUpdateCommand);
}
public void DisplayRenderable(IRenderable renderable)
diff --git a/src/Aspire.Cli/Interaction/IInteractionService.cs b/src/Aspire.Cli/Interaction/IInteractionService.cs
index 9f453e9079e..1e25a87e732 100644
--- a/src/Aspire.Cli/Interaction/IInteractionService.cs
+++ b/src/Aspire.Cli/Interaction/IInteractionService.cs
@@ -54,7 +54,7 @@ internal interface IInteractionService
///
bool SupportsLinks { get; }
- void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null);
+ void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false);
// The semantic type is stringly-typed because some values originate from backchannel payloads.
// Use ConsoleLogTypes for CLI-defined values.
void WriteConsoleLog(string message, int? lineNumber = null, string? type = null, bool isErrorMessage = false);
diff --git a/src/Aspire.Cli/Resources/InteractionServiceStrings.Designer.cs b/src/Aspire.Cli/Resources/InteractionServiceStrings.Designer.cs
index c70ad733784..b1959c3c4d5 100644
--- a/src/Aspire.Cli/Resources/InteractionServiceStrings.Designer.cs
+++ b/src/Aspire.Cli/Resources/InteractionServiceStrings.Designer.cs
@@ -276,6 +276,15 @@ public static string NewCliVersionAvailable {
}
}
+ ///
+ /// Looks up a localized string similar to [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/].
+ ///
+ public static string NewCliVersionAvailableWithAppHostUpdateCommand {
+ get {
+ return ResourceManager.GetString("NewCliVersionAvailableWithAppHostUpdateCommand", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to No items available for selection: {0}.
///
@@ -457,11 +466,11 @@ public static string WaitingForDebuggerToAttachToAppHost {
}
///
- /// Looks up a localized string similar to [dim]To update, run: {0}[/].
+ /// Looks up a localized string similar to [dim]To update the Aspire CLI, use: {0}[/].
///
- public static string ToUpdateRunCommand {
+ public static string ToUpdateCliUseCommand {
get {
- return ResourceManager.GetString("ToUpdateRunCommand", resourceCulture);
+ return ResourceManager.GetString("ToUpdateCliUseCommand", resourceCulture);
}
}
}
diff --git a/src/Aspire.Cli/Resources/InteractionServiceStrings.resx b/src/Aspire.Cli/Resources/InteractionServiceStrings.resx
index 3c597bfa817..9b5165624f8 100644
--- a/src/Aspire.Cli/Resources/InteractionServiceStrings.resx
+++ b/src/Aspire.Cli/Resources/InteractionServiceStrings.resx
@@ -237,13 +237,17 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+
[dim]For more information, see: {0}[/]Do not translate [dim]. Also leave [/] as-is. {0} is a pre-formatted link
-
- [dim]To update, run: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useNo AppHosts were found (there may be AppHost project files with syntax errors/invalid SDK versions).
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.cs.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.cs.xlf
index cc9b135cdb4..b21507dd522 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.cs.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.cs.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Nejsou k dispozici žádné položky pro výběr: {0}
@@ -197,10 +202,10 @@
Zastavuje se Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Pro aktualizaci spusťte: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.de.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.de.xlf
index 013056bcc32..0133baf545c 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.de.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.de.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Es sind keine Elemente zur Auswahl verfügbar: {0}
@@ -197,10 +202,10 @@
Aspire wird beendet.
-
- [dim]To update, run: {0}[/]
- [dim]Zum Aktualisieren diesen Befehl ausführen: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.es.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.es.xlf
index 46b10a6a4bf..c6b9127b13e 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.es.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.es.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}No hay elementos disponibles para la selección: {0}
@@ -197,10 +202,10 @@
Deteniendo Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Para actualizar, ejecuta: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.fr.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.fr.xlf
index 4b6fff20321..3f795613a07 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.fr.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.fr.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Aucun élément disponible pour la sélection : {0}
@@ -197,10 +202,10 @@
Arrêt d’Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Pour mettre à jour, exécutez : {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.it.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.it.xlf
index 12af68ed0e9..4e178622967 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.it.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.it.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Nessun elemento disponibile per la selezione: {0}
@@ -197,10 +202,10 @@
Arresto di Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Per aggiornare, eseguire: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ja.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ja.xlf
index 8b19425be8f..6b33c8912cc 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ja.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ja.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}選択できる項目がありません: {0}
@@ -197,10 +202,10 @@
Aspire を停止しています。
-
- [dim]To update, run: {0}[/]
- [dim]更新するには、{0}[/] を実行します
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ko.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ko.xlf
index a9c6a7ba502..b4c5beac940 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ko.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ko.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}선택할 수 있는 항목 없음: {0}
@@ -197,10 +202,10 @@
Aspire를 중지하는 중입니다.
-
- [dim]To update, run: {0}[/]
- [dim]업데이트하려면 다음 명령 실행: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pl.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pl.xlf
index a22af6000c1..901c2806840 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pl.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pl.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Brak dostępnych elementów do wyboru: {0}
@@ -197,10 +202,10 @@
Zatrzymywanie platformy Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Aby zaktualizować, uruchom: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pt-BR.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pt-BR.xlf
index 19b340e641a..c47459f3334 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pt-BR.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.pt-BR.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Nenhum item disponível para seleção: {0}
@@ -197,10 +202,10 @@
Interrompendo o Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Para atualizar, execute: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ru.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ru.xlf
index da2862f8179..12cedb2002f 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ru.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.ru.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Нет элементов, доступных для выбора: {0}
@@ -197,10 +202,10 @@
Производится остановка Aspire.
-
- [dim]To update, run: {0}[/]
- [dim]Для обновления выполните: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.tr.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.tr.xlf
index 21f5bd1b96c..654b9491b45 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.tr.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.tr.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}Seçim için herhangi bir öğe mevcut değil: {0}
@@ -197,10 +202,10 @@
Aspire durduruluyor.
-
- [dim]To update, run: {0}[/]
- [dim]Güncelleştirmek için çalıştırın: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hans.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hans.xlf
index 504ae9beacb..23dea929c56 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hans.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hans.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}没有可供选择的项目: {0}
@@ -197,10 +202,10 @@
正在停止 Aspire。
-
- [dim]To update, run: {0}[/]
- [dim]若要更新,请运行: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hant.xlf b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hant.xlf
index 0fd6340094c..a2117dfa66f 100644
--- a/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hant.xlf
+++ b/src/Aspire.Cli/Resources/xlf/InteractionServiceStrings.zh-Hant.xlf
@@ -97,6 +97,11 @@
[yellow]A new version of Aspire is available: {0}[/]Do not translate [yellow] and also leave [/] as-is. {0} is the version number
+
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ [yellow]A new version of Aspire is available: {0}[/] [dim](use {1} for this AppHost)[/]
+ Do not translate [yellow], [dim], or [/] as-is. {0} is the version number. {1} is the command to use
+ No items available for selection: {0}沒有可供選取的項目: {0}
@@ -197,10 +202,10 @@
正在停止 Aspire。
-
- [dim]To update, run: {0}[/]
- [dim]若要更新,請執行: {0}[/]
- Do not translate [dim]. Also leave [/] as-is. {0} is the command to run
+
+ [dim]To update the Aspire CLI, use: {0}[/]
+ [dim]To update the Aspire CLI, use: {0}[/]
+ Do not translate [dim]. Also leave [/] as-is. {0} is the command to useTrusting certificates...
diff --git a/src/Aspire.Cli/Utils/CliUpdateNotifier.cs b/src/Aspire.Cli/Utils/CliUpdateNotifier.cs
index 3a5c0be2c5c..f77a1115d10 100644
--- a/src/Aspire.Cli/Utils/CliUpdateNotifier.cs
+++ b/src/Aspire.Cli/Utils/CliUpdateNotifier.cs
@@ -13,7 +13,7 @@ internal interface ICliUpdateNotifier
{
Task CheckForCliUpdatesAsync(DirectoryInfo workingDirectory, CancellationToken cancellationToken);
Task GetVersionStatusAsync(DirectoryInfo workingDirectory, CancellationToken cancellationToken);
- void NotifyIfUpdateAvailable();
+ void NotifyIfUpdateAvailable(bool includeAppHostUpdateCommand = false);
bool IsUpdateAvailable();
}
@@ -52,12 +52,12 @@ public async Task CheckForCliUpdatesAsync(DirectoryInfo workingDirectory, Cancel
_availablePackages = await GetCliPackagesAsync(workingDirectory, cancellationToken);
}
- public void NotifyIfUpdateAvailable()
+ public void NotifyIfUpdateAvailable(bool includeAppHostUpdateCommand = false)
{
var status = GetCachedVersionStatus();
if (status.LatestVersion is not null)
{
- interactionService.DisplayVersionUpdateNotification(status.LatestVersion, status.UpdateCommand);
+ interactionService.DisplayVersionUpdateNotification(status.LatestVersion, status.UpdateCommand, includeAppHostUpdateCommand);
}
}
@@ -116,7 +116,7 @@ private CliVersionStatus GetCachedVersionStatus(string? updateCheckError = null)
}
var newerVersion = PackageUpdateHelpers.GetNewerVersion(logger, currentVersion, _availablePackages);
- var updateCommand = newerVersion is null ? null : DotNetToolDetection.GetDotNetToolUpdateCommand() ?? "aspire update";
+ var updateCommand = newerVersion is null ? null : DotNetToolDetection.GetDotNetToolUpdateCommand() ?? "aspire update --self";
// Derive the lane the recommendation comes from so doctor can show
// 'Latest version is X (channel: stable)' vs '(channel: prerelease)'.
// GetNewerVersion picks between newestStable and newestPrerelease
diff --git a/tests/Aspire.Cli.Tests/Commands/BaseCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/BaseCommandTests.cs
index 96a214fabe2..6be95aac4ab 100644
--- a/tests/Aspire.Cli.Tests/Commands/BaseCommandTests.cs
+++ b/tests/Aspire.Cli.Tests/Commands/BaseCommandTests.cs
@@ -95,7 +95,7 @@ public async Task BaseCommand_WithUpdateNotification_DoesNotDisplayTrailingBlank
var testNotifier = new TestCliUpdateNotifier
{
IsUpdateAvailableCallback = () => true,
- NotifyIfUpdateAvailableCallback = () => testInteractionService.DisplayVersionUpdateNotification("13.3.0-preview.1", "aspire update")
+ NotifyIfUpdateAvailableCallback = includeAppHostUpdateCommand => testInteractionService.DisplayVersionUpdateNotification("13.3.0-preview.1", "aspire update", includeAppHostUpdateCommand)
};
var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options =>
{
@@ -109,6 +109,7 @@ public async Task BaseCommand_WithUpdateNotification_DoesNotDisplayTrailingBlank
await result.InvokeAsync().DefaultTimeout();
+ Assert.False(testNotifier.LastIncludeAppHostUpdateCommand);
Assert.Equal(0, testInteractionService.DisplayEmptyLineCount);
}
diff --git a/tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs
index b91cda7c8b5..f01e6dd5bc8 100644
--- a/tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs
+++ b/tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs
@@ -78,7 +78,7 @@ public async Task DoctorCommand_Json_VersionUpdateBanner_IsSuppressed()
options.ErrorTextWriter = errorWriter;
options.CliUpdateNotifierFactory = sp => new TestCliUpdateNotifier
{
- NotifyIfUpdateAvailableCallback = () =>
+ NotifyIfUpdateAvailableCallback = _ =>
{
notifierInvoked = true;
var interactionService = sp.GetRequiredService();
diff --git a/tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs b/tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs
index d226eac99fc..7ef5955d70a 100644
--- a/tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs
+++ b/tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs
@@ -962,7 +962,7 @@ public void DisplayRawText(string text, ConsoleOutput? consoleOverride = null) {
public void DisplayMarkdown(string markdown, ConsoleOutput? consoleOverride = null, int? maxWidth = null) { }
public void DisplayMarkupLine(string markup) { }
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null) { }
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false) { }
public void DisplayRenderable(IRenderable renderable) { }
public Task DisplayLiveAsync(IRenderable initialRenderable, Func, Task> callback) => callback(_ => { });
diff --git a/tests/Aspire.Cli.Tests/Commands/StartCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/StartCommandTests.cs
index cb5f44890fb..464b9e2ea56 100644
--- a/tests/Aspire.Cli.Tests/Commands/StartCommandTests.cs
+++ b/tests/Aspire.Cli.Tests/Commands/StartCommandTests.cs
@@ -230,6 +230,44 @@ public async Task StartCommand_LaunchFailure_DisplaysBothLogPaths()
Assert.Contains(interactionService.DisplayedMessages, m => m.Message == expectedAppHostLogMessage);
}
+ [Fact]
+ public async Task StartCommand_WithSelectedAppHost_IncludesAppHostUpdateCommandInNotification()
+ {
+ using var workspace = TemporaryWorkspace.Create(outputHelper);
+ var appHostFile = CreateAppHostFile(workspace);
+ var updateNotifier = new TestCliUpdateNotifier();
+
+ var projectLocator = new TestProjectLocator
+ {
+ UseOrFindAppHostProjectFileWithBehaviorAsyncCallback = (_, _, _, _) =>
+ Task.FromResult(new AppHostProjectSearchResult(appHostFile, [appHostFile]))
+ };
+
+ var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options =>
+ {
+ options.ProjectLocatorFactory = _ => projectLocator;
+ options.CliUpdateNotifierFactory = _ => updateNotifier;
+ options.CliHostEnvironmentFactory = sp =>
+ {
+ var configuration = sp.GetRequiredService();
+ return new CliHostEnvironment(configuration, nonInteractive: true);
+ };
+ });
+
+ services.Replace(ServiceDescriptor.Singleton(new TestDetachedProcessLauncher(() => { })));
+ services.Replace(ServiceDescriptor.Singleton(new InstantTimeoutTimeProvider()));
+
+ using var provider = services.BuildServiceProvider();
+
+ var command = provider.GetRequiredService();
+ var result = command.Parse($"start --apphost {appHostFile.FullName}");
+
+ var exitCode = await result.InvokeAsync().DefaultTimeout();
+
+ Assert.Equal(CliExitCodes.FailedToDotnetRunAppHost, exitCode);
+ Assert.True(updateNotifier.LastIncludeAppHostUpdateCommand);
+ }
+
[Fact]
public async Task StartCommand_WhenRunningInExtensionWithoutDebugSession_StartsVsCodeRunSession()
{
diff --git a/tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs
index 1ca9bb6be7c..396f111145f 100644
--- a/tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs
+++ b/tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs
@@ -2666,8 +2666,8 @@ public void DisplayCancellationMessage(ConsoleOutput? consoleOverride = null)
_innerService.DisplayCancellationMessage(consoleOverride);
}
public void DisplayEmptyLine() => _innerService.DisplayEmptyLine();
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null)
- => _innerService.DisplayVersionUpdateNotification(newerVersion, updateCommand);
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false)
+ => _innerService.DisplayVersionUpdateNotification(newerVersion, updateCommand, includeAppHostUpdateCommand);
public void WriteConsoleLog(string message, int? lineNumber = null, string? type = null, bool isErrorMessage = false)
=> _innerService.WriteConsoleLog(message, lineNumber, type, isErrorMessage);
public void DisplayRenderable(IRenderable renderable) => _innerService.DisplayRenderable(renderable);
diff --git a/tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs b/tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs
index f962185a134..7fcff1e7889 100644
--- a/tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs
+++ b/tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs
@@ -633,17 +633,39 @@ public void DisplayVersionUpdateNotification_WithMarkupCharactersInVersion_DoesN
// Version strings are unlikely to have brackets, but the method should handle it
var version = "13.2.0-preview [beta]";
- var updateCommand = "aspire update --channel [stable]";
+ var updateCommand = "aspire update --self --channel [stable]";
// Act - should not throw due to unescaped markup characters
- var exception = Record.Exception(() => interactionService.DisplayVersionUpdateNotification(version, updateCommand));
+ var exception = Record.Exception(() => interactionService.DisplayVersionUpdateNotification(version, updateCommand, includeAppHostUpdateCommand: true));
// Assert
Assert.Null(exception);
var outputString = output.ToString();
Assert.Contains("A new version of Aspire is available:", outputString);
Assert.Contains("13.2.0-preview [beta]", outputString);
- Assert.Contains("aspire update --channel [stable]", outputString);
+ Assert.Contains("for this AppHost", outputString);
+ Assert.Contains("To update the Aspire CLI, use:", outputString);
+ Assert.Contains("aspire update --self --channel [stable]", outputString);
+ }
+
+ [Fact]
+ public void DisplayVersionUpdateNotification_WithoutAppHostContext_DoesNotShowAppHostUpdateCommand()
+ {
+ var output = new StringBuilder();
+ var console = AnsiConsole.Create(new AnsiConsoleSettings
+ {
+ Ansi = AnsiSupport.No,
+ ColorSystem = ColorSystemSupport.NoColors,
+ Out = new AnsiConsoleOutput(new StringWriter(output))
+ });
+
+ var interactionService = CreateInteractionService(console);
+
+ interactionService.DisplayVersionUpdateNotification("13.2.0", "aspire update --self");
+
+ var outputString = output.ToString();
+ Assert.Contains("To update the Aspire CLI, use: aspire update --self", outputString);
+ Assert.DoesNotContain("for this AppHost", outputString);
}
[Fact]
diff --git a/tests/Aspire.Cli.Tests/Projects/ExtensionGuestLauncherTests.cs b/tests/Aspire.Cli.Tests/Projects/ExtensionGuestLauncherTests.cs
index ce2f8fa3853..4b7923c79c6 100644
--- a/tests/Aspire.Cli.Tests/Projects/ExtensionGuestLauncherTests.cs
+++ b/tests/Aspire.Cli.Tests/Projects/ExtensionGuestLauncherTests.cs
@@ -177,7 +177,7 @@ public Task LaunchAppHostAsync(string projectFile, List arguments, List<
public void DisplayRawText(string text, ConsoleOutput? consoleOverride = null) => throw new NotImplementedException();
public void DisplayMarkdown(string markdown, ConsoleOutput? consoleOverride = null, int? maxWidth = null) => throw new NotImplementedException();
public void DisplayMarkupLine(string markup) => throw new NotImplementedException();
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null) => throw new NotImplementedException();
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false) => throw new NotImplementedException();
public void DisplayRenderable(Spectre.Console.Rendering.IRenderable renderable) => throw new NotImplementedException();
public Task DisplayLiveAsync(Spectre.Console.Rendering.IRenderable initialRenderable, Func, Task> callback) => throw new NotImplementedException();
}
diff --git a/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs b/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs
index c74778bf330..aa794c19829 100644
--- a/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs
+++ b/tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs
@@ -410,7 +410,7 @@ public void DisplayMarkdown(string markdown, ConsoleOutput? consoleOverride = nu
public void DisplayMarkupLine(string markup) { }
public void DisplaySubtleMessage(string message, bool allowMarkup = false) { }
public void DisplayEmptyLine() { }
- public void DisplayVersionUpdateNotification(string message, string? updateCommand = null) { }
+ public void DisplayVersionUpdateNotification(string message, string? updateCommand = null, bool includeAppHostUpdateCommand = false) { }
public void WriteConsoleLog(string message, int? resourceHashCode, string? resourceName, bool isError) { }
public void DisplayRenderable(IRenderable renderable) { }
public Task DisplayLiveAsync(IRenderable initialRenderable, Func, Task> callback) => callback(_ => { });
diff --git a/tests/Aspire.Cli.Tests/TestServices/TestCliUpdateNotifier.cs b/tests/Aspire.Cli.Tests/TestServices/TestCliUpdateNotifier.cs
index a4e3143a3b8..6894b7884dd 100644
--- a/tests/Aspire.Cli.Tests/TestServices/TestCliUpdateNotifier.cs
+++ b/tests/Aspire.Cli.Tests/TestServices/TestCliUpdateNotifier.cs
@@ -15,7 +15,8 @@ internal sealed class TestCliUpdateNotifier : ICliUpdateNotifier
public Func? CheckForCliUpdatesAsyncCallback { get; set; }
- public Action? NotifyIfUpdateAvailableCallback { get; set; }
+ public Action? NotifyIfUpdateAvailableCallback { get; set; }
+ public bool LastIncludeAppHostUpdateCommand { get; private set; }
public Task CheckForCliUpdatesAsync(DirectoryInfo workingDirectory, CancellationToken cancellationToken)
{
@@ -34,10 +35,11 @@ public Task GetVersionStatusAsync(DirectoryInfo workingDirecto
: Task.FromResult(new CliVersionStatus("13.0.0", null, null));
}
- public void NotifyIfUpdateAvailable()
+ public void NotifyIfUpdateAvailable(bool includeAppHostUpdateCommand = false)
{
NotifyWasCalled = true;
- NotifyIfUpdateAvailableCallback?.Invoke();
+ LastIncludeAppHostUpdateCommand = includeAppHostUpdateCommand;
+ NotifyIfUpdateAvailableCallback?.Invoke(includeAppHostUpdateCommand);
}
public bool IsUpdateAvailable()
diff --git a/tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs b/tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs
index 8d89b921e5e..3da36584bdf 100644
--- a/tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs
+++ b/tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs
@@ -179,7 +179,7 @@ public void WriteConsoleLog(string message, int? lineNumber = null, string? type
public Action? DisplayVersionUpdateNotificationCallback { get; set; }
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null)
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false)
{
DisplayVersionUpdateNotificationCallback?.Invoke(newerVersion);
}
diff --git a/tests/Aspire.Cli.Tests/TestServices/TestInteractionService.cs b/tests/Aspire.Cli.Tests/TestServices/TestInteractionService.cs
index 69134484eb3..e54c7acf38e 100644
--- a/tests/Aspire.Cli.Tests/TestServices/TestInteractionService.cs
+++ b/tests/Aspire.Cli.Tests/TestServices/TestInteractionService.cs
@@ -28,6 +28,7 @@ internal sealed class TestInteractionService : IInteractionService
public Action? ShowDynamicStatusCallback { get; set; }
public Action? DisplayVersionUpdateNotificationCallback { get; set; }
public string? LastVersionUpdateCommand { get; private set; }
+ public bool LastVersionUpdateIncludedAppHostCommand { get; private set; }
///
/// Callback for capturing selection prompts in tests. Uses non-generic IEnumerable and object
@@ -329,9 +330,10 @@ public void WriteConsoleLog(string message, int? lineNumber = null, string? type
DisplayConsoleWriteLineMessage?.Invoke(output);
}
- public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null)
+ public void DisplayVersionUpdateNotification(string newerVersion, string? updateCommand = null, bool includeAppHostUpdateCommand = false)
{
LastVersionUpdateCommand = updateCommand;
+ LastVersionUpdateIncludedAppHostCommand = includeAppHostUpdateCommand;
DisplayVersionUpdateNotificationCallback?.Invoke(newerVersion);
}
diff --git a/tests/Aspire.Cli.Tests/Utils/CliUpdateNotificationServiceTests.cs b/tests/Aspire.Cli.Tests/Utils/CliUpdateNotificationServiceTests.cs
index 10cbbd35aeb..7e37d357d8e 100644
--- a/tests/Aspire.Cli.Tests/Utils/CliUpdateNotificationServiceTests.cs
+++ b/tests/Aspire.Cli.Tests/Utils/CliUpdateNotificationServiceTests.cs
@@ -291,7 +291,7 @@ public async Task NotifyIfUpdateAvailable_UsesToolPathCommandForCustomToolPath()
}
[Fact]
- public async Task NotifyIfUpdateAvailable_UsesAspireUpdateCommandForStandaloneArchivePath()
+ public async Task NotifyIfUpdateAvailable_UsesAspireUpdateSelfCommandForStandaloneArchivePath()
{
using var workspace = TemporaryWorkspace.Create(outputHelper);
using var processPathScope = DotNetToolDetection.UseProcessPathForTesting("/home/test/.aspire/bin/aspire");
@@ -328,7 +328,7 @@ public async Task NotifyIfUpdateAvailable_UsesAspireUpdateCommandForStandaloneAr
notifier.NotifyIfUpdateAvailable();
Assert.NotNull(interactionService);
- Assert.Equal("aspire update", interactionService.LastVersionUpdateCommand);
+ Assert.Equal("aspire update --self", interactionService.LastVersionUpdateCommand);
}
[Fact]