Skip to content

Commit e504a0e

Browse files
authored
Set Private to false for specific projects instead of everything. (#704)
1 parent 2a0a7fa commit e504a0e

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

nuget/CppWinrtRules.Project.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,9 @@
7676
Description="Enables or disables the generation of Windows Metadata"
7777
Category="General" />
7878

79+
<BoolProperty Name="CppWinRTEnableDefaultPrivateFalse"
80+
DisplayName="Enable Copy Local Defaults"
81+
Description="Enables or disables the default for copying binaries to the output folder"
82+
Category="General" />
83+
7984
</Rule>

nuget/Microsoft.Windows.CppWinRT.props

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
2323
<WinMDAssembly>true</WinMDAssembly>
2424
<!--Set a value to prevent SDK's uap.props from setting it and pointing to the wrong headers-->
2525
<CppWinRT_IncludePath>PreventSdkUapPropsAssignment</CppWinRT_IncludePath>
26+
<CppWinRTEnableDefaultPrivateFalse Condition="'$(CppWinRTEnableDefaultPrivateFalse)' == ''"></CppWinRTEnableDefaultPrivateFalse>
2627
</PropertyGroup>
2728

2829
<ItemDefinitionGroup>
@@ -43,19 +44,17 @@ Copyright (C) Microsoft Corporation. All rights reserved.
4344
<ProxyFileName Condition="'%(Midl.ProxyFileName)'==''">nul</ProxyFileName>
4445
<TypeLibraryName Condition="'%(Midl.TypeLibraryName)'==''"></TypeLibraryName>
4546
</Midl>
46-
<ProjectReference Condition="'$(XamlLanguage)' != 'C++'">
47+
<ProjectReference Condition="'$(XamlLanguage)' != 'C++' and '$(CppWinRTEnableDefaultPrivateFalse)' == 'true'">
4748
<!-- By default, for a C++/WinRT project,
4849
don't copy project reference output to the output directory
49-
of the current project unless this is an exe. -->
50-
<Private>false</Private>
51-
<Private Condition="'$(ConfigurationType)' == 'Application' or '$(OutputType)'=='winexe' or '$(OutputType)'=='exe' or '$(OutputType)'=='appcontainerexe'">true</Private>
50+
of the current project for projects that are not an exe. -->
51+
<Private Condition=" and '$(ConfigurationType)' != 'Application' and '$(OutputType)'!='winexe' and '$(OutputType)'!='exe' and '$(OutputType)'!='appcontainerexe'">false</Private>
5252
</ProjectReference>
53-
<Reference Condition="'$(XamlLanguage)' != 'C++'">
53+
<Reference Condition="'$(XamlLanguage)' != 'C++' and '$(CppWinRTEnableDefaultPrivateFalse)' == 'true'">
5454
<!-- By default, for a C++/WinRT project,
5555
don't copy reference output to the output directory
56-
of the current project unless this is an exe. -->
57-
<Private>false</Private>
58-
<Private Condition="'$(ConfigurationType)' == 'Application' or '$(OutputType)'=='winexe' or '$(OutputType)'=='exe' or '$(OutputType)'=='appcontainerexe'">true</Private>
56+
of the current project for projects that are not an exe. -->
57+
<Private Condition=" and '$(ConfigurationType)' != 'Application' and '$(OutputType)'!='winexe' and '$(OutputType)'!='exe' and '$(OutputType)'!='appcontainerexe'">false</Private>
5958
</Reference>
6059
</ItemDefinitionGroup>
6160

nuget/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ C++/WinRT behavior can be customized with these project properties:
6868
| CppWinRTProjectLanguage | C++/CX \| *C++/WinRT | Selects the C++ dialect for the project. C++/WinRT provides full projection support, C++/CX permits consuming projection headers. |
6969
| CppWinRTOptimized | true \| *false | Enables component projection [optimization features](https://kennykerr.ca/2019/06/07/cppwinrt-optimizing-components/) |
7070
| CppWinRTGenerateWindowsMetadata | true \| *false | Indicates whether this project produces Windows Metadata |
71+
| CppWinRTEnableDefaultPrivateFalse | true \| *false | Indicates whether this project uses C++/WinRT optimized default for copying binaries to the output directory |
7172
\*Default value
7273

7374
To customize common C++/WinRT project properties:

0 commit comments

Comments
 (0)