diff --git a/documentation/general/dotnet-run-file.md b/documentation/general/dotnet-run-file.md
index 8e70cb3b11db..950740e9b12f 100644
--- a/documentation/general/dotnet-run-file.md
+++ b/documentation/general/dotnet-run-file.md
@@ -78,6 +78,7 @@ The file-based build and run kicks in only when:
- if the target file exists, and has the `.cs` file extension or contents that start with `#!`.
Otherwise, project-based `dotnet run` fallback is used and you might get an error like "Couldn't find a project to run."
+You can explicitly use the `--file` option to avoid the fallback behavior.
File-based programs are processed by `dotnet run` equivalently to project-based programs unless specified otherwise in this document.
For example, the remaining command-line arguments after the first argument (the target path) are passed through to the target app
@@ -88,7 +89,7 @@ If a dash (`-`) is given instead of the target path (i.e., `dotnet run -`), the
In this case, the current working directory is not used to search for other files (launch profiles, other sources in case of multi-file apps);
the compilation consists solely of the single file read from the standard input.
-`dotnet path.cs` is a shortcut for `dotnet run path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported).
+`dotnet path.cs` is a shortcut for `dotnet run --file path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported).
### Other commands
@@ -303,7 +304,7 @@ would need to search for a file-based program in the current directory instead o
We could add a universal option that works with both project-based and file-based programs,
like `dotnet run --directory ./dir/`. For inspiration, `dotnet test` also has a `--directory` option.
-Furthermore, users might expect there to be a `--file` option, as well. Both could be unified as `--path`.
+We already have a `--file` option. Both could be unified as `--path`.
If we want to also support [multi-entry-point scenarios](#multiple-entry-points),
we might need an option like `dotnet run --entry ./dir/name` which would work for both `./dir/name.cs` and `./dir/name/name.csproj`.
diff --git a/src/Cli/dotnet/Commands/CliCommandStrings.resx b/src/Cli/dotnet/Commands/CliCommandStrings.resx
index f967ccdc2e1a..e13a206b5888 100644
--- a/src/Cli/dotnet/Commands/CliCommandStrings.resx
+++ b/src/Cli/dotnet/Commands/CliCommandStrings.resx
@@ -671,6 +671,12 @@ dotnet.config is a name don't translate.
PROJECT_PATH
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+ FILE_PATH
+
SDK commands
diff --git a/src/Cli/dotnet/Commands/Run/RunCommand.cs b/src/Cli/dotnet/Commands/Run/RunCommand.cs
index ec1cde6e6a46..3c4884cf7405 100644
--- a/src/Cli/dotnet/Commands/Run/RunCommand.cs
+++ b/src/Cli/dotnet/Commands/Run/RunCommand.cs
@@ -445,8 +445,16 @@ private static void ThrowUnableToRunError(ProjectInstance project)
project.GetPropertyValue("OutputType")));
}
- private static string? DiscoverProjectFilePath(string? projectFileOrDirectoryPath, bool readCodeFromStdin, ref string[] args, out string? entryPointFilePath)
+ private static string? DiscoverProjectFilePath(string? filePath, string? projectFileOrDirectoryPath, bool readCodeFromStdin, ref string[] args, out string? entryPointFilePath)
{
+ // If `--file` is explicitly specified, just use that.
+ if (filePath != null)
+ {
+ Debug.Assert(projectFileOrDirectoryPath == null);
+ entryPointFilePath = Path.GetFullPath(filePath);
+ return null;
+ }
+
bool emptyProjectOption = false;
if (string.IsNullOrWhiteSpace(projectFileOrDirectoryPath))
{
@@ -547,9 +555,20 @@ public static RunCommand FromParseResult(ParseResult parseResult)
.Any(static t => t is { Type: TokenType.Argument, Value: "-" });
string? projectOption = parseResult.GetValue(RunCommandParser.ProjectOption);
+ string? fileOption = parseResult.GetValue(RunCommandParser.FileOption);
+
+ if (projectOption != null && fileOption != null)
+ {
+ throw new GracefulException(CliCommandStrings.InvalidOptionCombination, RunCommandParser.ProjectOption.Name, RunCommandParser.FileOption.Name);
+ }
string[] args = [.. nonBinLogArgs];
- string? projectFilePath = DiscoverProjectFilePath(projectOption, readCodeFromStdin, ref args, out string? entryPointFilePath);
+ string? projectFilePath = DiscoverProjectFilePath(
+ filePath: fileOption,
+ projectFileOrDirectoryPath: projectOption,
+ readCodeFromStdin: readCodeFromStdin,
+ ref args,
+ out string? entryPointFilePath);
bool noBuild = parseResult.HasOption(RunCommandParser.NoBuildOption);
diff --git a/src/Cli/dotnet/Commands/Run/RunCommandParser.cs b/src/Cli/dotnet/Commands/Run/RunCommandParser.cs
index ccc765256908..2049fe08b1e1 100644
--- a/src/Cli/dotnet/Commands/Run/RunCommandParser.cs
+++ b/src/Cli/dotnet/Commands/Run/RunCommandParser.cs
@@ -23,6 +23,12 @@ internal static class RunCommandParser
HelpName = CliCommandStrings.CommandOptionProjectHelpName
};
+ public static readonly Option FileOption = new("--file")
+ {
+ Description = CliCommandStrings.CommandOptionFileDescription,
+ HelpName = CliCommandStrings.CommandOptionFileHelpName,
+ };
+
public static readonly Option?> PropertyOption = CommonOptions.PropertiesOption;
public static readonly Option LaunchProfileOption = new("--launch-profile", "-lp")
@@ -85,6 +91,7 @@ private static Command ConstructCommand()
command.Options.Add(FrameworkOption);
command.Options.Add(RuntimeOption);
command.Options.Add(ProjectOption);
+ command.Options.Add(FileOption);
command.Options.Add(PropertyOption);
command.Options.Add(LaunchProfileOption);
command.Options.Add(NoLaunchProfileOption);
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf
index 651d84d4c430..b7968db621d9 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Název profilu spuštění (pokud existuje), který se má použít při spuštění aplikace.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf
index 1f6d15287918..5146d76497f5 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Der Name des Startprofils (sofern vorhanden), das beim Starten der Anwendung verwendet werden soll.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf
index 5091be25b583..1f52cea55197 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.El nombre del perfil de inicio (si lo hay) que se usará al iniciar la aplicación.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf
index 457afcb8a738..dd21b06605d6 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Nom du profil de lancement (le cas échéant) à utiliser au lancement de l'application.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf
index 9af4a5bae904..90ab26fb9b10 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Nome dell'eventuale profilo di avvio da usare all'avvio dell'applicazione.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf
index 22a6f15f811c..88791f08e468 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.アプリケーションを起動するときに使用する起動プロファイルの名前 (存在する場合)。
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf
index e32cb9dfbeba..28d412a57058 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.애플리케이션을 시작할 때 사용하는 시작 프로필(있는 경우)의 이름입니다.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf
index c0bbbc1caa67..0d3941d0427e 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Nazwa profilu uruchamiania (jeśli istnieje), który ma być używany podczas uruchamiania aplikacji.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf
index 979a8397c694..2236d0983c52 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.O nome do perfil de inicialização (se houver) a ser usado ao iniciar o aplicativo.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf
index 6cda527f7daf..5761063e3161 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Имя профиля запуска (если он есть), используемое при запуске приложения.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf
index 258e628a4f27..d594accc1048 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.Uygulama başlatılırken kullanılacak başlatma profilinin (varsa) adı.
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf
index 5a0e30d879ac..df9b9b992989 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.启动应用程序时使用的启动配置文件名称(如果有).
diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf
index 7d66f8e0a97d..54692c22b33f 100644
--- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf
+++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf
@@ -880,6 +880,16 @@ dotnet.config is a name don't translate.
COMMAND_NAME
+
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+ The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).
+
+
+
+ FILE_PATH
+ FILE_PATH
+
+ The name of the launch profile (if any) to use when launching the application.啟動應用程式時,所要使用的啟動設定檔 (若有) 名稱。
diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs
index fa3fc09973f0..eebf1ecae174 100644
--- a/src/Cli/dotnet/Program.cs
+++ b/src/Cli/dotnet/Program.cs
@@ -285,7 +285,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime)
static int? TryRunFileBasedApp(ParseResult parseResult)
{
// If we didn't match any built-in commands, and a C# file path is the first argument,
- // parse as `dotnet run file.cs ..rest_of_args` instead.
+ // parse as `dotnet run --file file.cs ..rest_of_args` instead.
if (parseResult.CommandResult.Command is RootCommand
&& parseResult.GetValue(Parser.DotnetSubCommand) is { } unmatchedCommandOrFile
&& VirtualProjectBuildingCommand.IsValidEntryPointPath(unmatchedCommandOrFile))
@@ -298,7 +298,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime)
otherTokens.Add(token.Value);
}
}
- parseResult = Parser.Instance.Parse(["run", unmatchedCommandOrFile, .. otherTokens]);
+ parseResult = Parser.Instance.Parse(["run", "--file", unmatchedCommandOrFile, .. otherTokens]);
InvokeBuiltInCommand(parseResult, out var exitCode);
return exitCode;
diff --git a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
index 98b62c75dd06..b4e9abeb440f 100644
--- a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
+++ b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
@@ -446,6 +446,42 @@ Hello from App
""");
}
+ [Fact]
+ public void ProjectInCurrentDirectory_NoRunVerb()
+ {
+ var testInstance = _testAssetsManager.CreateTestDirectory();
+ Directory.CreateDirectory(Path.Join(testInstance.Path, "file"));
+ File.WriteAllText(Path.Join(testInstance.Path, "file", "Program.cs"), s_program);
+ Directory.CreateDirectory(Path.Join(testInstance.Path, "proj"));
+ File.WriteAllText(Path.Join(testInstance.Path, "proj", "App.csproj"), s_consoleProject);
+
+ new DotnetCommand(Log, "../file/Program.cs")
+ .WithWorkingDirectory(Path.Join(testInstance.Path, "proj"))
+ .Execute()
+ .Should().Pass()
+ .And.HaveStdOutContaining("""
+ Hello from Program
+ """);
+ }
+
+ [Fact]
+ public void ProjectInCurrentDirectory_FileOption()
+ {
+ var testInstance = _testAssetsManager.CreateTestDirectory();
+ Directory.CreateDirectory(Path.Join(testInstance.Path, "file"));
+ File.WriteAllText(Path.Join(testInstance.Path, "file", "Program.cs"), s_program);
+ Directory.CreateDirectory(Path.Join(testInstance.Path, "proj"));
+ File.WriteAllText(Path.Join(testInstance.Path, "proj", "App.csproj"), s_consoleProject);
+
+ new DotnetCommand(Log, "run", "--file", "../file/Program.cs")
+ .WithWorkingDirectory(Path.Join(testInstance.Path, "proj"))
+ .Execute()
+ .Should().Pass()
+ .And.HaveStdOutContaining("""
+ Hello from Program
+ """);
+ }
+
///
/// When a file is not a .cs file, we probe the first characters of the file for #!, and
/// execute as a single file program if we find them.
diff --git a/test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh b/test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh
index 9d210eafca5c..fcd6e8c79e9b 100644
--- a/test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh
+++ b/test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh
@@ -1364,7 +1364,7 @@ _testhost_run() {
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=()
- opts="--configuration --framework --runtime --project --launch-profile --no-launch-profile --no-build --interactive --no-restore --no-cache --self-contained --no-self-contained --verbosity --arch --os --disable-build-servers --artifacts-path --environment --help"
+ opts="--configuration --framework --runtime --project --file --launch-profile --no-launch-profile --no-build --interactive --no-restore --no-cache --self-contained --no-self-contained --verbosity --arch --os --disable-build-servers --artifacts-path --environment --help"
if [[ $COMP_CWORD == "$1" ]]; then
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
diff --git a/test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1 b/test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1
index c7c6d89b9f37..d4b26810b56e 100644
--- a/test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1
+++ b/test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1
@@ -825,6 +825,7 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
[CompletionResult]::new('--runtime', '--runtime', [CompletionResultType]::ParameterName, "The target runtime to run for.")
[CompletionResult]::new('--runtime', '-r', [CompletionResultType]::ParameterName, "The target runtime to run for.")
[CompletionResult]::new('--project', '--project', [CompletionResultType]::ParameterName, "The path to the project file to run (defaults to the current directory if there is only one project).")
+ [CompletionResult]::new('--file', '--file', [CompletionResultType]::ParameterName, "The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).")
[CompletionResult]::new('--launch-profile', '--launch-profile', [CompletionResultType]::ParameterName, "The name of the launch profile (if any) to use when launching the application.")
[CompletionResult]::new('--launch-profile', '-lp', [CompletionResultType]::ParameterName, "The name of the launch profile (if any) to use when launching the application.")
[CompletionResult]::new('--no-launch-profile', '--no-launch-profile', [CompletionResultType]::ParameterName, "Do not attempt to use launchSettings.json to configure the application.")
diff --git a/test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh b/test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
index b19b46b84f0e..5ebf37357159 100644
--- a/test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
+++ b/test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
@@ -860,6 +860,7 @@ _testhost() {
'--runtime=[The target runtime to run for.]:RUNTIME_IDENTIFIER:->dotnet_dynamic_complete' \
'-r=[The target runtime to run for.]:RUNTIME_IDENTIFIER:->dotnet_dynamic_complete' \
'--project=[The path to the project file to run (defaults to the current directory if there is only one project).]:PROJECT_PATH: ' \
+ '--file=[The path to the file-based app to run (can be also passed as the first argument if there is no project in the current directory).]:FILE_PATH: ' \
'--launch-profile=[The name of the launch profile (if any) to use when launching the application.]:LAUNCH_PROFILE: ' \
'-lp=[The name of the launch profile (if any) to use when launching the application.]:LAUNCH_PROFILE: ' \
'--no-launch-profile[Do not attempt to use launchSettings.json to configure the application.]' \