-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Wpf.Cpp.targets
619 lines (528 loc) · 24.5 KB
/
Wpf.Cpp.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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
<Project>
<PropertyGroup>
<NativeVersionFile Condition="'$(NativeVersionFile)'==''">$(IntermediateOutputPath)NativeVersion.rc</NativeVersionFile>
<NativeVersionFileDirectory>$([System.IO.Path]::GetDirectoryName($(NativeVersionFile)))</NativeVersionFileDirectory>
<NativeResourceFileWithVersionInformation Condition="'$(NativeResourceFileWithVersionInformation)' == ''">$(IntermediateOutputPath)ExtendedNativeVersion.rc</NativeResourceFileWithVersionInformation>
</PropertyGroup>
<PropertyGroup>
<!--
Set up Directories
Must be done after importing Microsoft.Cpp.VCTools.props
-->
<VcrtLibDir>$(VCToolsInstallDir)lib\$(Architecture)\</VcrtLibDir>
<UcrtLibDir>$(UniversalCRTSdkDir)Lib\$(WindowsTargetPlatformVersion)\UCRT\$(Architecture)\</UcrtLibDir>
</PropertyGroup>
<Import Project="Wpf.Cpp.PrivateTools.targets" Condition="Exists('Wpf.Cpp.PrivateTools.targets') And '$(UsePrivateCppTools)'=='true'"/>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories Condition="Exists('$(WpfSharedDir)inc\')">%(AdditionalIncludeDirectories);$(WpfSharedDir)inc\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="Exists('$(WpfCommonDir)inc\')">%(AdditionalIncludeDirectories);$(WpfCommonDir)inc\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="Exists('$(WpfTransportedSharedDir)inc\')">%(AdditionalIncludeDirectories);$(WpfTransportedSharedDir)inc\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="Exists('$(WpfTransportedCommonDir)inc\')">%(AdditionalIncludeDirectories);$(WpfTransportedCommonDir)inc\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(NativeVersionFileDirectory);$(WpfTracingDir)native\</AdditionalIncludeDirectories>
<ForcedIncludeFiles>$(WpfSharedDir)inc\ddbanned.h</ForcedIncludeFiles>
<!--
Workaround for https://github.com/dotnet/arcade/issues/4763
Embed PDB's into the .lib files directly using /Z7 when building out of
dotnet-wpf-int repo
-->
<DebugInformationFormat Condition="'$(ManagedCxx)' != 'true' and
'$(ConfigurationType)' == '$(StaticLibrary)' and
'$(RepositoryName)' == 'dotnet-wpf-int'">oldStyle</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalLibraryDirectories Condition="('$(ExplicitCrts)'=='true')">$(VcrtLibDir);$(UcrtLibDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(NativeVersionFileDirectory)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<!--
Support for /linkrepro
-->
<ItemDefinitionGroup Condition="'$(LinkRepro)'=='true'">
<Link>
<AdditionalOptions>%(AdditionalOptions) /linkrepro:$(IntermediateOutputPath)LinkRepro</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(LinkRepro)'=='true'">
<BeforeLinkTargets>
$(BeforeLinkTargets);
CreateLinkReproFolder
</BeforeLinkTargets>
</PropertyGroup>
<Target Name="CreateLinkReproFolder"
Condition="'$(LinkRepro)'=='true'"
Returns="$(LinkReproFolder)">
<PropertyGroup>
<LinkReproFolder>$(IntermediateOutputPath)LinkRepro\</LinkReproFolder>
</PropertyGroup>
<RemoveDir Condition="Exists('$(LinkReproFolder)')"
Directories="$(LinkReproFolder)" />
<MakeDir Directories="$(LinkReproFolder)" />
<Message Text="LINK_REPRO files will be created at $(LinkReproFolder)"
Importance="high" />
</Target>
<PropertyGroup>
<BeforeClCompileTargets>
CreateNativeVersionFile;
$(BeforeClCompileTargets)
</BeforeClCompileTargets>
</PropertyGroup>
<Target Name="CreateNativeVersionFile"
BeforeTargets="ResourceCompile"
Outputs="$(NativeVersionFile)"
Condition="!Exists('$(NativeVersionFile)')">
<CallTarget Targets="GenerateNativeVersionFile" />
</Target>
<!-- Target only runs for projects that already include .rc files in their build -->
<Target Name="CreateNativeResourceFileWithVersionInformation"
AfterTargets="CreateNativeVersionFile"
BeforeTargets="ResourceCompile"
DependsOnTargets="_InitializeAssemblyVersion;InitializeSourceControlInformation"
Outputs="$(NativeResourceFileWithVersionInformation)"
Returns="@(ResourceCompile)"
Condition="('$(ConfigurationType)' == 'DynamicLibrary' Or '$(ConfigurationType)' == 'Application') And '$(IsRedistProject)' != 'true'">
<PropertyGroup>
<_NativeVersionHeader>$([System.IO.Path]::Combine('$(NativeVersionFileDirectory)', '_version.h'))</_NativeVersionHeader>
</PropertyGroup>
<Copy SourceFiles="$(NativeVersionFile)" DestinationFiles="$(_NativeVersionHeader)" SkipUnchangedFiles="true" />
<PropertyGroup>
<_WindowsFileVersion>$(FileVersion.Replace('.', ','))</_WindowsFileVersion>
<_SourceBuildInfo> %40Commit: $(SourceRevisionId)</_SourceBuildInfo>
<!-- Values from documentation for VS_FIXEDFILEINFO structure -->
<_VFT_APP>0x00000001</_VFT_APP>
<_VFT_DLL>0x00000002</_VFT_DLL>
<_VFT_UNKNOWN>0x00000000</_VFT_UNKNOWN>
<_VOS_NT_WINDOWS32>0x00040004</_VOS_NT_WINDOWS32>
<_VS_FF_DEBUG>0x00000001</_VS_FF_DEBUG>
<_VerFileTypeValue>$(_VFT_UNKNOWN)</_VerFileTypeValue>
<_VerFileTypeValue Condition="'$(ConfigurationType)' =='Application'">$(_VFT_APP)</_VerFileTypeValue>
<_VerFileTypeValue Condition="'$(ConfigurationType)' =='DynamicLibrary'">$(_VFT_DLL)</_VerFileTypeValue>
<_ExtendedNativeVersionFileContents>
<![CDATA[
#include <winres.h>
#include "_version.h"
#ifndef _DEBUG
#define VER_VER_DEBUG $(_VS_FF_DEBUG)
#else
#define VER_VER_DEBUG 0
#endif
#ifndef VER_FILEFLAGS
#define VER_FILEFLAGS VER_VER_DEBUG
#endif
#ifndef VER_FILEOS
#define VER_FILEOS $(_VOS_NT_WINDOWS32)
#endif
#ifndef VER_FILETYPE
#define VER_FILETYPE $(_VerFileTypeValue)
#endif
/////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS VER_FILEFLAGS
FILEOS VER_FILEOS
FILETYPE VER_FILETYPE
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", VER_FILEDESCRIPTION_STR "\0"
VALUE "FileVersion", VER_FILEVERSION_STR "\0"
VALUE "InternalName", VER_INTERNALNAME_STR "\0"
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR "\0"
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR "\0"
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
]]>
</_ExtendedNativeVersionFileContents>
</PropertyGroup>
<ItemGroup>
<_ExtendenNativeVersionFileLines Include="$(_ExtendedNativeVersionFileContents)" />
</ItemGroup>
<WriteLinesToFile Lines="@(_ExtendenNativeVersionFileLines)"
File="$(NativeResourceFileWithVersionInformation)"
Overwrite="true" WriteOnlyWhenDifferent="true" />
<ItemGroup>
<ResourceCompile Remove="$(NativeResourceFileWithVersionInformation)" />
<ResourceCompile Include="$(NativeResourceFileWithVersionInformation)" />
</ItemGroup>
</Target>
<!--
This target is a replacement for GenerateTargetFrameworkMonikerAttribute defined in Microsoft.BuildSteps.Targets
We needed to ensure a few preconditions for this target, which necessitated a custom version to be written
- this target has to execute prior to ResolveAssemblyReferences
InitializeAssemblyAttributeInformation (defined in ExtendedAssemblyInfo.targets) must run prior to this target, to ensure that $(FileVersion) is populated
Additional assembly scope attributes besides TargetFrameworkAttribute are added here
-->
<Target Name="GenerateTargetFrameworkMonikerAttribute2"
Condition="'$(ManagedCxx)'=='true'"
BeforeTargets="ResolveAssemblyReferences"
DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths;InitializeAssemblyAttributeInformation"
Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)">
<ItemGroup>
<AssemblyInfoFile Include="Always">
<Text>
<![CDATA[
#using <mscorlib.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
using namespace System::Runtime::Versioning;
[assembly:AssemblyTitle("$(AssemblyTitle)")];
[assembly:AssemblyDescription("$(AssemblyDescription)")];
[assembly:AssemblyDefaultAlias("$(AssemblyName)")];
[assembly:AssemblyCompany("$(Company)")];
[assembly:AssemblyProduct("$(Product)")];
[assembly:AssemblyCopyright("$(Copyright)")];
[assembly:AssemblyVersion("$(AssemblyVersion)")];
[assembly:AssemblyFileVersion("$(FileVersion)")];
[assembly:AssemblyInformationalVersion("$(AssemblyInformationalVersion)")];
[assembly:TargetFramework("$(TargetFrameworkMoniker)", FrameworkDisplayName="$(TargetFrameworkMonikerDisplayName)")];
]]>
</Text>
</AssemblyInfoFile>
<AssemblyInfoFile Include="CLSCompliantAttribute" Condition="'$(CLSCompliant)'=='true'">
<Text>
<![CDATA[
[assembly:CLSCompliant(true)];
]]>
</Text>
</AssemblyInfoFile>
<AssemblyInfoFile Include="COMVisibleAttribute" Condition="'$(AssemblyComVisible)'!=''">
<Text>
<![CDATA[
[assembly:ComVisible($(AssemblyComVisible))];
]]>
</Text>
</AssemblyInfoFile>
<AssemblyInfoFile Include="AssemblyMetadataAttribute" Condition="'$(SkipFrameworkAssemblyMetadata)'!='true' and '@(AssemblyMetadata)'!=''">
<Text>
<![CDATA[
[assembly:AssemblyMetadata("%(AssemblyMetadata.Identity)", "%(AssemblyMetadata.Value)")];
]]>
</Text>
</AssemblyInfoFile>
<AssemblyInfoFile Include="DllSafeSearchPathAttribute" Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'">
<Text>
<![CDATA[
[assembly:DefaultDllImportSearchPathsAttribute(DllImportSearchPath::AssemblyDirectory | DllImportSearchPath::System32)];
]]>
</Text>
</AssemblyInfoFile>
</ItemGroup>
<Delete Condition="Exists('$(TargetFrameworkMonikerAssemblyAttributesPath)')"
Files="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
<WriteLinesToFile Lines="@(AssemblyInfoFile->'%(Text)')"
File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
Overwrite="true" WriteOnlyWhenDifferent="true" />
<ItemGroup>
<ClCompile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)">
<!-- The appropriate CompileAsManaged setting will automatically be set depending on the current CLRSupport value -->
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(ManagedCxx)'=='true'">
<ResolveReferencesDependsOn>
CppCliHelper;
$(ResolveReferencesDependsOn)
</ResolveReferencesDependsOn>
<EnsureWpfProjectReferenceDependsOn>
$(EnsureWpfProjectReferenceDependsOn);
CppCliHelper
</EnsureWpfProjectReferenceDependsOn>
</PropertyGroup>
<!--
Helper for building C++/CLI projects
C++/CLI doe not have Sdk support for build on .NET Core
We use existing support for C# to discover Nuget packages, and pass it along to
the C++ compiler.
A simple C# project is generated dynamically. It contains PackageReferences for common packages
that are used in WPF's C++/CLI projects. There are only two such projects - DirectWriteForwarder
and System.Printing - which makes it unnecessary to create a flexible and parametrized target. This
can remain a simple and one-size-fits-all target for now.
If additional Nuget references need to be discovered and passed along for builds (for existing, or new) of
C++/CLI projects, they just need to be added to the vcxproj project file like this:
<AdditionalPackageReference Include="Microsoft.Win32.Registry" Version="<version>" />
-->
<Target Name="CppCliHelper"
Returns="@(Reference)"
Condition="'$(ManagedCxx)' == 'true'">
<PropertyGroup>
<CppCliHelperProject>$(IntermediateOutputPath)CppCliSupport\CppClrSupport_$(MSBuildProjectName).csproj</CppCliHelperProject>
</PropertyGroup>
<ItemGroup>
<CppClrSupportProject Include="ProjectHeader">
<!--
In the CDATA section that follows,
%40 ~= @
%25 ~= %
%3B ~= ;
%24 ~= $
-->
<Text>
<![CDATA[
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="EnumerateAdditionalNugetReference">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU%3Bx64%3Barm64</Platforms>
</PropertyGroup>
]]>
</Text>
</CppClrSupportProject>
<CppClrSupportProject Include="ProjectBody">
<Text>
<![CDATA[
<Target Name="EnumerateAdditionalNugetReference"
BeforeTargets="_GenerateRestoreGraph"
Condition="'%24(AdditionalPackages)'!=''"
Returns="%40(PackageReference)">
<ItemGroup>
<_AdditionalPackages Remove="%40(_AdditionalPackages)" />
<_AdditionalPackages Include="%24(AdditionalPackages)" />
<PackageReference Include="%24([System.String]::Copy('%25(_AdditionalPackages.Identity)').Split('+')[0])"
Version="%24([System.String]::Copy('%25(_AdditionalPackages.Identity)').Split('+')[1])" />
<AdditionalNugetIds Remove="%40(AdditionalNugetIds)" />
<AdditionalNugetIds Include="%24([System.String]::Copy('%25(_AdditionalPackages.Identity)').Split('+')[0])" />
</ItemGroup>
<!--
Removing the Microsoft.NETCore.Platforms directly and then
adding it again to remove the duplicate reference.
-->
<ItemGroup>
<PackageReference Remove="Microsoft.NETCore.Platforms" />
<PackageReference Include="Microsoft.NETCore.Platforms"
Version="$(MicrosoftNETCorePlatformsVersion)" />
</ItemGroup>
</Target>
<Target
Name="IdentifyNugetReferences"
AfterTargets="ResolveAssemblyReferences"
Returns="%40(NugetReferencesForCppCli)">
<!-- Save Microsoft.NETCore.App assemblies and return them -->
<ItemGroup>
<NugetReferencesForCppCli Remove="%40(NugetReferencesForCppCli)" />
</ItemGroup>
<FilterItem1ByItem2 Item1="%40(ReferencePath->'%25(NuGetPackageId)')"
PreserveItem1Metadata="true"
Item2="%40(AdditionalNugetIds)"
Metadata2="Identity">
<Output ItemName="_NugetReferencesForCppCli" TaskParameter="Result" />
</FilterItem1ByItem2>
</Target>
<ItemGroup>
<NugetReferencesForCppCli Include="%40(_NugetReferencesForCppCli->'%25(OriginalItemSpec)')" />
</ItemGroup>
</Project>
]]>
</Text>
</CppClrSupportProject>
</ItemGroup>
<MakeDir Condition="!Exists('$(IntermediateOutputPath)CppCliSupport\')"
Directories="$(IntermediateOutputPath)CppCliSupport\" />
<Delete Files="$(CppCliHelperProject)" Condition="Exists('$(CppCliHelperProject)')" />
<WriteLinesToFile Lines="%(CppClrSupportProject.Text)"
File="$(CppCliHelperProject)"
Overwrite="false" WriteOnlyWhenDifferent="false" />
<!--
Do not build - just ask ResolveReferences + IdentifyNetCoreReferences for the information
we are looking for, namely the list of .NET Core Sdk references.
-->
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)" />
<ProjectToBuild Include="$(CppCliHelperProject)">
<AdditionalProperties>AdditionalPackages=@(AdditionalPackageReference->'%(Identity)+%(Version)')</AdditionalProperties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)"
Targets="Restore;ResolveReferences;IdentifyNugetReferences"
Properties="TargetFramework=$(TargetFramework);Platform=$(Architecture);RuntimeIdentifier=win-$(Architecture)">
<Output TaskParameter="TargetOutputs" ItemName="NugetReferencesForCppCli" />
</MSBuild>
<!--
Add the newly discovered list of .NET core references to $(AdditionalExplicitAssemblyReferences)
-->
<ItemGroup Condition="'$(CopyTransitiveReferences)'=='false'">
<Reference Include="@(NugetReferencesForCppCli)">
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(CopyTransitiveReferences)'!='false'">
<Reference Include="@(NugetReferencesForCppCli)" />
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(ManagedCxx)'!='true'">
<ResolveReferencesDependsOn>
CppHelper;
$(ResolveReferencesDependsOn)
</ResolveReferencesDependsOn>
<EnsureWpfProjectReferenceDependsOn>
$(EnsureWpfProjectReferenceDependsOn);
CppHelper
</EnsureWpfProjectReferenceDependsOn>
</PropertyGroup>
<!--
Helper for building C++ projects that may require references from Microsoft.DotNet.Wpf.DncEng
transport package
C++ does not have NuGet support for build on .NET Core
We use existing support for C# to discover Nuget packages, and pass it along to
the C++ compiler.
A simple C# project is generated dynamically. It contains a PackageReference for RID specific
Microsoft.DotNet.Wpf.DncEng package.
The main purpose of this target is to restore the package with PathProperty=true. As a side-effect,
we will also generate an Item @(NuGetReferencesForCpp) from IdentifyNuGetReferences target, which
will be used by ResolveMicrosoftDotNetWpfDncEngReferencesForCpp
Note:
Test for "$(RepoLocation) != Internal" rather than "$(RepoLocation) == External"
The former form is more reliable.
-->
<Target Name="CppHelper"
Returns="@(NuGetReferencesForCpp)"
Condition="'$(ManagedCxx)' != 'true' and '$(RepoLocation)' != 'Internal'">
<PropertyGroup>
<CppHelperProject>$(IntermediateOutputPath)CppSupport\CppSupport_$(MSBuildProjectName).csproj</CppHelperProject>
</PropertyGroup>
<ItemGroup>
<CppSupportProject Include="ProjectHeader">
<!--
In the CDATA section that follows,
%40 ~= @
%25 ~= %
%3B ~= ;
%24 ~= $
-->
<Text>
<![CDATA[
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU%3Bx64%3Barm64</Platforms>
</PropertyGroup>
]]>
</Text>
</CppSupportProject>
<!--
We need a reference to Microsoft.DotNet.Wpf.DncEng.
These are the native libs built internally on dotnet-wpf-int.
-->
<CppSupportProject Include="MicrosoftDotNetWpfGitHubPackageReference">
<Text>
<![CDATA[
<ItemGroup>
<PackageReference Include="runtime.$(WpfRuntimeIdentifier).$(DncEngTransportPackageName)"
Condition="'$(MicrosoftDotNetWpfDncEngVersion)' != ''"
Version="$(MicrosoftDotNetWpfDncEngVersion)"
GeneratePathProperty="true" />
</ItemGroup>
]]>
</Text>
</CppSupportProject>
<CppSupportProject Include="ProjectBody">
<Text>
<![CDATA[
<!-- Ensure that LimitMicrosoftDotNetWpfGitHubReferences target doesn't run -->
<PropertyGroup>
<DoNotLimitMicrosoftDotNetWpfGitHubReferences>true</DoNotLimitMicrosoftDotNetWpfGitHubReferences>
</PropertyGroup>
<Target
Name="IdentifyNuGetReferences"
AfterTargets="ResolveAssemblyReferences"
Returns="%40(NuGetReferencesForCpp)">
<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-x86' Or '%24(WpfRuntimeIdentifier)'=='win-x86'">%24(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-x86\native\</WpfDncEngRidSpecificLibPath>
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-x64' Or '%24(WpfRuntimeIdentifier)'=='win-x64'">%24(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-x64\native\</WpfDncEngRidSpecificLibPath>
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-arm64' Or '%24(WpfRuntimeIdentifier)'=='win-arm64'">%24(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-arm64\native\</WpfDncEngRidSpecificLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-x86' Or '%24(WpfRuntimeIdentifier)'=='win-x86'">%24(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-x86\native\</WpfDncEngRidSpecificLibPath>
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-x64' Or '%24(WpfRuntimeIdentifier)'=='win-x64'">%24(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-x64\native\</WpfDncEngRidSpecificLibPath>
<WpfDncEngRidSpecificLibPath Condition="'%24(RuntimeIdentifier)'=='win-arm64' Or '%24(WpfRuntimeIdentifier)'=='win-arm64'">%24(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-arm64\native\</WpfDncEngRidSpecificLibPath>
</PropertyGroup>
<!-- Save Microsoft.NETCore.App assemblies and return them -->
<ItemGroup>
<NuGetReferencesForCpp Remove="%40(NuGetReferencesForCpp)" />
<NuGetReferencesForCpp Include="%24(WpfDncEngRidSpecificLibPath)**\*.*" />
</ItemGroup>
</Target>
</Project>
]]>
</Text>
</CppSupportProject>
</ItemGroup>
<MakeDir Condition="!Exists('$(IntermediateOutputPath)CppSupport\')"
Directories="$(IntermediateOutputPath)CppSupport\" />
<Delete Files="$(CppHelperProject)" Condition="Exists('$(CppHelperProject)')" />
<WriteLinesToFile Lines="%(CppSupportProject.Text)"
File="$(CppHelperProject)"
Overwrite="false" WriteOnlyWhenDifferent="false" />
<!--
Do not build - just ask IdentifyNetCoreReferences for the information
we are looking for, namely the list of .NET Core Sdk references.
-->
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)" />
<ProjectToBuild Include="$(CppHelperProject)" />
</ItemGroup>
<PropertyGroup>
<TfmForBuild>$(TargetFramework)</TfmForBuild>
<TfmForBuild Condition="'$(TfmForBuild)'==''">net6.0</TfmForBuild>
</PropertyGroup>
<!-- Restore, then IdentifyNuGetReferences -->
<MSBuild Projects="@(ProjectToBuild)" UnloadProjectsOnCompletion="true"
Targets="Restore"
Properties="TargetFramework=$(TfmForBuild);Platform=$(Architecture);RuntimeIdentifier=win-$(Architecture);IsRestoring=true" />
<MSBuild Projects="@(ProjectToBuild)"
Targets="IdentifyNuGetReferences"
Properties="TargetFramework=$(TfmForBuild);Platform=$(Architecture);RuntimeIdentifier=win-$(Architecture)">
<Output TaskParameter="TargetOutputs" ItemName="NuGetReferencesForCpp" />
</MSBuild>
<!-- Update with file path -->
<ItemGroup>
<NugetReferencesForCpp Update="@(NuGetReferencesForCpp)">
<FilePath>%(NuGetReferencesForCpp.FullPath)</FilePath>
</NugetReferencesForCpp>
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(LinkRepro)'=='true'">
<BeforeLinkTargets>
$(BeforeLinkTargets);
EnsureLinkReproFolder
</BeforeLinkTargets>
</PropertyGroup>
<Target Name="EnsureLinkReproFolder">
<RemoveDir Condition="Exists('$(IntermediateOutputPath)LinkRepro\')" Directories="$(IntermediateOutputPath)LinkRepro\" />
<MakeDir Directories="$(IntermediateOutputPath)LinkRepro\" />
</Target>
<PropertyGroup>
<BeforeClCompileTargets>
UseOldStyleDebugInformationFormat;
$(BeforeClCompileTargets)
</BeforeClCompileTargets>
</PropertyGroup>
<Target Name="UseOldStyleDebugInformationFormat"
Condition="'$(RepositoryName)'=='dotnet-wpf-int' And
'$(ConfigurationType)' =='StaticLibrary' And
'$(ManagedCxx)' != 'true'">
<ItemGroup>
<ClCompile Update="@(ClCompile)">
<DebugInformationFormat>oldStyle</DebugInformationFormat>
</ClCompile>
</ItemGroup>
</Target>
<Import Project="$(MSBuildThisFileDirectory)ResourceLinking.targets" />
</Project>