Skip to content

Fix Directory.Build.props #4586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>

<IsUnitTestProject>false</IsUnitTestProject>
<DisableApiAnalyzers>false</DisableApiAnalyzers>
<IsUnitTestProject Condition="$(MSBuildProjectName.EndsWith('.Tests')) or $(MSBuildProjectName.EndsWith('.Testing'))">true</IsUnitTestProject>
<IsUnitTestProject Condition="'$(MSBuildProjectName)' != '' and ($([System.String]::Copy($(MSBuildProjectName)).EndsWith('.Tests')) Or $([System.String]::Copy($(MSBuildProjectName)).EndsWith('.Testing')))">true</IsUnitTestProject>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why you need to copy the Project name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NCrunch doesn't get the reference VS infers from directory props. Investigating I conflated the change in this PR with another I had also made to the csproj (ref present not inferred); the hypothesis that the ms build syntax was invalid. PR proposed. Further pressing on NCrunch exposed my mistake so I withdrew to draft. Sorry for the misdirect; I don't think this one's got legs.

FWIW the best I've come up with to get NCrunch functional is to messily bypass Ncrunch's problems with Core[.Testing] and relocate the immediate coverage that's directly useful. Far from ideal so apologies for relying on CI run feedback for the rest. 😇

</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand All @@ -50,7 +49,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'false' and $(MSBuildProjectName.EndsWith('.Schema')) == 'false' and '$(DisableApiAnalyzers)' == 'false'">
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'false' and '$(MSBuildProjectName)' != '' and $([System.String]::Copy($(MSBuildProjectName)).EndsWith('.Schema')) == 'false' and '$(DisableApiAnalyzers)' == 'false'">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -76,7 +75,7 @@
</PackageReference>

</ItemGroup>
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' and $(MSBuildProjectName.EndsWith('.Tests'))">
<ItemGroup Condition=" '$(IsUnitTestProject)' == 'true' and $([System.String]::Copy($(MSBuildProjectName)).EndsWith('.Tests'))">
<ProjectReference Include="..\GitVersion.Testing\GitVersion.Testing.csproj"/>

<Using Include="GitVersion.Testing"/>
Expand Down