Opt into Microsoft.Build.RunVSTest to run tests within MSBuild (#32166)

This commit is contained in:
David Federman
2024-04-02 11:47:58 -07:00
committed by GitHub
parent f23fa3f592
commit ffb4ece774
6 changed files with 39 additions and 48 deletions

View File

@@ -44,6 +44,20 @@
</PackageReference>
</ItemGroup>
<!-- Add ability to run tests via "msbuild /t:Test" -->
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
<PropertyGroup>
<VSTestLogger>trx</VSTestLogger>
<!--
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
but some of the CI scenarios don't define %VSINSTALLDIR%, so be explicit about where to look for vstest.
Note: $(VsInstallRoot) is a built-in MSBuild property, so should always be defined.
-->
<VSTestToolPath>$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\TestWindow</VSTestToolPath>
<!-- No arm64 agents to run the tests. -->
<RunVSTest Condition="'$(Platform)' == 'ARM64'">false</RunVSTest>
</PropertyGroup>
<!-- MSBuildCache -->
<PropertyGroup>
<!-- Off by default -->
@@ -74,6 +88,12 @@
E:\;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
<!-- Unit tests of low-priv processes, eg the preview handler tests, may log to this location. -->
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
$(USERPROFILE)\AppData\LocalLow\Microsoft\PowerToys\**;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
<!--
This repo uses a common output directory with many projects writing duplicate outputs. Allow everything, but note this costs some performance in the form of requiring
the cache to use copies instead of hardlinks when pulling from cache.