diff --git a/nuget/Microsoft.Windows.CppWinRT.targets b/nuget/Microsoft.Windows.CppWinRT.targets
index 2a4ba0928..2157cf355 100644
--- a/nuget/Microsoft.Windows.CppWinRT.targets
+++ b/nuget/Microsoft.Windows.CppWinRT.targets
@@ -67,7 +67,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
CppWinRTCopyWinMDToOutputDirectory;
- $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTRemoveStaticLibraries;
+ $(ResolveAssemblyReferencesDependsOn);GetCppWinRTProjectWinMDReferences;CppWinRTMarkStaticLibrariesPrivate;
@@ -204,15 +204,18 @@ Copyright (C) Microsoft Corporation. All rights reserved.
-
-
+
- <_ResolvedProjectReferencePaths Remove="@(_ResolvedProjectReferencePaths)" Condition="'%(_ResolvedProjectReferencePaths.ProjectType)' == 'StaticLibrary'" />
+ <_ResolvedProjectReferencePaths Condition="'%(_ResolvedProjectReferencePaths.ProjectType)' == 'StaticLibrary'">
+ false
+
diff --git a/test/nuget/NuGetTest.sln b/test/nuget/NuGetTest.sln
index c8d379576..11490b8c0 100644
--- a/test/nuget/NuGetTest.sln
+++ b/test/nuget/NuGetTest.sln
@@ -39,6 +39,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRuntimeComponentCSharp"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRuntimeComponentNamespaceUnderscore", "TestRuntimeComponentNamespaceUnderscore\TestRuntimeComponentNamespaceUnderscore.vcxproj", "{8717FA32-34A8-457D-B77B-AE005703EB55}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRuntimeComponentCXReferencingWinRTStaticLibrary", "TestRuntimeComponentCXReferencingWinRTStaticLibrary\TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj", "{FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestStaticLibrary7", "TestStaticLibrary7\TestStaticLibrary7.vcxproj", "{F89C2185-7834-443D-A449-53BD52FFEA3B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@@ -253,6 +257,36 @@ Global
{8717FA32-34A8-457D-B77B-AE005703EB55}.Release|x64.Build.0 = Release|x64
{8717FA32-34A8-457D-B77B-AE005703EB55}.Release|x86.ActiveCfg = Release|Win32
{8717FA32-34A8-457D-B77B-AE005703EB55}.Release|x86.Build.0 = Release|Win32
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|ARM.ActiveCfg = Debug|ARM
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|ARM.Build.0 = Debug|ARM
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|ARM64.Build.0 = Debug|ARM64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|x64.ActiveCfg = Debug|x64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|x64.Build.0 = Debug|x64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|x86.ActiveCfg = Debug|Win32
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Debug|x86.Build.0 = Debug|Win32
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|ARM.ActiveCfg = Release|ARM
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|ARM.Build.0 = Release|ARM
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|ARM64.ActiveCfg = Release|ARM64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|ARM64.Build.0 = Release|ARM64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|x64.ActiveCfg = Release|x64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|x64.Build.0 = Release|x64
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|x86.ActiveCfg = Release|Win32
+ {FF846D79-F4B8-495A-9FB4-79BAAEB98E4F}.Release|x86.Build.0 = Release|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|ARM.ActiveCfg = Debug|ARM
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|ARM.Build.0 = Debug|ARM
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|ARM64.ActiveCfg = Debug|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|x64.ActiveCfg = Debug|x64
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|x64.Build.0 = Debug|x64
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|x86.ActiveCfg = Debug|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Debug|x86.Build.0 = Debug|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|ARM.ActiveCfg = Release|ARM
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|ARM.Build.0 = Release|ARM
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|ARM64.ActiveCfg = Release|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|x64.ActiveCfg = Release|x64
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|x64.Build.0 = Release|x64
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|x86.ActiveCfg = Release|Win32
+ {F89C2185-7834-443D-A449-53BD52FFEA3B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.cpp b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.cpp
new file mode 100644
index 000000000..854f556c1
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.cpp
@@ -0,0 +1,10 @@
+#include "pch.h"
+#include "CxClass.h"
+
+using namespace TestRuntimeComponentCXLibrary;
+using namespace Platform;
+
+CxClass::CxClass(TestStaticLibrary7Class^ c)
+{
+ c->Test();
+}
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.h b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.h
new file mode 100644
index 000000000..d670927be
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/CxClass.h
@@ -0,0 +1,10 @@
+#pragma once
+
+namespace TestRuntimeComponentCXLibrary
+{
+ public ref class CxClass sealed
+ {
+ public:
+ CxClass(TestStaticLibrary7Class^ c);
+ };
+}
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj
new file mode 100644
index 000000000..8864e69c1
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj
@@ -0,0 +1,295 @@
+
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ ARM64
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ ARM64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {ff846d79-f4b8-495a-9fb4-79baaeb98e4f}
+ WindowsRuntimeComponent
+ TestRuntimeComponentCXLibrary
+ en-US
+ 14.0
+ true
+ Windows Store
+ 10.0.18362.0
+ 10.0.18362.0
+ 10.0
+ C++/CX
+
+
+
+ DynamicLibrary
+ true
+ v142
+
+
+ DynamicLibrary
+ true
+ v142
+
+
+ DynamicLibrary
+ true
+ v142
+
+
+ DynamicLibrary
+ true
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ v142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ false
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+ {f89c2185-7834-443d-a449-53bd52ffea3b}
+
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj.filters b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj.filters
new file mode 100644
index 000000000..498c22c80
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj.filters
@@ -0,0 +1,17 @@
+
+
+
+
+ 33c7d878-02cf-43df-95d8-793bec934cba
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.cpp b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.cpp
new file mode 100644
index 000000000..bcb5590be
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.cpp
@@ -0,0 +1 @@
+#include "pch.h"
diff --git a/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.h b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.h
new file mode 100644
index 000000000..10fe677c7
--- /dev/null
+++ b/test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/pch.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#include
+#include
diff --git a/test/nuget/TestStaticLibrary7/PropertySheet.props b/test/nuget/TestStaticLibrary7/PropertySheet.props
new file mode 100644
index 000000000..e34141b01
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/PropertySheet.props
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj b/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj
new file mode 100644
index 000000000..42ce830b6
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj
@@ -0,0 +1,148 @@
+
+
+
+
+ true
+ true
+ true
+ -lib $(MSBuildProjectName)
+ true
+ {f89c2185-7834-443d-a449-53bd52ffea3b}
+ TestStaticLibrary7
+ TestRuntimeComponentCXLibrary
+ en-US
+ 14.0
+ true
+ Windows Store
+ 10.0
+ 10.0.18362.0
+ 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)
+
+
+ WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+
+
+ Console
+ false
+ TestStaticLibrary7.def
+
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ true
+ true
+
+
+
+
+
+ TestStaticLibrary7Class.idl
+
+
+
+
+ Create
+
+
+ TestStaticLibrary7Class.idl
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj.filters b/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj.filters
new file mode 100644
index 000000000..5ea9b8391
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/TestStaticLibrary7.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ 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}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.cpp b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.cpp
new file mode 100644
index 000000000..f4a5d5648
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.cpp
@@ -0,0 +1,14 @@
+#include "pch.h"
+#include "TestStaticLibrary7Class.h"
+#include "TestStaticLibrary7Class.g.cpp"
+
+using namespace winrt;
+using namespace winrt::Windows::UI::Xaml::Core::Direct;
+
+namespace winrt::TestRuntimeComponentCXLibrary::implementation
+{
+ XamlDirect TestStaticLibrary7Class::Test()
+ {
+ return XamlDirect::GetDefault();
+ }
+}
diff --git a/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.h b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.h
new file mode 100644
index 000000000..c9fe192ea
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "TestStaticLibrary7Class.g.h"
+
+namespace winrt::TestRuntimeComponentCXLibrary::implementation
+{
+ struct TestStaticLibrary7Class : TestStaticLibrary7ClassT
+ {
+ TestStaticLibrary7Class() = default;
+
+ Windows::UI::Xaml::Core::Direct::XamlDirect Test();
+ };
+}
+
+namespace winrt::TestRuntimeComponentCXLibrary::factory_implementation
+{
+ struct TestStaticLibrary7Class : TestStaticLibrary7ClassT
+ {
+ };
+}
diff --git a/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.idl b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.idl
new file mode 100644
index 000000000..93e060572
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/TestStaticLibrary7Class.idl
@@ -0,0 +1,10 @@
+namespace TestRuntimeComponentCXLibrary
+{
+ [default_interface]
+ runtimeclass TestStaticLibrary7Class
+ {
+ TestStaticLibrary7Class();
+
+ Windows.UI.Xaml.Core.Direct.XamlDirect Test();
+ }
+}
diff --git a/test/nuget/TestStaticLibrary7/packages.config b/test/nuget/TestStaticLibrary7/packages.config
new file mode 100644
index 000000000..c4867c30b
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/test/nuget/TestStaticLibrary7/pch.cpp b/test/nuget/TestStaticLibrary7/pch.cpp
new file mode 100644
index 000000000..bcb5590be
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/pch.cpp
@@ -0,0 +1 @@
+#include "pch.h"
diff --git a/test/nuget/TestStaticLibrary7/pch.h b/test/nuget/TestStaticLibrary7/pch.h
new file mode 100644
index 000000000..3c56f10ed
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/pch.h
@@ -0,0 +1,6 @@
+#pragma once
+#include
+#include
+#include
+
+#include
diff --git a/test/nuget/TestStaticLibrary7/readme.txt b/test/nuget/TestStaticLibrary7/readme.txt
new file mode 100644
index 000000000..061d7a558
--- /dev/null
+++ b/test/nuget/TestStaticLibrary7/readme.txt
@@ -0,0 +1,44 @@
+========================================================================
+ C++/WinRT TestStaticLibrary7 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 static library should be consumed by a single Runtime Component
+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:
+
+void* __stdcall TestStaticLibrary7_get_activation_factory(
+ std::wstring_view const& name);
+
+void* __stdcall winrt_get_activation_factory(
+ std::wstring_view const& name)
+{
+ void* factory = TestStaticLibrary7_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,
+ 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/
+========================================================================