Skip to content

Commit 54aa653

Browse files
authored
The CppWinRTAddXamlReferences/CppWinRTSetXamlLocalAssembly targets should only execute if the xaml language is CppWinRT.
The CppWinRTAddXamlReferences/CppWinRTSetXamlLocalAssembly targets should only execute if the xaml language is CppWinRT. Currently this also affects CX projects and since the winmd files are not yet available by the time this target runs, it causes non-determinism for subsequent builds when files do exist.
1 parent e4830e1 commit 54aa653

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nuget/Microsoft.Windows.CppWinRT.targets

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,19 @@ $(XamlMetaDataProviderPch)
535535
<Target Name="CppWinRTMakeProjections" DependsOnTargets="CppWinRTCalculateEnabledProjections;CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
536536

537537
<!--Add references to all merged project WinMD files for Xaml Compiler-->
538-
<Target Name="CppWinRTAddXamlReferences" DependsOnTargets="$(CppWinRTAddXamlReferencesDependsOn)">
538+
<Target Name="CppWinRTAddXamlReferences"
539+
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT'"
540+
DependsOnTargets="$(CppWinRTAddXamlReferencesDependsOn)">
539541
<ItemGroup>
540542
<XamlReferencesToCompile Include="$(OutDir)*.winmd" />
541543
</ItemGroup>
542544
</Target>
543545

544546
<!--Clear merged assembly and set local assembly for Xaml Compiler.
545547
(Note: this can be removed when CppWinRT references are removed from the Xaml targets file.)-->
546-
<Target Name="CppWinRTSetXamlLocalAssembly" DependsOnTargets="$(CppWinRTSetXamlLocalAssemblyDependsOn)">
548+
<Target Name="CppWinRTSetXamlLocalAssembly"
549+
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT'"
550+
DependsOnTargets="$(CppWinRTSetXamlLocalAssemblyDependsOn)">
547551
<PropertyGroup>
548552
<CppWinRTMetadataAssembly></CppWinRTMetadataAssembly>
549553
<XamlLocalAssembly>$(CppWinRTProjectWinMD)</XamlLocalAssembly>

0 commit comments

Comments
 (0)