Skip to content

Commit a223146

Browse files
authored
Ensure the Public API analyzer gets installed only for src projects (#3256)
1 parent 5accee7 commit a223146

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/build/TestPlatform.Settings.targets

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
we don't ship them.
5555
-->
5656
<Choose>
57-
<When Condition="$(MSBuildProjectFullPath.Contains('/src/')) OR $(MSBuildProjectFullPath.Contains('\src\'))">
57+
<!-- Use relative path between the project and the root to avoid including the analyzer if the path above the root contains 'src' (e.g. C:\src\vstest). -->
58+
<When Condition="$([MSBuild]::MakeRelative($(TestPlatformRoot), $(MSBuildProjectFullPath)).Contains('/src/')) OR $([MSBuild]::MakeRelative($(TestPlatformRoot), $(MSBuildProjectFullPath)).Contains('\src\'))">
5859
<ItemGroup>
5960
<!-- We normally don't build against net6.0, so the public api analyzer errors would only appear in CI pipeline. -->
6061
<PackageReference Condition=" '$(DotNetBuildFromSource)' != 'true' " Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(RoslynPublicApiAnalyzersVersion)">

0 commit comments

Comments
 (0)