Skip to content

Commit

Permalink
RunVSTest: Avoid running tests a second time when running under dotnet (
Browse files Browse the repository at this point in the history
  • Loading branch information
dfederm authored Mar 29, 2024
1 parent 787e846 commit 92b330e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/RunTests/build/Microsoft.Build.RunVSTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
Licensed under the MIT license.
-->
<Project>
<UsingTask TaskName="Microsoft.Build.RunVSTestTask" AssemblyFile="$(MSBuildThisFileDirectory)netstandard2.0\Microsoft.Build.RunVSTest.dll" Condition="'$(IsTestProject)' == 'true' and '$(MSBuildRuntime)' != 'Core'"/>
<Target Name="RunVSTest" AfterTargets="Test" Condition="'$(IsTestProject)' == 'true' and '$(MSBuildRuntime)' != 'Core'">
<UsingTask TaskName="Microsoft.Build.RunVSTestTask" AssemblyFile="$(MSBuildThisFileDirectory)netstandard2.0\Microsoft.Build.RunVSTest.dll" />

<!-- Only consider non "dotnet" scenarios sinces those are already covered by Microsoft.Testing.Platform.MSBuild, which is automatically included as a dependency of MSTest.TestAdapter -->
<Target Name="RunVSTest" AfterTargets="Test" Condition="'$(RunVSTest)' != 'false' and '$(IsTestProject)' == 'true' and '$(MSBuildRuntimeType)' != 'Core'">
<RunVSTestTask ToolExe="$(VSTestToolExe)"
ToolPath="$(VSTestToolPath)"
TestFileFullPath="$(TargetPath)"
Expand All @@ -33,7 +35,4 @@
VSTestArtifactsProcessingMode="$(VSTestArtifactsProcessingMode)"
VSTestSessionCorrelationId="$(VSTestSessionCorrelationId)" />
</Target>
<Target Name="ForceRunVSTest" AfterTargets="Test" Condition="'$(IsTestProject)' == 'true' and '$(MSBuildRuntime)' == 'Core'" >
<CallTarget Targets="VSTest" />
</Target>
</Project>

0 comments on commit 92b330e

Please sign in to comment.