diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs
index 954d15fe5a..dd547de8c8 100644
--- a/src/vstest.console/CommandLine/Executor.cs
+++ b/src/vstest.console/CommandLine/Executor.cs
@@ -131,7 +131,7 @@ internal int Execute(params string[]? args)
// If we're postprocessing we don't need to show the splash
if (!ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(args))
{
- PrintSplashScreen(isDiag);
+ PrintSplashScreen(isDiag, args);
}
}
@@ -434,7 +434,7 @@ private bool ExecuteArgumentProcessor(IArgumentProcessor processor, ref int exit
///
/// Displays the Company and Copyright splash title info immediately after launch
///
- private void PrintSplashScreen(bool isDiag)
+ private void PrintSplashScreen(bool isDiag, string[]? args)
{
string? assemblyVersion = Product.Version;
if (!isDiag)
@@ -452,9 +452,21 @@ private void PrintSplashScreen(bool isDiag)
Output.WriteLine(commandLineBanner, OutputLevel.Information);
Output.WriteLine(CommandLineResources.CopyrightCommandLineTitle, OutputLevel.Information);
PrintWarningIfRunningEmulatedOnArm64();
+ PrintWarningIfInvokedThroughDotnetVSTest(args);
Output.WriteLine(string.Empty, OutputLevel.Information);
}
+ ///
+ /// Display a warning if we're executed through `dotnet vstest`
+ ///
+ private void PrintWarningIfInvokedThroughDotnetVSTest(string[]? args)
+ {
+ if (ShowDeprecateDotnetVStestMessageArgumentProcessor.ContainsShowDeprecateDotnetVSTestMessageCommand(args))
+ {
+ Output.Warning(false, CommandLineResources.VSTestDeprecationMessage);
+ }
+ }
+
///
/// Display a warning if we're running the runner on ARM64 but with a different current process architecture.
///
diff --git a/src/vstest.console/Processors/ShowDeprecateDotnetVStestMessageArgumentProcessor.cs b/src/vstest.console/Processors/ShowDeprecateDotnetVStestMessageArgumentProcessor.cs
new file mode 100644
index 0000000000..71db32aa9e
--- /dev/null
+++ b/src/vstest.console/Processors/ShowDeprecateDotnetVStestMessageArgumentProcessor.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Linq;
+
+namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors;
+internal class ShowDeprecateDotnetVStestMessageArgumentProcessor : IArgumentProcessor
+{
+ public const string CommandName = "/ShowDeprecateDotnetVSTestMessage";
+ private Lazy? _metadata;
+ private Lazy? _executor;
+
+ public Lazy? Executor
+ {
+ get => _executor ??= new Lazy(() =>
+ new ShowDeprecateDotnetVStestMessageProcessorExecutor());
+
+ set => _executor = value;
+ }
+
+ public Lazy Metadata
+ => _metadata ??= new Lazy(() => new ShowDeprecateDotnetVStestMessageProcessorCapabilities());
+
+ public static bool ContainsShowDeprecateDotnetVSTestMessageCommand(string[]? args) =>
+ args?.Contains("--ShowDeprecateDotnetVSTestMessage", StringComparer.OrdinalIgnoreCase) == true;
+}
+
+internal class ShowDeprecateDotnetVStestMessageProcessorCapabilities : BaseArgumentProcessorCapabilities
+{
+ public override string CommandName => ShowDeprecateDotnetVStestMessageArgumentProcessor.CommandName;
+
+ public override bool AllowMultiple => false;
+
+ public override ArgumentProcessorPriority Priority => ArgumentProcessorPriority.CliRunSettings;
+
+ public override HelpContentPriority HelpPriority => HelpContentPriority.None;
+
+ public override string? HelpContentResourceName => null;
+}
+
+internal class ShowDeprecateDotnetVStestMessageProcessorExecutor : IArgumentExecutor
+{
+ public ArgumentProcessorResult Execute() => ArgumentProcessorResult.Success;
+
+ public void Initialize(string? argument) { }
+}
diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs
index f42c8170d8..d014395236 100644
--- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs
+++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs
@@ -226,6 +226,7 @@ public IEnumerable GetArgumentProcessorsToAlwaysExecute()
new ListSettingsProvidersArgumentProcessor(),
new ListFullyQualifiedTestsArgumentProcessor(),
new ListTestsTargetPathArgumentProcessor(),
+ new ShowDeprecateDotnetVStestMessageArgumentProcessor(),
new EnvironmentArgumentProcessor()
};
diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs
index 61cecdd3c2..06a734d6be 100644
--- a/src/vstest.console/Resources/Resources.Designer.cs
+++ b/src/vstest.console/Resources/Resources.Designer.cs
@@ -859,7 +859,7 @@ internal static string InvalidProcDumpDirectoryPath {
}
///
- /// Looks up a localized string similar to The directory specified for the procdump executable is not valid and the tool was not found inside environment variables(PROCDUMP_PATH, PATH).
+ /// Looks up a localized string similar to The directory specified for the procdump executable is not valid and the tool was not found inside environment variables (PROCDUMP_PATH, PATH).
///
internal static string InvalidProcDumpToolDirectoryPath {
get {
@@ -1898,6 +1898,15 @@ internal static string UseVsixExtensionsValueRequired {
}
}
+ ///
+ /// Looks up a localized string similar to The dotnet vstest command is superseded by dotnet test, which can now be used to run assemblies. See https://aka.ms/dotnet-test..
+ ///
+ internal static string VSTestDeprecationMessage {
+ get {
+ return ResourceManager.GetString("VSTestDeprecationMessage", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Logging Vstest Diagnostics in file: {0}.
///
diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx
index bf730bc653..60d401156a 100644
--- a/src/vstest.console/Resources/Resources.resx
+++ b/src/vstest.console/Resources/Resources.resx
@@ -843,4 +843,7 @@
Error hosting communication channel.
-
+
+ The dotnet vstest command is superseded by dotnet test, which can now be used to run assemblies. See https://aka.ms/dotnet-test.
+
+
\ No newline at end of file
diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf
index ab923b4a13..579863c6cf 100644
--- a/src/vstest.console/Resources/xlf/Resources.cs.xlf
+++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf
@@ -1234,6 +1234,11 @@
Argument AeDebugger {0} není platný.
+
+
+ The dotnet vstest command is superseded by dotnet test, which can now be used to run assemblies. See https://aka.ms/dotnet-test.
+
+