Skip to content

Commit

Permalink
Ensure the Public API analyzer gets installed only for src projects (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jan 17, 2022
1 parent 5accee7 commit a223146
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/build/TestPlatform.Settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
we don't ship them.
-->
<Choose>
<When Condition="$(MSBuildProjectFullPath.Contains('/src/')) OR $(MSBuildProjectFullPath.Contains('\src\'))">
<!-- 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). -->
<When Condition="$([MSBuild]::MakeRelative($(TestPlatformRoot), $(MSBuildProjectFullPath)).Contains('/src/')) OR $([MSBuild]::MakeRelative($(TestPlatformRoot), $(MSBuildProjectFullPath)).Contains('\src\'))">
<ItemGroup>
<!-- We normally don't build against net6.0, so the public api analyzer errors would only appear in CI pipeline. -->
<PackageReference Condition=" '$(DotNetBuildFromSource)' != 'true' " Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(RoslynPublicApiAnalyzersVersion)">
Expand Down

0 comments on commit a223146

Please sign in to comment.