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

Conversation

9swampy
Copy link
Contributor

@9swampy 9swampy commented Jun 21, 2025

Description

Fix IsUnitTestProject (cannot be specified twice) and MSBuildProjectName.EndsWith (was invalid syntax so NCrunch was broken and VS was padlock unhappy if tolerant)

Related Issue

Motivation and Context

VS2022 wasn't happy and nCrunch wasn't building at all.

How Has This Been Tested?

With the fix VisualStudio is happy again, but unfortunately NCrunch still isn't and that was really what I was aiming for. I'll propose the VisualStudio fix at least for now. If you know how to fix NCrunch please do let me know. I could see quite a few years ago there were some Issues raised to get NCrunch running again so hopefully someone's in the know?

Screenshots (if appropriate):

image

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…ame.EndsWith (was invalid syntax so NCrunch was broken and VS was padlock unhappy if tolerant)
@9swampy 9swampy marked this pull request as draft June 22, 2025 04:13
@9swampy
Copy link
Contributor Author

9swampy commented Jun 22, 2025

Marked draft; don't think it has helped after all and NCRUNCH is no closer to running. Will either resubmit or delete...

<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. 😇

@9swampy
Copy link
Contributor Author

9swampy commented Jun 27, 2025

Closing - not fit for purpose.

@9swampy 9swampy closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants