From b2f9704eff99f0ffd20f37e4625f4dfe1491bf3f Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Mon, 26 Oct 2020 17:16:15 -0700 Subject: [PATCH 1/3] Add default WinMD references to the desktop templates. --- .../ConsoleApplication/ConsoleApplication.vcxproj | 7 ++++++- .../WindowsApplication/WindowsApplication.vcxproj | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj index 66e7c6eaa..ebe2abf9e 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj @@ -37,7 +37,7 @@ v141 v142 Unicode - + true true @@ -113,6 +113,11 @@ false + + + true + + diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj index 8071fbd46..66fd9ce9c 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj @@ -110,6 +110,11 @@ false + + + true + + From ab6df328671b983d01e9ae05a3308c0fd390d789 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 27 Oct 2020 12:29:37 -0700 Subject: [PATCH 2/3] Switch to a target. --- nuget/Microsoft.Windows.CppWinRT.targets | 141 +++++++++++++----- .../ConsoleApplication.vcxproj | 5 - .../WindowsApplication.vcxproj | 5 - 3 files changed, 101 insertions(+), 50 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index 3f1f4fb91..f939770dd 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -28,6 +28,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(CppWinRTParameters) -fastabi "$(CppWinRTPackageDir)bin\" "$(CppWinRTPackageDir)" + + true C++ Windows.UI.Xaml $(GeneratedFilesDir)XamlMetaDataProvider.idl @@ -38,7 +40,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(IntDir)$(MSBuildProjectFile).cppwinrt_plat.rsp $(IntDir)$(MSBuildProjectFile).cppwinrt_ref.rsp $(IntDir)$(MSBuildProjectFile).cppwinrt_comp.rsp - + @@ -75,6 +77,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. GetResolvedWinMD; CppWinRTCopyWinMDToOutputDirectory; + + $(ResolveReferencesDependsOn); + CppWinRTImplicitlyExpandTargetPlatform + $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTMarkStaticLibrariesPrivate; @@ -135,6 +141,59 @@ Copyright (C) Microsoft Corporation. All rights reserved. + + + + + <_TargetPlatformWinMDs Condition="'$(TargetPlatformWinMDLocation)' != ''" Include="$(TargetPlatformWinMDLocation)\**\*.winmd"> + true + false + $(TargetPlatformMoniker) + $(TargetPlatformDisplayName) + CppWinRTImplicitlyExpandTargetPlatform + True + + <_TargetPlatformWinMDs Condition="'$(TargetPlatformSdkRootOverride)' != '' AND '$(TargetPlatformWinMDLocation)' == ''" Include="$(TargetPlatformSdkRootOverride)\References\$(XeWin10TargetVersion)\**\*.winmd"> + true + false + $(TargetPlatformMoniker) + $(TargetPlatformDisplayName) + CppWinRTImplicitlyExpandTargetPlatform + True + + <_TargetPlatformWinMDs Condition="'$(TargetPlatformSdkRootOverride)' == '' AND '$(TargetPlatformWinMDLocation)' == ''" Include="$(WindowsSDK_MetadataPathVersioned)\**\*.winmd"> + true + false + $(TargetPlatformMoniker) + $(TargetPlatformDisplayName) + CppWinRTImplicitlyExpandTargetPlatform + True + + + + + + + + + + <_ResolveAssemblyReferenceResolvedFiles Include="@(_TargetPlatformWinMDs)" /> + + + <_TargetPlatformWinMDs Remove="@(_TargetPlatformWinMDs)" /> + + + @@ -247,7 +306,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. <_CppWinRTPlatformWinMDReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.IsSystemReference)' == 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference'" /> <_CppWinRTPlatformWinMDReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.IsSystemReference)' == 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetPlatform'" /> - <_CppWinRTPlatformWinMDReferences Include="$(CppWinRTSDKReferences)" /> + + <_CppWinRTPlatformWinMDReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.IsSystemReference)' == 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ResolvedFrom)' == 'CppWinRTImplicitlyExpandTargetPlatform'" /> + <_CppWinRTPlatformWinMDReferences Include="$(CppWinRTSDKReferences)" /> %(FullPath) @@ -376,16 +437,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" + - + @@ -566,11 +627,11 @@ $(XamlMetaDataProviderPch) @@ -583,7 +644,7 @@ $(XamlMetaDataProviderPch) - + - + - @@ -732,7 +793,7 @@ $(XamlMetaDataProviderPch) Lines="$(CppWinRTComponentProjectionDependencyHash)" Overwrite="true" WriteOnlyWhenDifferent="true" /> - + @@ -794,7 +855,7 @@ $(XamlMetaDataProviderPch) - + @@ -826,20 +887,20 @@ $(XamlMetaDataProviderPch) - - %(AdditionalOptions) /bigobj - %(AdditionalOptions) /await - %(AdditionalIncludeDirectories);$(GeneratedFilesDir) - - - $(WindowsSDK_MetadataFoundationPath);%(AdditionalMetadataDirectories) - $(WindowsSDK_MetadataPath);%(AdditionalMetadataDirectories) - %(AdditionalOptions) /nomidl - - - %(AdditionalDependencies);WindowsApp.lib - %(AdditionalDependencies);$(CppWinRTPackageDir)build\native\lib\$(Platform)\cppwinrt_fast_forwarder.lib - + + %(AdditionalOptions) /bigobj + %(AdditionalOptions) /await + %(AdditionalIncludeDirectories);$(GeneratedFilesDir) + + + $(WindowsSDK_MetadataFoundationPath);%(AdditionalMetadataDirectories) + $(WindowsSDK_MetadataPath);%(AdditionalMetadataDirectories) + %(AdditionalOptions) /nomidl + + + %(AdditionalDependencies);WindowsApp.lib + %(AdditionalDependencies);$(CppWinRTPackageDir)build\native\lib\$(Platform)\cppwinrt_fast_forwarder.lib + - + diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj index ebe2abf9e..6e7a77f72 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/ConsoleApplication.vcxproj @@ -113,11 +113,6 @@ false - - - true - - diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj index 66fd9ce9c..8071fbd46 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/WindowsApplication.vcxproj @@ -110,11 +110,6 @@ false - - - true - - From eb33400db94b1ab6b225c5ec87c434c9fcc9a36e Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 27 Oct 2020 12:32:17 -0700 Subject: [PATCH 3/3] Revert formatting. --- nuget/Microsoft.Windows.CppWinRT.targets | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets index f939770dd..7eb5bd565 100644 --- a/nuget/Microsoft.Windows.CppWinRT.targets +++ b/nuget/Microsoft.Windows.CppWinRT.targets @@ -437,16 +437,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" +