From fb3989cd7b78e4fa96b927a9a1ce37c6503b528d Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Sun, 27 Oct 2019 15:06:20 -0700 Subject: [PATCH 1/6] Add Static Library template. --- .../BlankApp/BlankApp.vcxproj | 3 + .../Windows Universal/StaticLibrary/Class.cpp | 16 +++ .../Windows Universal/StaticLibrary/Class.h | 21 +++ .../Windows Universal/StaticLibrary/Class.idl | 9 ++ .../StaticLibrary/PropertySheet.props | 16 +++ .../StaticLibrary/StaticLibrary.vcxproj | 136 ++++++++++++++++++ .../StaticLibrary.vcxproj.filters | 32 +++++ .../cppwinrt_StaticLibrary.vstemplate | 45 ++++++ .../Windows Universal/StaticLibrary/pch.cpp | 1 + .../VC/Windows Universal/StaticLibrary/pch.h | 4 + .../StaticLibrary/readme.txt | 23 +++ .../WindowsRuntimeComponent.vcxproj | 2 +- .../WindowsRuntimeComponent/module.g.cpp | 53 ------- 13 files changed, 307 insertions(+), 54 deletions(-) create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj.filters create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.cpp create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.h create mode 100644 vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt delete mode 100644 vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/module.g.cpp diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/BlankApp.vcxproj b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/BlankApp.vcxproj index 9e027f58d..53fc8ab1b 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/BlankApp.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/BlankApp.vcxproj @@ -79,6 +79,9 @@ /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) + + false + diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp new file mode 100644 index 000000000..cc0146bad --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp @@ -0,0 +1,16 @@ +#include "pch.h" +#include "Class.h" +#include "Class.g.cpp" + +namespace winrt::$safeprojectname$::implementation +{ + int32_t Class::MyProperty() + { + throw hresult_not_implemented(); + } + + void Class::MyProperty(int32_t /* value */) + { + throw hresult_not_implemented(); + } +} diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h new file mode 100644 index 000000000..f2ea96a0c --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Class.g.h" + +namespace winrt::$safeprojectname$::implementation +{ + struct Class : ClassT + { + Class() = default; + + int32_t MyProperty(); + void MyProperty(int32_t value); + }; +} + +namespace winrt::$safeprojectname$::factory_implementation +{ + struct Class : ClassT + { + }; +} diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl new file mode 100644 index 000000000..86166e978 --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl @@ -0,0 +1,9 @@ +namespace $safeprojectname$ +{ + [default_interface] + runtimeclass Class + { + Class(); + Int32 MyProperty; + } +} diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props new file mode 100644 index 000000000..5942ba395 --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj new file mode 100644 index 000000000..ec6d58e0f --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj @@ -0,0 +1,136 @@ + + + + true + true + -lib $(MSBuildProjectName) + true + {$guid1$} + $projectname$ + $safeprojectname$ + en-US + 14.0 + true + Windows Store + 10.0 + $targetplatformversion$ + 10.0.17134.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + StaticLibrary + v140 + v141 + v142 + Unicode + false + + + true + true + + + false + true + false + + + + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + + /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) + + _WINRT_DLL;%(PreprocessorDefinitions) + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + + + Console + false + $safeprojectname$.def + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + true + true + + + + + + Class.idl + + + + + Create + + + Class.idl + + + + + + + + + + false + + + + + + \ No newline at end of file diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj.filters b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj.filters new file mode 100644 index 000000000..b6b6f9d64 --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + accd3aa8-1ba0-4223-9bbe-0c431709210b + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms + + + {926ab91d-31b4-48c3-b9a4-e681349f27f0} + + + + + + + Generated Files + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate new file mode 100644 index 000000000..1828d36e4 --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate @@ -0,0 +1,45 @@ + + + Static Library (C++/WinRT) + A project for a C++/WinRT Static Library that can be used by a Universal Windows Platform app + VC + 3000 + microsoft.Windows.CppWinRT.StaticLibrary + true + StaticLibrary + true + Enabled + true + cppwinrt.ico + cppwinrt.png + + + + StaticLibrary.vcxproj.filters + pch.cpp + pch.h + Class.idl + Class.cpp + Class.h + PropertySheet.props + readme.txt + + + + Microsoft.VisualStudio.WinRT.TemplateWizards, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Microsoft.VisualStudio.WinRT.TemplateWizards.CreateProjectCertificate.Wizard + + + Microsoft.VisualStudio.Universal.TemplateWizards, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Microsoft.VisualStudio.Universal.TemplateWizards.PlatformVersion.Wizard + + + NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + NuGet.VisualStudio.TemplateWizard + + + + + + + \ No newline at end of file diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.cpp new file mode 100644 index 000000000..bcb5590be --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.h new file mode 100644 index 000000000..21199686d --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/pch.h @@ -0,0 +1,4 @@ +#pragma once +#include +#include +#include diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt new file mode 100644 index 000000000..0649ebe33 --- /dev/null +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt @@ -0,0 +1,23 @@ +======================================================================== + C++/WinRT $projectname$ Project Overview +======================================================================== + +This project demonstrates how to get started authoring Windows Runtime +classes directly with standard C++, using the C++/WinRT SDK component +to generate implementation headers from interface (IDL) files. The +generated Windows Runtime component binary and WinMD files should then +be bundled with the Universal Windows Platform (UWP) app consuming them. + +Steps: +1. Create an interface (IDL) file to define your Windows Runtime class, + its default interface, and any other interfaces it implements. +2. Build the project once to generate module.g.cpp, module.h.cpp, and + implementation templates under the "Generated Files" folder, as + well as skeleton class definitions under "Generated Files\sources". +3. Use the skeleton class definitions for reference to implement your + Windows Runtime classes. + +======================================================================== +Learn more about C++/WinRT here: +http://aka.ms/cppwinrt/ +======================================================================== diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/WindowsRuntimeComponent.vcxproj b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/WindowsRuntimeComponent.vcxproj index d031d3540..d587f732a 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/WindowsRuntimeComponent.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/WindowsRuntimeComponent.vcxproj @@ -87,7 +87,7 @@ Console - true + false $safeprojectname$.def diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/module.g.cpp b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/module.g.cpp deleted file mode 100644 index d903ace11..000000000 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/module.g.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// WARNING: Please don't edit this file. It was generated by C++/WinRT v1.0.171228.1 - -#include "pch.h" -#include "module.g.h" - -#ifndef WINRT_SUPPRESS_MODULE_EXPORTS - -#include "Class.h" - -HRESULT __stdcall WINRT_CanUnloadNow() -{ -#ifdef _WRL_MODULE_H_ - if (!::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().Terminate()) - { - return S_FALSE; - } -#endif - - if (winrt::get_module_lock()) - { - return S_FALSE; - } - - winrt::clear_factory_cache(); - return S_OK; -} - -HRESULT __stdcall WINRT_GetActivationFactory(HSTRING classId, void** factory) -{ - try - { - *factory = nullptr; - wchar_t const* const name = WindowsGetStringRawBuffer(classId, nullptr); - - if (0 == wcscmp(name, L"WindowsRuntimeComponent.Class")) - { - *factory = winrt::detach_abi(winrt::make()); - return S_OK; - } - -#ifdef _WRL_MODULE_H_ - return ::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().GetActivationFactory(classId, reinterpret_cast<::IActivationFactory**>(factory)); -#else - return winrt::hresult_class_not_available().to_abi(); -#endif - } - catch (...) - { - return winrt::to_hresult(); - } -} - -#endif From 2e2649288127dd6947b470ba96d86a021bca45fd Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 29 Oct 2019 08:13:48 -0700 Subject: [PATCH 2/6] Explain how to use static libraries. --- .../StaticLibrary/readme.txt | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt index 0649ebe33..921f71d77 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt @@ -5,8 +5,29 @@ This project demonstrates how to get started authoring Windows Runtime classes directly with standard C++, using the C++/WinRT SDK component to generate implementation headers from interface (IDL) files. The -generated Windows Runtime component binary and WinMD files should then -be bundled with the Universal Windows Platform (UWP) app consuming them. +generated static library should be consumed by a single Runtime Component +or App project and the and types will automatically be added to that +binary. +To be able to instantiate types from the static library you need to +update the activation factory in the consuming binary to call the +activation factory exposed by this static library using code similar to: + +void* __stdcall $projectname$_get_activation_factory( + std::wstring_view const& name); + +void* __stdcall winrt_get_activation_factory( + std::wstring_view const& name) +{ + void* factory = $projectname$_get_activation_factory(name); + if (factory) + { + return factory; + } + + /* call other activation factories */ + + return nullptr; +} Steps: 1. Create an interface (IDL) file to define your Windows Runtime class, From 70a728da048796b284933115b90e92541f461996 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 29 Oct 2019 08:16:22 -0700 Subject: [PATCH 3/6] Remove cert wizard. --- .../StaticLibrary/cppwinrt_StaticLibrary.vstemplate | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate index 1828d36e4..7eda1ca29 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/cppwinrt_StaticLibrary.vstemplate @@ -25,10 +25,6 @@ readme.txt - - Microsoft.VisualStudio.WinRT.TemplateWizards, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - Microsoft.VisualStudio.WinRT.TemplateWizards.CreateProjectCertificate.Wizard - Microsoft.VisualStudio.Universal.TemplateWizards, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Microsoft.VisualStudio.Universal.TemplateWizards.PlatformVersion.Wizard From c35d3246fea00de6f9a6ac27f50711fcb1d927eb Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 29 Oct 2019 08:19:07 -0700 Subject: [PATCH 4/6] Replace url everywhere. --- nuget/readme.txt | 2 +- test/nuget/TestApp/PropertySheet.props | 2 +- test/nuget/TestRuntimeComponent1/PropertySheet.props | 2 +- test/nuget/TestRuntimeComponent2/PropertySheet.props | 2 +- test/nuget/TestRuntimeComponent3/PropertySheet.props | 2 +- test/nuget/TestRuntimeComponentEmpty/PropertySheet.props | 2 +- .../VC/Windows Desktop/ConsoleApplication/PropertySheet.props | 2 +- .../VC/Windows Desktop/WindowsApplication/PropertySheet.props | 2 +- .../VC/Windows Universal/BlankApp/PropertySheet.props | 2 +- .../VC/Windows Universal/CoreApp/PropertySheet.props | 2 +- .../VC/Windows Universal/StaticLibrary/PropertySheet.props | 2 +- .../WindowsRuntimeComponent/PropertySheet.props | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nuget/readme.txt b/nuget/readme.txt index 72f7420c1..f02528ba8 100644 --- a/nuget/readme.txt +++ b/nuget/readme.txt @@ -18,5 +18,5 @@ In addition, C++/WinRT generates templates and skeleton implementations for each ======================================================================== For more information, visit: -https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget +https://github.com/Microsoft/cppwinrt/tree/master/nuget ======================================================================== diff --git a/test/nuget/TestApp/PropertySheet.props b/test/nuget/TestApp/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/test/nuget/TestApp/PropertySheet.props +++ b/test/nuget/TestApp/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/test/nuget/TestRuntimeComponent1/PropertySheet.props b/test/nuget/TestRuntimeComponent1/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/test/nuget/TestRuntimeComponent1/PropertySheet.props +++ b/test/nuget/TestRuntimeComponent1/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/test/nuget/TestRuntimeComponent2/PropertySheet.props b/test/nuget/TestRuntimeComponent2/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/test/nuget/TestRuntimeComponent2/PropertySheet.props +++ b/test/nuget/TestRuntimeComponent2/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/test/nuget/TestRuntimeComponent3/PropertySheet.props b/test/nuget/TestRuntimeComponent3/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/test/nuget/TestRuntimeComponent3/PropertySheet.props +++ b/test/nuget/TestRuntimeComponent3/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/test/nuget/TestRuntimeComponentEmpty/PropertySheet.props b/test/nuget/TestRuntimeComponentEmpty/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/test/nuget/TestRuntimeComponentEmpty/PropertySheet.props +++ b/test/nuget/TestRuntimeComponentEmpty/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/PropertySheet.props index c6b0691dd..b0c622690 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Desktop/ConsoleApplication/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/PropertySheet.props b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/PropertySheet.props index 5942ba395..e34141b01 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/PropertySheet.props +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/PropertySheet.props @@ -9,7 +9,7 @@ * select the C++/WinRT property page For more advanced scenarios, and complete documentation, please see: - https://github.com/Microsoft/xlang/tree/master/src/package/cppwinrt/nuget + https://github.com/Microsoft/cppwinrt/tree/master/nuget --> From 559734bf4195ad41f9c96e6364bdd7bebed33c5a Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 29 Oct 2019 08:22:01 -0700 Subject: [PATCH 5/6] ALso add flags here. --- .../VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj index ec6d58e0f..e619fe0b3 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/StaticLibrary.vcxproj @@ -83,7 +83,7 @@ /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) - _WINRT_DLL;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions) $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) From ee4fa8cac4a2dca9f7afea9683707041ca7f3948 Mon Sep 17 00:00:00 2001 From: Johan Laanstra Date: Tue, 29 Oct 2019 08:23:44 -0700 Subject: [PATCH 6/6] Fix typo. --- .../VC/Windows Universal/StaticLibrary/readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt index 921f71d77..64228f81d 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/readme.txt @@ -6,8 +6,8 @@ This project demonstrates how to get started authoring Windows Runtime classes directly with standard C++, using the C++/WinRT SDK component to generate implementation headers from interface (IDL) files. The generated static library should be consumed by a single Runtime Component -or App project and the and types will automatically be added to that -binary. +or App project and the types will automatically be added to that binary. + To be able to instantiate types from the static library you need to update the activation factory in the consuming binary to call the activation factory exposed by this static library using code similar to: