@@ -37,7 +37,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
3737 <WindowsSDK_MetadataFoundationPath Condition =" ('$(WindowsSDK_MetadataFoundationPath)'!='') And !Exists($(WindowsSDK_MetadataFoundationPath))" >$(WindowsSDK_MetadataPathVersioned)</WindowsSDK_MetadataFoundationPath >
3838
3939 <GetTargetPathDependsOn >
40- $(GetTargetPathDependsOn);GetCppWinRTMdMergeInputs;CppWinRTResolveWinMD ;
40+ $(GetTargetPathDependsOn);ComputeCppWinRTResolvedWinMD;CppWinRTResolvedWinMD ;
4141 </GetTargetPathDependsOn >
4242 <PrepareForBuildDependsOn >
4343 $(PrepareForBuildDependsOn);CppWinRTVerifyKitVersion;
@@ -50,7 +50,12 @@ Copyright (C) Microsoft Corporation. All rights reserved.
5050 $(ComputeMidlInputsTargets);CppWinRTComputeXamlGeneratedMidlInputs;CppWinRTSetMidlReferences;
5151 </ComputeMidlInputsTargets >
5252 <AfterMidlTargets >
53- $(AfterMidlTargets);GetCppWinRTMdMergeInputs;CppWinRTMergeProjectWinMDInputs;CppWinRTResolveWinMD;
53+ $(AfterMidlTargets);
54+ GetCppWinRTMdMergeInputs;
55+ CppWinRTMergeProjectWinMDInputs;
56+ ComputeCppWinRTResolvedWinMD;
57+ CppWinRTResolvedWinMD;
58+ CppWinRTResolvedWinMDToOutputDirectory;
5459 </AfterMidlTargets >
5560 <ResolveAssemblyReferencesDependsOn >
5661 $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTRemoveStaticLibraries;
@@ -112,8 +117,17 @@ Copyright (C) Microsoft Corporation. All rights reserved.
112117 </ItemGroup >
113118 </Target >
114119
115- <Target Name =" CppWinRTResolveWinMD"
116- Condition =" '@(CppWinRTMdMergeInputs)' != '' AND '$(CppWinRTEnableComponentProjection)' == 'true'"
120+ <Target Name =" ComputeCppWinRTResolvedWinMD"
121+ Condition =" '$(CppWinRTGenerateWindowsMetadata)' == ''"
122+ DependsOnTargets =" GetCppWinRTMdMergeInputs" >
123+ <PropertyGroup >
124+ <CppWinRTGenerateWindowsMetadata Condition =" '@(CppWinRTMdMergeInputs)'!= ''" >true</CppWinRTGenerateWindowsMetadata >
125+ <CppWinRTGenerateWindowsMetadata Condition =" '@(CppWinRTMdMergeInputs)'== ''" >false</CppWinRTGenerateWindowsMetadata >
126+ </PropertyGroup >
127+ </Target >
128+
129+ <Target Name =" CppWinRTResolvedWinMD"
130+ Condition =" '$(CppWinRTGenerateWindowsMetadata)' == 'true'"
117131 Returns =" @(WinMDFullPath)" >
118132 <ItemGroup >
119133 <WinMDFullPath Remove =" @(WinMDFullPath)" />
@@ -127,7 +141,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
127141 <ProjectType >$(ConfigurationType)</ProjectType >
128142 </WinMDFullPath >
129143 </ItemGroup >
130- <Message Text =" CppWinRTResolveWinMD : @(WinMDFullPath->'%(FullPath)')" Importance =" $(CppWinRTVerbosity)" />
144+ <Message Text =" CppWinRTResolvedWinMD : @(WinMDFullPath->'%(FullPath)')" Importance =" $(CppWinRTVerbosity)" />
131145 </Target >
132146
133147 <!-- Static library reference files are merged into the project that
@@ -372,7 +386,7 @@ $(XamlMetaDataProviderPch)
372386 <Target Name =" CppWinRTMergeProjectWinMDInputs"
373387 DependsOnTargets =" Midl;GetCppWinRTMdMergeInputs;$(CppWinRTMergeProjectWinMDInputsDependsOn)"
374388 Inputs =" @(CppWinRTMdMergeInputs)"
375- Outputs =" $(CppWinRTProjectWinMD) " >
389+ Outputs =" @(_MdMergedOutput);$(IntDir)mdmerge.rsp " >
376390 <PropertyGroup >
377391 <!-- Note: CppWinRTNamespaceMergeDepth supersedes CppWinRTMergeDepth-->
378392 <_MdMergeDepth Condition =" '$(CppWinRTNamespaceMergeDepth)' != ''" >-n:$(CppWinRTNamespaceMergeDepth)</_MdMergeDepth >
@@ -401,11 +415,19 @@ $(XamlMetaDataProviderPch)
401415 <_MdMergedOutput Remove =" @(_MdMergedOutput)" />
402416 <_MdMergedOutput Include =" $(CppWinRTMergedDir)*.winmd" />
403417 </ItemGroup >
418+ <Message Text =" CppWinRTMdMerge output: @(MdMergeOutput)" Importance =" $(CppWinRTVerbosity)" />
419+ </Target >
420+
421+ <!-- Only copy winmd to output folder if CppWinRTGenerateWindowsMetadata is true -->
422+ <Target Name =" CppWinRTResolvedWinMDToOutputDirectory"
423+ Condition =" '$(CppWinRTGenerateWindowsMetadata)' == 'true'"
424+ DependsOnTargets =" CppWinRTMergeProjectWinMDInputs;$(CppWinRTResolvedWinMDToOutputDirectoryDependsOn)"
425+ Inputs =" @(_MdMergedOutput)"
426+ Outputs =" $(CppWinRTProjectWinMD)" >
404427 <Copy UseHardlinksIfPossible =" $(CppWinRTUseHardlinksIfPossible)"
405428 SkipUnchangedFiles =" $(CppWinRTSkipUnchangedFiles)"
406429 SourceFiles =" @(_MdMergedOutput)"
407430 DestinationFiles =" @(_MdMergedOutput->'$(OutDir)%(Filename)%(Extension)')" />
408- <Message Text =" CppWinRTMdMerge output: @(MdMergeOutput)" Importance =" $(CppWinRTVerbosity)" />
409431 </Target >
410432
411433 <!-- Build the platform projection from the winmds that sip with the platform in the Windows SDK -->
0 commit comments