diff --git a/src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs b/src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs index 8f7577e6b2..a6c20bcb59 100644 --- a/src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs +++ b/src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs @@ -76,6 +76,9 @@ public InvokeTestingPlatformTask() [Required] public ITaskItem ProjectFullPath { get; set; } + [Required] + public ITaskItem VSTestNoBuild { get; set; } + public ITaskItem? DotnetHostPath { get; set; } public ITaskItem? TestingPlatformCommandLineArguments { get; set; } @@ -173,6 +176,11 @@ protected override string GenerateCommandLineCommands() builder.AppendSwitchIfNotNull("--project ", ProjectFullPath.ItemSpec); builder.AppendSwitchIfNotNull("--framework ", TargetFramework.ItemSpec); builder.AppendSwitchIfNotNull("--arch ", TestArchitecture.ItemSpec.ToLowerInvariant()); + if (bool.TryParse(VSTestNoBuild.ItemSpec, out bool noBuild) && noBuild) + { + builder.AppendSwitch("--no-build "); + } + builder.AppendTextUnquoted($" -- "); } else diff --git a/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets b/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets index 9d3e581084..6d174a0011 100644 --- a/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets +++ b/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets @@ -324,6 +324,7 @@ TestingPlatformShowTestsFailure="$(TestingPlatformShowTestsFailure)" TestingPlatformCommandLineArguments="$(TestingPlatformCommandLineArguments)" VSTestCLIRunSettings="$(VSTestCLIRunSettings)" + VSTestNoBuild="$(VSTestNoBuild)" TestingPlatformCaptureOutput="$(TestingPlatformCaptureOutput)" DotnetHostPath="$(DOTNET_HOST_PATH)" />