From 9216ed09552a6d7af03d0f0e02a9fc360239a386 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Mon, 25 Nov 2019 21:52:26 -0800 Subject: [PATCH 1/8] Fix the WinMDArtifactsOutputGroup to return the CppWinRT generated WinMD. VS uses this to resolve project output. --- nuget/Microsoft.Windows.CppWinRT.targets | 63 ++++++++++++++++++------ 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index e46e6b3ca..fe6ba164b 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -308,16 +308,16 @@ Copyright (C) Microsoft Corporation. All rights reserved. [$(XamlNamespace).Markup.FullXamlMetadataProvider] import "$(XamlNamespace).Markup.idl"%3b -// This file is generated by the build to support Xaml apps -$(XamlMarkupIdlImport) -namespace $(RootNamespace) -{ - $(FullXamlMetadataProviderAttribute)runtimeclass XamlMetaDataProvider : [default] $(XamlNamespace).Markup.IXamlMetadataProvider - { - XamlMetaDataProvider()%3b - } -} - + // This file is generated by the build to support Xaml apps + $(XamlMarkupIdlImport) + namespace $(RootNamespace) + { + $(FullXamlMetadataProviderAttribute)runtimeclass XamlMetaDataProvider : [default] $(XamlNamespace).Markup.IXamlMetadataProvider + { + XamlMetaDataProvider()%3b + } + } + @(ClCompile->Metadata('PrecompiledHeaderFile')->Distinct()) #include "$(_PCH)" -// This file is generated by the build to support Xaml apps -$(XamlMetaDataProviderPch) -#include "XamlMetaDataProvider.h" -#include "XamlMetaDataProvider.g.cpp" - + // This file is generated by the build to support Xaml apps + $(XamlMetaDataProviderPch) + #include "XamlMetaDataProvider.h" + #include "XamlMetaDataProvider.g.cpp" + + + + + + + + + + + + + + + + + + + From 8ea92f8c01a3dde90c2db05591d9be4ade2c3f71 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 10:14:52 -0800 Subject: [PATCH 2/8] Comments. --- nuget/Microsoft.Windows.CppWinRT.targets | 44 +++++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index fe6ba164b..167f2f1e9 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -308,16 +308,16 @@ Copyright (C) Microsoft Corporation. All rights reserved. [$(XamlNamespace).Markup.FullXamlMetadataProvider] import "$(XamlNamespace).Markup.idl"%3b - // This file is generated by the build to support Xaml apps - $(XamlMarkupIdlImport) - namespace $(RootNamespace) - { - $(FullXamlMetadataProviderAttribute)runtimeclass XamlMetaDataProvider : [default] $(XamlNamespace).Markup.IXamlMetadataProvider - { - XamlMetaDataProvider()%3b - } - } - +// This file is generated by the build to support Xaml apps +$(XamlMarkupIdlImport) +namespace $(RootNamespace) +{ + $(FullXamlMetadataProviderAttribute)runtimeclass XamlMetaDataProvider : [default] $(XamlNamespace).Markup.IXamlMetadataProvider + { + XamlMetaDataProvider()%3b + } +} + @(ClCompile->Metadata('PrecompiledHeaderFile')->Distinct()) #include "$(_PCH)" - // This file is generated by the build to support Xaml apps - $(XamlMetaDataProviderPch) - #include "XamlMetaDataProvider.h" - #include "XamlMetaDataProvider.g.cpp" - +// This file is generated by the build to support Xaml apps +$(XamlMetaDataProviderPch) +#include "XamlMetaDataProvider.h" +#include "XamlMetaDataProvider.g.cpp" + @@ -614,7 +616,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + From 4f80f46502495a36d796b387aa53cd9130f29b12 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 10:45:29 -0800 Subject: [PATCH 3/8] Override GetResolvedWinMD to reduce the amount of overrides. --- nuget/Microsoft.Windows.CppWinRT.targets | 86 +++++++++++------------- 1 file changed, 38 insertions(+), 48 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index 167f2f1e9..dd8cd2795 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -26,7 +26,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. + and this is done by the CppWinRTComputeGenerateWindowsMetadata target. --> false false @@ -41,7 +41,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(WindowsSDK_MetadataPathVersioned) - $(GetTargetPathDependsOn);ComputeCppWinRTResolvedWinMD;CppWinRTResolvedWinMD; + CppWinRTComputeGenerateWindowsMetadata;$(GetTargetPathDependsOn) $(PrepareForBuildDependsOn);CppWinRTVerifyKitVersion; @@ -57,9 +57,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(AfterMidlTargets); GetCppWinRTMdMergeInputs; CppWinRTMergeProjectWinMDInputs; - ComputeCppWinRTResolvedWinMD; - CppWinRTResolvedWinMD; - CppWinRTResolvedWinMDToOutputDirectory; + CppWinRTComputeGenerateWindowsMetadata; + GetResolvedWinMD; + CppWinRTCopyWinMDToOutputDirectory; $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTRemoveStaticLibraries; @@ -122,7 +122,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - @@ -131,12 +131,36 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + + + + + + true + + + + + $([System.IO.Path]::GetFileName('%(Link.WindowsMetadataFile)')) + true + + + + $(WinMDImplementationPath)$(TargetName)$(TargetExt) + winmd + true + $(ConfigurationType) + + + + + + - - + $([System.IO.Path]::GetFileName('$(CppWinRTProjectWinMD)')) true $(WinMDImplementationPath)$(RootNamespace)$(TargetExt) @@ -146,7 +170,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(ConfigurationType) - + + - - - - - - - - - - - - - - - - - - - From 7aa8e626b2f35c3abce14b4af869a5ec69b188d2 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 10:49:28 -0800 Subject: [PATCH 4/8] Add comment. --- nuget/Microsoft.Windows.CppWinRT.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index dd8cd2795..407255e29 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -131,6 +131,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. + From 630a72eb774c0496720673fe23c1865731ab6284 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 10:58:39 -0800 Subject: [PATCH 5/8] Simplify computing CppWinRTGenerateWindowsMetadata. --- nuget/Microsoft.Windows.CppWinRT.targets | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index 407255e29..d38338b70 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -40,11 +40,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(WindowsSDK_MetadataPathVersioned) - - CppWinRTComputeGenerateWindowsMetadata;$(GetTargetPathDependsOn) - - $(PrepareForBuildDependsOn);CppWinRTVerifyKitVersion; + $(PrepareForBuildDependsOn); + CppWinRTVerifyKitVersion; @@ -57,7 +55,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(AfterMidlTargets); GetCppWinRTMdMergeInputs; CppWinRTMergeProjectWinMDInputs; - CppWinRTComputeGenerateWindowsMetadata; GetResolvedWinMD; CppWinRTCopyWinMDToOutputDirectory; @@ -123,7 +120,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. true @@ -137,6 +133,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. we need to keep the CX logic as well. --> + + + @@ -145,7 +144,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. true - + $([System.IO.Path]::GetFileName('%(Link.WindowsMetadataFile)')) From 75ca4d79c29d9240c73378567420787b37024a28 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 23:26:55 -0800 Subject: [PATCH 6/8] CppWinRTComputeGenerateWindowsMetadata can run during ResolveAssemblyReferences, so it can't depend on it. --- nuget/Microsoft.Windows.CppWinRT.targets | 27 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index d38338b70..7e756fb50 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -120,11 +120,28 @@ Copyright (C) Microsoft Corporation. All rights reserved. + DependsOnTargets="CppWinRTComputeXamlGeneratedMidlInputs;GetCppWinRTProjectWinMDReferences;$(CppWinRTComputeGenerateWindowsMetadataDependsOn)"> + - true - false + + true + true + + + false + + + + + + + - - - From 38400491288a35d0d98d2829a1506b0c222815a7 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 23:27:07 -0800 Subject: [PATCH 7/8] Prevent cycles in the test project by different import order. --- test/nuget/Directory.Build.props | 2 -- test/nuget/Directory.Build.targets | 2 -- test/nuget/TestApp/TestApp.vcxproj | 2 ++ test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj | 2 ++ test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj | 2 ++ test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj | 2 ++ .../nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj | 2 ++ .../TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj | 2 ++ test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj | 2 ++ test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj | 2 ++ test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj | 2 ++ test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj | 2 ++ test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj | 2 ++ test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj | 2 ++ 14 files changed, 24 insertions(+), 4 deletions(-) diff --git a/test/nuget/Directory.Build.props b/test/nuget/Directory.Build.props index 5f3583f51..bab3233f4 100644 --- a/test/nuget/Directory.Build.props +++ b/test/nuget/Directory.Build.props @@ -22,6 +22,4 @@ $(SolutionDir)..\..\_build\$(CppWinRTPlatform)\$(Configuration)\ - - diff --git a/test/nuget/Directory.Build.targets b/test/nuget/Directory.Build.targets index 10be4f7f6..dbe64925b 100644 --- a/test/nuget/Directory.Build.targets +++ b/test/nuget/Directory.Build.targets @@ -6,6 +6,4 @@ - - diff --git a/test/nuget/TestApp/TestApp.vcxproj b/test/nuget/TestApp/TestApp.vcxproj index f61367d6b..8587de1f3 100644 --- a/test/nuget/TestApp/TestApp.vcxproj +++ b/test/nuget/TestApp/TestApp.vcxproj @@ -1,5 +1,6 @@  + true true @@ -168,4 +169,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj b/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj index 5f92b074f..69fc368a5 100644 --- a/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj +++ b/test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj @@ -1,5 +1,6 @@ + true true @@ -129,4 +130,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj b/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj index c30618143..6c4e26fdc 100644 --- a/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj +++ b/test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj @@ -1,5 +1,6 @@ + true true @@ -136,4 +137,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj b/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj index 20b8301fd..55f224b40 100644 --- a/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj +++ b/test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj @@ -1,5 +1,6 @@ + true true @@ -136,4 +137,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj b/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj index 739a7fbee..81767d259 100644 --- a/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj +++ b/test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj @@ -1,5 +1,6 @@ + Debug @@ -262,4 +263,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj b/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj index 03fa5a174..274e6f474 100644 --- a/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj +++ b/test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj @@ -1,5 +1,6 @@ + true true @@ -130,4 +131,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj b/test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj index 8d00949aa..a6d96fcc5 100644 --- a/test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj +++ b/test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj @@ -1,5 +1,6 @@ + true true @@ -227,4 +228,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj b/test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj index 3bae76471..e5ed5219f 100644 --- a/test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj +++ b/test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj @@ -1,5 +1,6 @@ + true true @@ -227,4 +228,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj b/test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj index 4cea9b215..4ee9932f4 100644 --- a/test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj +++ b/test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj @@ -1,5 +1,6 @@ + true true @@ -222,4 +223,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj b/test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj index b21c082d8..c23830ec0 100644 --- a/test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj +++ b/test/nuget/TestStaticLibrary4/TestStaticLibrary4.vcxproj @@ -1,5 +1,6 @@ + Debug @@ -204,4 +205,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj b/test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj index 6d0fc2370..92a8a9336 100644 --- a/test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj +++ b/test/nuget/TestStaticLibrary5/TestStaticLibrary5.vcxproj @@ -1,5 +1,6 @@ + Debug @@ -204,4 +205,5 @@ + \ No newline at end of file diff --git a/test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj b/test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj index afab2bb75..e085518b4 100644 --- a/test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj +++ b/test/nuget/TestStaticLibrary6/TestStaticLibrary6.vcxproj @@ -1,5 +1,6 @@ + Debug @@ -215,4 +216,5 @@ + \ No newline at end of file From c8c54879c5cfd7b696e7f1907fa4f88c5d3d9984 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 26 Nov 2019 23:28:17 -0800 Subject: [PATCH 8/8] Fix typo. --- nuget/Microsoft.Windows.CppWinRT.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index 7e756fb50..ee0ec5e16 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -146,7 +146,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.