Skip to content

$(SkipTests) isn't respected if UseVSTestRunner=true #12474

@RussKie

Description

@RussKie
  • This issue is blocking
  • This issue is causing unreasonable pain

If <UseVSTestRunner>true</UseVSTestRunner> is set, VSTest.targets gets imported:

<Import Project="..\VSTest.targets" Condition="$(UseVSTestRunner)"/>

If a test project is marked with SkipTests, a test will fail due to an invalid command constructed by VSTest.targets:

C:\Users\user\.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.23067.5\tools\VSTest.targets(46,5): error MSB3073: The command "echo === COMMAND LINE === >  [D:\dev\test\Console.Tests.csproj]
C:\Users\user\.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.23067.5\tools\VSTest.targets(46,5): error MSB3073:                    echo "D:\dev\test\.dotnet\dotnet.exe" 
 test  --logger:"console;verbosity=normal" --logger:"trx;LogFileName=" --logger:"html;LogFileName=" "--ResultsDirectory:" "--Framework:,Version=" >> "" 2>&1 >> " exited with code 255. [D:\dev\test\Console.Tests.csproj]

Here's an example.

The fix is to condition RunTests target as below:

  <Target Name="RunTests"
          Outputs="%(TestToRun.ResultsStdOutPath)"
+         Condition="'$(SkipTests)' != 'true'">
    <PropertyGroup>

Release Note Category

  • Feature changes/additions
  • Bug fixes
  • Internal Infrastructure Improvements

Release Note Description

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageA new issue that needs to be associated with an epic.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions