-
Notifications
You must be signed in to change notification settings - Fork 107
/
Microsoft.Windows.CsWinRT.targets
376 lines (323 loc) · 24.1 KB
/
Microsoft.Windows.CsWinRT.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<!--
***********************************************************************************************
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CsWinRTMessageImportance Condition="'$(CsWinRTMessageImportance)' == ''">normal</CsWinRTMessageImportance>
<CsWinRTCommandVerbosity Condition="'$(CsWinRTMessageImportance)' == 'high'">-verbose</CsWinRTCommandVerbosity>
<ResolveAssemblyReferencesDependsOn Condition="'$(CsWinRTRemoveWindowsReference)'!='false'">$(ResolveAssemblyReferencesDependsOn);CsWinRTRemoveWindowsReference</ResolveAssemblyReferencesDependsOn>
<CsWinRTEnabled Condition="'$(CsWinRTEnabled)' == ''">true</CsWinRTEnabled>
<CsWinRTEnabled Condition="'$(CsWinRTEnabled)' != 'true'">false</CsWinRTEnabled>
<CsWinRTGenerateProjection Condition="!$(CsWinRTEnabled)">false</CsWinRTGenerateProjection>
<CsWinRTGenerateProjection Condition="'$(CsWinRTGenerateProjection)' == ''">true</CsWinRTGenerateProjection>
<AllowUnsafeBlocks Condition="$(CsWinRTEnabled)">true</AllowUnsafeBlocks>
<!-- Making sure ResolveAssemblyReferences runs before CoreCompile runs as we have seen it not run in WPF scenarios
causing for our targeting pack to not get included or conflicts to be resolved. -->
<CoreCompileDependsOn>ResolveAssemblyReferences;CsWinRTIncludeProjection;CsWinRTRemoveWinMDReferences;$(CoreCompileDependsOn)</CoreCompileDependsOn>
<TrackFileAccess Condition="'$(CsWinRTComponent)' != 'true'">false</TrackFileAccess>
<CsWinRTAotOptimizerEnabled Condition="'$(CsWinRTAotOptimizerEnabled)' == '' and $([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 6">true</CsWinRTAotOptimizerEnabled>
<!--
If the AOT optimizer is enabled, and we're publishing with NativeAOT, automatically set CsWinRTAotExportsEnabled as well.
Only do this if the property is not already set by the user, so we respect any existing preference.
-->
<CsWinRTAotExportsEnabled Condition="'$(CsWinRTAotExportsEnabled)' == '' and '$(CsWinRTAotOptimizerEnabled)' == 'true' and '$(PublishAot)' == 'true'">true</CsWinRTAotExportsEnabled>
<CsWinRTAotExportsEnabled Condition="'$(CsWinRTAotExportsEnabled)' != 'true'">false</CsWinRTAotExportsEnabled>
<!-- Set the RCW factory fallback generator to not be opt-in by default -->
<CsWinRTRcwFactoryFallbackGeneratorForceOptIn Condition="'$(CsWinRTRcwFactoryFallbackGeneratorForceOptIn)' != 'true'">false</CsWinRTRcwFactoryFallbackGeneratorForceOptIn>
<CsWinRTRcwFactoryFallbackGeneratorForceOptOut Condition="'$(CsWinRTRcwFactoryFallbackGeneratorForceOptOut)' != 'true'">false</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
<!--
These properties are defined in this property group and not in the 'CsWinRTGenerateProjection'
target, because they are also needed in authoring scenarios (which will not run that target).
-->
<CsWinRTExeTFM Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) == 5">net5.0</CsWinRTExeTFM>
<CsWinRTExeTFM Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) == 6">net6.0</CsWinRTExeTFM>
<CsWinRTExeTFM Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) == 7">net7.0</CsWinRTExeTFM>
<CsWinRTExeTFM Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">net8.0</CsWinRTExeTFM>
<CsWinRTExeTFM Condition="'$(CsWinRTExeTFM)' == ''">netstandard2.0</CsWinRTExeTFM>
<CsWinRTWindowsMetadata Condition="'$(CsWinRTWindowsMetadata)' == ''">$(WindowsSDKVersion.TrimEnd('\'))</CsWinRTWindowsMetadata>
<CsWinRTWindowsMetadata Condition="'$(CsWinRTWindowsMetadata)' == ''">$(TargetPlatformVersion)</CsWinRTWindowsMetadata>
</PropertyGroup>
<ItemGroup>
<CompilerVisibleProperty Include="CsWinRTAotOptimizerEnabled" />
<CompilerVisibleProperty Include="CsWinRTAotExportsEnabled" />
<CompilerVisibleProperty Include="CsWinRTRcwFactoryFallbackGeneratorForceOptIn" />
<CompilerVisibleProperty Include="CsWinRTRcwFactoryFallbackGeneratorForceOptOut" />
<CompilerVisibleProperty Include="CsWinRTCcwLookupTableGeneratorEnabled" />
<CompilerVisibleProperty Include="CsWinRTMergeReferencedActivationFactories" />
<CompilerVisibleProperty Include="CsWinRTAotWarningLevel" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Embedded.targets" Condition="'$(CsWinRTEmbedded)' == 'true'"/>
<Target Name="CsWinRTNet5EOL" Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) == 5" BeforeTargets="CsWinRTPrepareProjection">
<Error Text="Support for .NET 5 ended with C#/WinRT 2.0. For .NET 5 support, use C#/WinRT version 1.6.5. See https://github.com/microsoft/CsWinRT/discussions/1232" />
</Target>
<!-- Note this runs before the msbuild editor config file is generated because that is what is used to pass properties to the source generator. -->
<Target Name="CsWinRTSetGeneratorProperties" BeforeTargets="GenerateMSBuildEditorConfigFile;GenerateMSBuildEditorConfigFileCore">
<PropertyGroup>
<CsWinRTCcwLookupTableGeneratorEnabled Condition="'$(CsWinRTCcwLookupTableGeneratorEnabled)' == '' and
'$(CsWinRTComponent)' == 'true'">true</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
Back-compat: first check whether 'CsWinRTIncludes' is set to a list of items.
If so, this check will set 'CsWinRTHasAnyIncludes' to 'true', and we're done.
We also check 'CsWinRTFilters' from here: setting either one is sufficient.
-->
<CsWinRTHasAnyIncludes>false</CsWinRTHasAnyIncludes>
<CsWinRTHasAnyIncludes Condition="'@(CsWinRTIncludes)' != '' or $(CsWinRTFilters.Contains('-include'))">true</CsWinRTHasAnyIncludes>
<!--
If 'CsWinRTHasAnyIncludes' is 'false', but 'CsWinRTIncludes' is not actually empty, treat it as
a 'string', and also account for people formatting it over multiple lines in the .csproj files.
That is, we trim it and remove all newline characters, and then check whether the result is not
empty. If not, then we do have some WinRT includes.
This handles eg. Win2D setting this property like so:
'''
<CSWinRTIncludes>
Microsoft.Graphics.Canvas;
</CSWinRTIncludes>
'''
-->
<CsWinRTIncludesWithFixup Condition="'$(CsWinRTHasAnyIncludes)' == 'false'">$(CSWinRTIncludes)</CsWinRTIncludesWithFixup>
<CsWinRTIncludesWithFixup Condition="'$(CsWinRTHasAnyIncludes)' == 'false'">$(CsWinRTIncludesWithFixup.Trim())</CsWinRTIncludesWithFixup>
<CsWinRTIncludesWithFixup Condition="'$(CsWinRTHasAnyIncludes)' == 'false'">$([System.Text.RegularExpressions.Regex]::Replace($(CsWinRTIncludesWithFixup), '[\r\n]', ''))</CsWinRTIncludesWithFixup>
<CsWinRTHasAnyIncludes Condition="'$(CsWinRTIncludesWithFixup)' != ''">true</CsWinRTHasAnyIncludes>
<!--
If the lookup generator is enabled, the AOT source generator generates vtable entries for generic types and boxing scenarios that it detects.
This is not intended to be ran on projections, so we try to detect that and disable it if a projection is being generated.
-->
<CsWinRTCcwLookupTableGeneratorEnabled Condition="'$(CsWinRTCcwLookupTableGeneratorEnabled)' == '' and
'$(CsWinRTGenerateProjection)' == 'true' and
'$(OutputType)' == 'Library' and
'$(CsWinRTHasAnyIncludes)' == 'true'">false</CsWinRTCcwLookupTableGeneratorEnabled>
<CsWinRTCcwLookupTableGeneratorEnabled Condition="'$(CsWinRTCcwLookupTableGeneratorEnabled)' == ''">true</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
CsWinRTAotWarningLevel decides the level of warning from the AOT analyzer.
0: No warnings
*1: Warnings for scenarios involving WinRT types that are not built-in system types mapped to WinRT.
2: Level 1 warnings and warnings for scenarios involving built-in system types mapped to WinRT.
This is not intended to be ran on projections, so we try to detect that and disable it if a projection is being generated.
Level 1 is currently the default to avoid noise from built-in system types that might not be used in WinRT scenarios
but level 2 should be enabled and the warnings from it should be evaluated to ensure AOT and trimming compatibility.
Level 2 might be made the default in the future.
-->
<CsWinRTAotWarningLevel Condition="'$(CsWinRTAotWarningLevel)' == '' and
'$(CsWinRTGenerateProjection)' == 'true' and
'$(OutputType)' == 'Library' and
'$(CsWinRTHasAnyIncludes)' == 'true'">0</CsWinRTAotWarningLevel>
<CsWinRTAotWarningLevel Condition="'$(CsWinRTAotWarningLevel)' == ''">1</CsWinRTAotWarningLevel>
</PropertyGroup>
</Target>
<!-- Remove WinRT.Host.dll and WinRT.Host.Shim.dll references -->
<Target Name="CsWinRTRemoveHostingDllReferences" AfterTargets="ResolvePackageAssets" BeforeTargets="ResolveLockFileAnalyzers" Outputs="@(Reference)">
<PropertyGroup>
<CsWinRTPkg-Net6Dir>$(CsWinRTPath)lib\net6.0</CsWinRTPkg-Net6Dir>
<CsWinRTPkg-NativeDir>$(CsWinRTPath)runtimes\**\native</CsWinRTPkg-NativeDir>
</PropertyGroup>
<ItemGroup>
<ReferenceCopyLocalPaths Remove="$(CsWinRTPkg-NativeDir)\WinRT.Host.dll"/>
<RuntimeCopyLocalItems Remove="$(CsWinRTPkg-NativeDir)\WinRT.Host.dll"/>
<RuntimeTargetsCopyLocalItems Remove="$(CsWinRTPkg-NativeDir)\WinRT.Host.dll"/>
<Reference Remove="$(CsWinRTPkg-Net6Dir)\WinRT.Host.Shim.dll"/>
<ResolvedCompileFileDefinitions Remove="$(CsWinRTPkg-Net6Dir)\WinRT.Host.Shim.dll"/>
<RuntimeCopyLocalItems Remove="$(CsWinRTPkg-Net6Dir)\WinRT.Host.Shim.dll"/>
</ItemGroup>
</Target>
<!-- Remove Windows.Winmd reference to prevent compile collisions-->
<Target Name="CsWinRTRemoveWindowsReference" Outputs="@(Reference)" Condition="$(CsWinRTEnabled)">
<ItemGroup>
<Reference Remove="Windows"/>
</ItemGroup>
</Target>
<Target Name="CsWinRTRemoveWinMDReferences" BeforeTargets="BeforeCompile" AfterTargets="ResolveReferences">
<ItemGroup>
<!--Move winmd references into private item group to prevent subsequent winmd reference errors-->
<CsWinRTRemovedReferences Include="@(ReferencePath)" Condition="'%(ReferencePath.Extension)' == '.winmd'" />
<CsWinRTInputs Include="@(CsWinRTRemovedReferences)"/>
<!--Prevent NETSDK1130 errors from winmd references-->
<ReferencePath Remove="@(ReferencePath)" Condition="'%(ReferencePath.Extension)' == '.winmd'" />
<ReferencePathWithRefAssemblies Remove="@(CsWinRTRemovedReferences)"
Condition="'%(CsWinRTRemovedReferences.Filename)%(CsWinRTRemovedReferences.Extension)' == '%(ReferencePathWithRefAssemblies.Filename)%(ReferencePathWithRefAssemblies.Extension)'" />
<!--Do not publish projection source winmds, but do include implementation dlls -->
<ReferenceCopyLocalPaths Remove="@(CsWinRTRemovedReferences)" />
<ReferenceCopyLocalPaths Include="@(CsWinRTRemovedReferences->'%(RootDir)%(Directory)%(DestinationSubDirectory)%(Implementation)')"
Condition="'%(CsWinRTRemovedReferences.Implementation)' != '' AND Exists('%(CsWinRTRemovedReferences.RootDir)%(CsWinRTRemovedReferences.Directory)%(CsWinRTRemovedReferences.DestinationSubDirectory)%(CsWinRTRemovedReferences.Implementation)')" />
<!--Remove winmd references from deps.json to prevent CLR failing unit test execution-->
<ReferenceDependencyPaths Remove="@(ReferenceDependencyPaths)" Condition="%(ReferenceDependencyPaths.Extension) == '.winmd'"/>
</ItemGroup>
</Target>
<Target Name="CsWinRTPrepareProjection" DependsOnTargets="$(CsWinRTPrepareProjectionDependsOn)" Outputs="$(CsWinRTGeneratedFilesDir)">
<PropertyGroup>
<CsWinRTGeneratedFilesDir Condition="'$(CsWinRTGeneratedFilesDir)' == '' and '$(GeneratedFilesDir)' != ''">$(GeneratedFilesDir)\CsWinRT\</CsWinRTGeneratedFilesDir>
<CsWinRTGeneratedFilesDir Condition="'$(CsWinRTGeneratedFilesDir)' == ''">$([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', 'Generated Files', 'CsWinRT'))</CsWinRTGeneratedFilesDir>
</PropertyGroup>
</Target>
<Target Name="CsWinRTCleanGenerateProjectionOutputs">
<Delete Files="$(CsWinRTGeneratedFilesDir)cswinrt.rsp" />
<Delete Files="$(CsWinRTGeneratedFilesDir)cswinrt_internal.rsp" />
</Target>
<Target Name="CsWinRTGenerateProjection"
DependsOnTargets="CsWinRTPrepareProjection;CsWinRTRemoveWinMDReferences"
Condition="'$(CsWinRTGenerateProjection)' == 'true'"
Inputs="$(MSBuildAllProjects);@(CsWinRTInputs);$(CsWinRTExe)"
Outputs="$(CsWinRTGeneratedFilesDir)cswinrt.rsp">
<PropertyGroup>
<CsWinRTResponseFile>$(CsWinRTGeneratedFilesDir)cswinrt.rsp</CsWinRTResponseFile>
<CsWinRTResponseFilePrivateProjection>$(CsWinRTGeneratedFilesDir)cswinrt_internal.rsp</CsWinRTResponseFilePrivateProjection>
<!-- %40 is an MSBuild escape code for the @ character;
https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2015/msbuild/msbuild-special-characters?view=vs-2015&redirectedfrom=MSDN
-->
<CsWinRTCommand>"$(CsWinRTExe)" %40"$(CsWinRTResponseFile)"</CsWinRTCommand>
<CsWinRTCommandPrivateProjection>"$(CsWinRTExe)" %40"$(CsWinRTResponseFilePrivateProjection)"</CsWinRTCommandPrivateProjection>
<CsWinRTWindowsMetadataInput Condition="'$(CsWinRTWindowsMetadata)' != ''">-input $(CsWinRTWindowsMetadata)</CsWinRTWindowsMetadataInput>
</PropertyGroup>
<ItemGroup>
<CsWinRTDetectWindowsMetadata Include="@(CsWinRTInputs)" Condition="'%(CsWinRTInputs.Filename)%(CsWinRTInputs.Extension)' == 'Windows.Foundation.FoundationContract.winmd'"></CsWinRTDetectWindowsMetadata>
<CsWinRTDetectWindowsMetadata Include="@(CsWinRTInputs)" Condition="'%(CsWinRTInputs.Filename)%(CsWinRTInputs.Extension)' == 'Windows.winmd'"></CsWinRTDetectWindowsMetadata>
</ItemGroup>
<Error Condition="'$(CsWinRTParams)$(CsWinRTFilters)$(CsWinRTWindowsMetadata)@(CsWinRTDetectWindowsMetadata)' == ''"
Text="Windows Metadata not provided or detected. See https://github.com/microsoft/CsWinRT/tree/master/nuget/readme.md" />
<PropertyGroup>
<CsWinRTExcludes Condition="'$(CsWinRTExcludes)' == ''">Windows;Microsoft</CsWinRTExcludes>
<CsWinRTExcludesPrivate Condition="'$(CsWinRTExcludesPrivate)' == ''">Windows;Microsoft</CsWinRTExcludesPrivate>
</PropertyGroup>
<!-- Inputs set by users -->
<ItemGroup>
<CsWinRTExcludePrivateItems Include="$(CsWinRTExcludesPrivate)"/>
<CsWinRTIncludePrivateItems Include="$(CsWinRTIncludesPrivate)"/>
</ItemGroup>
<ItemGroup>
<CsWinRTExcludeItems Include="$(CsWinRTExcludes)"/>
<CsWinRTIncludeItems Include="$(CsWinRTIncludes)"/>
</ItemGroup>
<PropertyGroup>
<CsWinRTPrivateFilters Condition="'$(CsWinRTPrivateFilters)' == ''">
@(CsWinRTExcludePrivateItems->'-exclude %(Identity)', '
')
@(CsWinRTIncludePrivateItems->'-include %(Identity)', '
')
</CsWinRTPrivateFilters>
<CsWinRTFilters Condition="'$(CsWinRTFilters)' == ''">
@(CsWinRTExcludeItems->'-exclude %(Identity)', '
')
@(CsWinRTIncludeItems->'-include %(Identity)', '
')
</CsWinRTFilters>
<CsWinRTInteropMetadata Condition="'$(CsWinRTInteropMetadata)' == ''">$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..\metadata\WinRT.Interop.winmd'))</CsWinRTInteropMetadata>
<CsWinRTIncludeWinRTInterop Condition="$(CsWinRTFilters.Contains('-include Windows
')) or $(CsWinRTFilters.Contains('-include Windows
'))">
-input $(CsWinRTInteropMetadata)
-include WinRT.Interop
</CsWinRTIncludeWinRTInterop>
<CsWinRTPrivateIncludeWinRTInterop Condition="$(CsWinRTPrivateFilters.Contains('-include Windows
')) or $(CsWinRTPrivateFilters.Contains('-include Windows
'))">
-input $(CsWinRTInteropMetadata)
-include WinRT.Interop
</CsWinRTPrivateIncludeWinRTInterop>
<CsWinRTInternalProjection Condition="'$(CsWinRTPrivateProjection)' == 'true'">-internal</CsWinRTInternalProjection>
<CsWinRTEmbeddedProjection Condition="'$(CsWinRTEmbedded)' == 'true'">-embedded</CsWinRTEmbeddedProjection>
<CsWinRTEmbeddedEnums Condition="'$(CsWinRTEmbeddedPublicEnums)' == 'true'">-public_enums</CsWinRTEmbeddedEnums>
<CsWinRTPublicExclusiveTo Condition="'$(CsWinRTPublicExclusiveToInterfaces)' == 'true'">-public_exclusiveto</CsWinRTPublicExclusiveTo>
<CsWinRTDynamicallyInterfaceCastableExclusiveTo Condition="'$(CsWinRTDynamicallyInterfaceCastableExclusiveTo)' == 'true'">-idic_exclusiveto</CsWinRTDynamicallyInterfaceCastableExclusiveTo>
<CsWinRTParams Condition="'$(CsWinRTParams)' == ''">
$(CsWinRTCommandVerbosity)
-target $(CsWinRTExeTFM)
$(CsWinRTWindowsMetadataInput)
-input @(CsWinRTInputs->'"%(FullPath)"', ' ')
-output "$(CsWinRTGeneratedFilesDir.TrimEnd('\'))"
$(CsWinRTFilters)
$(CsWinRTIncludeWinRTInterop)
$(CsWinRTEmbeddedProjection)
$(CsWinRTEmbeddedEnums)
$(CsWinRTPublicExclusiveTo)
$(CsWinRTDynamicallyInterfaceCastableExclusiveTo)
</CsWinRTParams>
<CsWinRTPrivateParams Condition="'$(CsWinRTPrivateParams)' == ''">
$(CsWinRTCommandVerbosity)
-target $(CsWinRTExeTFM)
$(CsWinRTWindowsMetadataInput)
-input @(CsWinRTInputs->'"%(FullPath)"', ' ')
-output "$(CsWinRTGeneratedFilesDir.TrimEnd('\'))"
$(CsWinRTPrivateFilters)
$(CsWinRTPrivateIncludeWinRTInterop)
$(CsWinRTInternalProjection)
</CsWinRTPrivateParams>
</PropertyGroup>
<!--
During a design-time build, generation of the CsWinRT projection might fail (e.g. input .winmds might
not exist if a full build hasn't completed yet). To avoid causing a design-time build break, which can
put the design-time build results of dependent projects into a bad state, we want the build to continue
if cswinrt.exe encounters an error during a design-time build.
-->
<PropertyGroup>
<CsWinRTContinueOnError>false</CsWinRTContinueOnError>
<CsWinRTContinueOnError Condition="'$(DesignTimeBuild)' == 'true' OR '$(BuildingProject)' != 'true'">true</CsWinRTContinueOnError>
</PropertyGroup>
<ItemGroup>
<CsWinRTFilesToDelete Include="$(CsWinRTGeneratedFilesDir)*.cs"/>
</ItemGroup>
<Delete Files="@(CsWinRTFilesToDelete)" />
<MakeDir Directories="$(CsWinRTGeneratedFilesDir)" />
<WriteLinesToFile File="$(CsWinRTResponseFile)" Lines="$(CsWinRTParams)" Overwrite="true" />
<WriteLinesToFile File="$(CsWinRTResponseFilePrivateProjection)" Lines="$(CsWinRTPrivateParams)" Overwrite="true" />
<Message Text="$(CsWinRTCommand)" Importance="$(CsWinRTMessageImportance)" />
<Exec Command="$(CsWinRTCommand)" ContinueOnError="$(CsWinRTContinueOnError)" />
<Message Text="$(CsWinRTCommandPrivateProjection)" Importance="$(CsWinRTMessageImportance)" />
<Exec Command="$(CsWinRTCommandPrivateProjection)" ContinueOnError="$(CsWinRTContinueOnError)" Condition="'$(CsWinRTPrivateProjection)' == 'true'"/>
<ItemGroup Condition="'$(CsWinRTComponent)' != 'true' and Exists('$(CsWinRTResponseFile)')">
<UpToDateCheckInput Include="@(CsWinRTInputs)" Set="WinMDs" />
<UpToDateCheckInput Include="$(CsWinRTExe)" Set="WinMDs" />
<UpToDateCheckBuilt Include="$(CsWinRTResponseFile)" Set="WinMDs" />
</ItemGroup>
<!-- Clean the output file if the target failed to indicate it needs to be rebuild -->
<OnError ExecuteTargets="CsWinRTCleanGenerateProjectionOutputs" />
</Target>
<!-- Note: GenerateTargetFrameworkMonikerAttribute is conditional upon @(Compile) not being empty -->
<Target Name="CsWinRTIncludeProjection" BeforeTargets="BeforeCompile;GenerateTargetFrameworkMonikerAttribute" DependsOnTargets="CsWinRTGenerateProjection" Condition="$(CsWinRTEnabled)">
<ItemGroup>
<Compile Include="$(CsWinRTGeneratedFilesDir)*.cs" Exclude="@(Compile)" />
</ItemGroup>
</Target>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets" Condition="Exists('$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets')"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Authoring.targets" Condition="'$(CsWinRTComponent)' == 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.IIDOptimizer.targets" Condition="'$(CsWinRTIIDOptimizerOptOut)' != 'true'"/>
<!-- Default values for all custom CsWinRT runtime feature switches -->
<PropertyGroup>
<CsWinRTEnableDynamicObjectsSupport Condition="'$(CsWinRTEnableDynamicObjectsSupport)' == ''">true</CsWinRTEnableDynamicObjectsSupport>
<CsWinRTUseExceptionResourceKeys Condition="'$(CsWinRTUseExceptionResourceKeys)' == ''">false</CsWinRTUseExceptionResourceKeys>
<CsWinRTEnableDefaultCustomTypeMappings Condition="'$(CsWinRTEnableDefaultCustomTypeMappings)' == ''">true</CsWinRTEnableDefaultCustomTypeMappings>
<CsWinRTEnableICustomPropertyProviderSupport Condition="'$(CsWinRTEnableICustomPropertyProviderSupport)' == ''">true</CsWinRTEnableICustomPropertyProviderSupport>
<CsWinRTEnableIReferenceSupport Condition="'$(CsWinRTEnableIReferenceSupport)' == ''">true</CsWinRTEnableIReferenceSupport>
<CsWinRTEnableIDynamicInterfaceCastableSupport Condition="'$(CsWinRTEnableIDynamicInterfaceCastableSupport)' == ''">true</CsWinRTEnableIDynamicInterfaceCastableSupport>
<!--
Note: the 'CsWinRTUseWindowsUIXamlProjections' property and associated 'CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS' feature
switch are set by the .NET SDK, so that the right projection mode is enabled even when CsWinRT is not directly referenced.
-->
</PropertyGroup>
<!-- Default values for all other CsWinRT properties (without feature switches) -->
<PropertyGroup>
<CsWinRTMergeReferencedActivationFactories Condition="'$(CsWinRTMergeReferencedActivationFactories)' == ''">false</CsWinRTMergeReferencedActivationFactories>
</PropertyGroup>
<!--
Configuration for the feature switches (to support IL trimming).
See the 'ILLink.Substitutions.xml' file for more details on that.
-->
<ItemGroup>
<!-- CSWINRT_ENABLE_DYNAMIC_OBJECTS_SUPPORT switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_DYNAMIC_OBJECTS_SUPPORT"
Value="$(CsWinRTEnableDynamicObjectsSupport)"
Trim="true" />
<!-- CSWINRT_USE_EXCEPTION_RESOURCE_KEYS switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_USE_EXCEPTION_RESOURCE_KEYS"
Value="$(CsWinRTUseExceptionResourceKeys)"
Trim="true" />
<!-- CSWINRT_ENABLE_DEFAULT_CUSTOM_TYPE_MAPPINGS switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_DEFAULT_CUSTOM_TYPE_MAPPINGS"
Value="$(CsWinRTEnableDefaultCustomTypeMappings)"
Trim="true" />
<!-- CSWINRT_ENABLE_ICUSTOMPROPERTYPROVIDER_SUPPORT switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_ICUSTOMPROPERTYPROVIDER_SUPPORT"
Value="$(CsWinRTEnableICustomPropertyProviderSupport)"
Trim="true" />
<!-- CSWINRT_ENABLE_IREFERENCE_SUPPORT switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_IREFERENCE_SUPPORT"
Value="$(CsWinRTEnableIReferenceSupport)"
Trim="true" />
<!-- CSWINRT_ENABLE_IDYNAMICINTERFACECASTABLE switch -->
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_IDYNAMICINTERFACECASTABLE"
Value="$(CsWinRTEnableIDynamicInterfaceCastableSupport)"
Trim="true" />
</ItemGroup>
</Project>