diff --git a/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.CustomTestTarget.targets b/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.CustomTestTarget.targets
new file mode 100644
index 0000000000..abd9d23857
--- /dev/null
+++ b/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.CustomTestTarget.targets
@@ -0,0 +1,6 @@
+
+
+
+
+
+
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 48eea935a1..fb3aee43d5 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
@@ -267,10 +267,10 @@
-
-
-
-
+
+
+
+
diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs
index 212ee2da71..9360c2525c 100644
--- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs
+++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs
@@ -252,6 +252,21 @@ public async Task InvokeTestingPlatform_Target_Showing_Error_And_Do_Not_Capture_
compilationResult.AssertOutputContains(".NET Testing Platform");
}
+ [TestMethod]
+ public async Task TestingPlatformDisableCustomTestTarget_Should_Cause_UserDefined_Target_To_Run()
+ {
+ using TestAsset testAsset = await TestAsset.GenerateAssetAsync(
+ AssetName,
+ SourceCode
+ .PatchCodeWithReplace("$PlatformTarget$", "x64")
+ .PatchCodeWithReplace("$TargetFrameworks$", $"{TargetFrameworks.NetCurrent}")
+ .PatchCodeWithReplace("$AssertValue$", "true")
+ .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion));
+ DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -p:TestingPlatformDisableCustomTestTarget=true -p:ImportUserDefinedTestTarget=true -t:\"Build;Test\"", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, failIfReturnValueIsNotZero: false);
+
+ compilationResult.AssertOutputContains("Error from UserDefinedTestTarget.targets");
+ }
+
private const string SourceCode = """
#file MSBuild Tests.csproj
@@ -270,6 +285,15 @@ public async Task InvokeTestingPlatform_Target_Showing_Error_And_Do_Not_Capture_
+
+
+
+
+#file UserDefinedTestTarget.targets
+
+
+
+
#file Program.cs