Skip to content

Conversation

@jlaanstra
Copy link
Contributor

@jlaanstra jlaanstra commented Oct 23, 2019

MSBuild won't run targets listed in DependsOnTargets if the target is skipped due to a false condition.

In this case, the condition to run the MakeReferenceProjection input is dependent on one of the DependsOnTargets targets, causing an issue in cases where that target didn't run earlier.

The fix is a technique recommended by the MSBuild team and already used elsewhere in the targets file:

<Target Name="X" DependsOnTargets="_DetermineIfA;_A" />
<Target Name="_DetermineIfA">
  <!-- set properties -->
</Target>
<Target Name="_A" Condition="whatever" />

We apply this by having a CppWinRTResolveReferences target and have the MakeReferenceProjections target have a dependency on this new target.

Tested

  • NuGetTest.sln (Vs/MSBuild)
  • Various razzle projects.

Fixes #395

@jlaanstra jlaanstra changed the title Fix case where dependent target, needed to evaluate condition is skipped because condition is false. Fix case where dependent target, needed to evaluate condition, is skipped because condition is false. Oct 23, 2019
@Scottj1s Scottj1s merged commit aaba219 into microsoft:master Oct 24, 2019
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.

CppWinRTMakeReferenceProjection has a condition that depends on the DependsOnTargets being evaluated.

2 participants