-
Notifications
You must be signed in to change notification settings - Fork 13
/
wix.targets
1444 lines (1198 loc) · 61.9 KB
/
wix.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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!--
****************************************************************************************************
wix.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file defines the steps in the standard build process for WiX projects (.wixproj).
Conventions:
* Targets and properties that start with an underscore (_) are considered private and should not
be used outside of this file.
Coding Conventions:
* Two-space indentation of nested elements
* Self-closing elements should have a space before the /> ("<MyProperty />")
* Conditions should have a space before and after the "" and between any operators. For example:
<MyProperty Condition=" '$(MyProperty)' == '' ">Value</MyProperty>
* Targets should have each attribute on a single line and indented by two spaces. Also, there
should be a blank line between the Target and the beginning of the contents (a blank line is
optional before the closing </Target> tag).
For example:
<Target
Name="MyTarget"
DependsOnTargets="$(MyTargetDependsOn)">
<Message Importance="low" Text="MyTarget is doing something." />
</Target>
Copyright (c) Microsoft Corporation. All rights reserved.
****************************************************************************************************
-->
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
InitialTargets="_CheckRequiredProperties">
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Extension Points
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!-- Allow a user-customized targets files to be used as part of the build. -->
<PropertyGroup>
<UserTargetsPath>$(MSBuildProjectFullPath).user</UserTargetsPath>
</PropertyGroup>
<Import Project="$(UserTargetsPath)" Condition="Exists('$(UserTargetsPath)')" />
<Import Project="$(CustomBeforeWixTargets)" Condition="Exists('$(CustomBeforeWixTargets)')" />
<!-- These properties can be overridden to support non-default installations. -->
<PropertyGroup>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\Wix.targets</WixTargetsPath>
<WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\WixTasks.dll</WixTasksPath>
<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(ProgramFiles)\Windows Installer XML v3\bin\</WixToolPath>
</PropertyGroup>
<!-- This makes the project files a dependency of all targets so that things rebuild if they change -->
<PropertyGroup>
<MSBuildAllProjects Condition="Exists('$(MSBuildProjectFullPath)')">$(MSBuildAllProjects);$(MSBuildProjectFullPath)</MSBuildAllProjects>
<MSBuildAllProjects Condition="Exists('$(WixTargetsPath)')">$(MSBuildAllProjects);$(WixTargetsPath)</MSBuildAllProjects>
<MSBuildAllProjects Condition="Exists('$(UserTargetsPath)')">$(MSBuildAllProjects);$(UserTargetsPath)</MSBuildAllProjects>
<MSBuildAllProjects Condition="Exists('$(CustomBeforeWixTargets)')">$(MSBuildAllProjects);$(CustomBeforeWixTargets)</MSBuildAllProjects>
<MSBuildAllProjects Condition="Exists('$(CustomAfterWixTargets)')">$(MSBuildAllProjects);$(CustomAfterWixTargets)</MSBuildAllProjects>
</PropertyGroup>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Property Declarations
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!-- These tasks can be used as general-purpose build tasks. -->
<UsingTask TaskName="Candle" AssemblyFile="$(WixTasksPath)" />
<UsingTask TaskName="Lit" AssemblyFile="$(WixTasksPath)" />
<UsingTask TaskName="Light" AssemblyFile="$(WixTasksPath)" />
<!-- These tasks are specific to the build process defined in this file, and are not considered general-purpose build tasks. -->
<UsingTask TaskName="AssignProjectConfiguration" AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<UsingTask TaskName="CreateProjectReferenceDefineConstants" AssemblyFile="$(WixTasksPath)" />
<UsingTask TaskName="ResolveNonMSBuildProjectOutput" AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<UsingTask TaskName="ResolveVCProjectOutput" AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<!--
Several properties must be set in the main project file, before using this .targets file.
However, if the properties are not set, we pick some defaults.
-->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)'=='' ">AnyCPU</Platform>
<OutputPath Condition=" '$(OutputPath)' == '' ">bin\$(Configuration)\</OutputPath>
<!-- Ensure any OutputPath has a trailing slash, so it can be concatenated -->
<OutputPath Condition=" '$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)') ">$(OutputPath)\</OutputPath>
<_OriginalOutputType>$(OutputType)</_OriginalOutputType>
<OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
</PropertyGroup>
<!-- Properties for the intermediate object output -->
<PropertyGroup>
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' and '$(Platform)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' and '$(Platform)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Platform)\$(Configuration)\</IntermediateOutputPath>
<IntermediateExt Condition=" '$(IntermediateExt)' == '' ">.wixobj</IntermediateExt>
<CleanFile Condition=" '$(CleanFile)' == '' ">$(MSBuildProjectFile).FileList.txt</CleanFile>
</PropertyGroup>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
IDE Macro Property Declarations
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
IDE Macros available from both integrated builds and from command line builds.
The following properties are 'macros' that are available via IDE for pre and post build steps.
-->
<PropertyGroup>
<TargetExt Condition=" '$(OutputType)' == 'Package' ">.msi</TargetExt>
<TargetExt Condition=" '$(OutputType)' == 'Module' ">.msm</TargetExt>
<TargetExt Condition=" '$(OutputType)' == 'Library' ">.wixlib</TargetExt>
</PropertyGroup>
<PropertyGroup>
<!-- Example, bin\Debug\ -->
<OutDir Condition=" '$(OutDir)' == '' ">$(OutputPath)</OutDir>
<!-- Ensure OutDir has a trailing slash, so it can be concatenated -->
<OutDir Condition=" '$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)') ">$(OutDir)\</OutDir>
<!-- Example, MySetup -->
<ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
<!-- Example, MySetup.wixproj -->
<ProjectFileName Condition=" '$(ProjectFileName)' == '' ">$(MSBuildProjectFile)</ProjectFileName>
<!-- Example, .wixproj -->
<ProjectExt Condition=" '$(ProjectExt)' == '' ">$(MSBuildProjectExtension)</ProjectExt>
<!-- Example, c:\MyProjects\MySetup\ -->
<ProjectDir Condition=" '$(ProjectDir)' == '' ">$(MSBuildProjectDirectory)\</ProjectDir>
<!-- Example, c:\MyProjects\MySetup\MySetup.msi -->
<ProjectPath Condition=" '$(ProjectPath)' == '' ">$(ProjectDir)$(ProjectFileName)</ProjectPath>
<!-- Example, MySetup -->
<TargetName Condition=" '$(TargetName)' == '' ">$(OutputName)</TargetName>
<!-- Example, MySetup.msi -->
<TargetFileName Condition=" '$(TargetFileName)' == '' ">$(TargetName)$(TargetExt)</TargetFileName>
<!-- Example, Debug -->
<ConfigurationName Condition=" '$(ConfigurationName)' == '' ">$(Configuration)</ConfigurationName>
<!-- Example, AnyCPU -->
<PlatformName Condition=" '$(PlatformName)' == '' ">$(Platform)</PlatformName>
</PropertyGroup>
<ItemGroup>
<!-- Create the output path as an item so that we can use %(FullPath) on it. -->
<_OutputPathItem Include="$(OutDir)" />
<_IntermediateOutputPathItem Include="$(IntermediateOutputPath)" />
</ItemGroup>
<PropertyGroup>
<!-- Example, c:\MyProjects\MySetup\bin\debug\ -->
<!--
Condition intentionally omitted on this one, because it causes problems
when we pick up the value of an environment variable named TargetDir
-->
<TargetDir>@(_OutputPathItem->'%(FullPath)')</TargetDir>
<!-- Example, C:\MyProjects\MySetup\bin\debug\MySetup.msi -->
<TargetPath Condition=" '$(TargetPath)' == '' ">@(_OutputPathItem->'%(FullPath)$(TargetFileName)')</TargetPath>
</PropertyGroup>
<!--
IDE Macros available only from integrated builds. The following properties are 'macros' that are
available via IDE for pre and post build steps. However, they are not defined when directly
building a project from the command line, only when building a solution.
-->
<PropertyGroup>
<DevEnvDir Condition=" '$(DevEnvDir)' == '' ">*Undefined if not building from within Visual Studio*</DevEnvDir>
<!-- Example, MySolution -->
<SolutionName Condition=" '$(SolutionName)' == '' ">*Undefined if not building a solution or within Visual Studio*</SolutionName>
<!-- Example, MySolution.sln -->
<SolutionFileName Condition=" '$(SolutionFileName)' == '' ">*Undefined if not building a solution or within Visual Studio*</SolutionFileName>
<!-- Example, C:\MySolutions\MySolution\MySolution.sln -->
<SolutionPath Condition=" '$(SolutionPath)' == '' ">*Undefined if not building a solution or within Visual Studio*</SolutionPath>
<!-- Example, C:\MySolutions\MySolution\ -->
<SolutionDir Condition=" '$(SolutionDir)' == '' ">*Undefined if not building a solution or within Visual Studio*</SolutionDir>
<!-- Example, .sln -->
<SolutionExt Condition=" '$(SolutionExt)' == '' ">*Undefined if not building a solution or within Visual Studio*</SolutionExt>
</PropertyGroup>
<!-- Convert $(TargetPath) to an item so we can use %(ModifiedTime) on it. -->
<ItemGroup>
<TargetOutput Include="$(TargetPath)" />
</ItemGroup>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Default Compiler, Linker, and Librarian Property Declarations
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup -->
<ItemGroup>
<WixExtension Include="$(WixExtension)" Condition=" '$(WixExtension)' != '' " />
</ItemGroup>
<!-- Default Lib properties copied from the Compile properties. -->
<PropertyGroup>
<LibNoLogo Condition=" '$(LibNoLogo)' == '' ">$(NoLogo)</LibNoLogo>
<LibBindFiles Condition=" '$(LibBindFiles)' == '' ">$(BindFiles)</LibBindFiles>
<LibSuppressSchemaValidation Condition=" '$(LibSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LibSuppressSchemaValidation>
<LibSuppressIntermediateFileVersionMatching Condition=" '$(LibSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LibSuppressIntermediateFileVersionMatching>
<LibTreatWarningsAsErrors Condition=" '$(LibTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LibTreatWarningsAsErrors>
<LibVerboseOutput Condition=" '$(LibVerboseOutput)' == '' ">$(VerboseOutput)</LibVerboseOutput>
</PropertyGroup>
<!-- Default Linker properties copied from the Compile properties. -->
<PropertyGroup>
<LinkerNoLogo Condition=" '$(LinkerNoLogo)' == '' ">$(NoLogo)</LinkerNoLogo>
<LinkerBaseInputPaths Condition=" '$(LinkerBaseInputPaths)' == '' ">$(BaseInputPaths)</LinkerBaseInputPaths>
<LinkerBindFiles Condition=" '$(LinkerBindFiles)' == '' ">$(BindFiles)</LinkerBindFiles>
<LinkerPedantic Condition=" '$(LinkerPedantic)' == '' ">$(Pedantic)</LinkerPedantic>
<LinkerSuppressSchemaValidation Condition=" '$(LinkerSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LinkerSuppressSchemaValidation>
<LinkerSuppressIntermediateFileVersionMatching Condition=" '$(LinkerSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LinkerSuppressIntermediateFileVersionMatching>
<LinkerTreatWarningsAsErrors Condition=" '$(LinkerTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LinkerTreatWarningsAsErrors>
<LinkerVerboseOutput Condition=" '$(LinkerVerboseOutput)' == '' ">$(VerboseOutput)</LinkerVerboseOutput>
</PropertyGroup>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Initial Targets
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
==================================================================================================
_CheckRequiredProperties
Checks properties that must be set in the main project file or on the command line before
using this .TARGETS file.
[IN]
$(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension)
$(OutputType) - Possible values are 'package', 'module', 'library'
==================================================================================================
-->
<PropertyGroup>
<_PleaseSetThisInProjectFile>Please set this in the project file before the <Import> of the wix.targets file.</_PleaseSetThisInProjectFile>
<_OutputTypeDescription>The OutputType defines whether a Windows Installer package (.msi), merge module (.msm), or wix library (.wixlib) is being built. $(_PleaseSetThisInProjectFile) Possible values are 'Package', 'Module', and 'Library'.</_OutputTypeDescription>
</PropertyGroup>
<Target Name="_CheckRequiredProperties">
<Error
Code="WIXTARGETS100"
Condition=" '$(OutputName)' == '' "
Text="The OutputName property is not set in project "$(MSBuildProjectFile)". The OutputName defines the name of the output without a file extension. $(_PleaseSetThisInProjectFile)" />
<Warning
Code="WIXTARGETS101"
Condition=" '$(_OriginalOutputType)' == '' "
Text="The OutputType property is not set in project "$(MSBuildProjectFile)". Defaulting to 'Package'. $(_OutputTypeDescription)" />
<Error
Code="WIXTARGETS102"
Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' "
Text="The OutputType property '$(OutputType)' is not valid in project "$(MSBuildProjectFile)". $(_OutputTypeDescription)" />
<!-- Although we try to ensure a trailing slash, it's possible to circumvent this if the property is set on the command line -->
<Error
Code="WIXTARGETS103"
Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')"
Text="The OutDir property must end with a trailing slash." />
</Target>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Build Targets
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
==================================================================================================
Build
The main build entry point.
==================================================================================================
-->
<PropertyGroup>
<BuildDependsOn>
BeforeBuild;
CoreBuild;
AfterBuild
</BuildDependsOn>
</PropertyGroup>
<Target
Name="Build"
DependsOnTargets="$(BuildDependsOn)"
Outputs="$(TargetPath)">
</Target>
<!--
==================================================================================================
BeforeBuild
Redefine this target in your project in order to run tasks just before Build.
==================================================================================================
-->
<Target Name="BeforeBuild" />
<!--
==================================================================================================
AfterBuild
Redefine this target in your project in order to run tasks just after Build.
==================================================================================================
-->
<Target Name="AfterBuild" />
<!--
==================================================================================================
CoreBuild
The core build step calls each of the build targets.
==================================================================================================
-->
<PropertyGroup>
<CoreBuildDependsOn>
BuildOnlySettings;
PrepareForBuild;
PreBuildEvent;
ResolveReferences;
AddCompilerDefineConstants;
CompileAndLink;
GetTargetPath;
IncrementalClean;
PostBuildEvent
</CoreBuildDependsOn>
</PropertyGroup>
<Target
Name="CoreBuild"
DependsOnTargets="$(CoreBuildDependsOn)">
<OnError
ExecuteTargets="_TimeStampAfterCompile;PostBuildEvent"
Condition=" '$(RunPostBuildEvent)' == 'Always' or '$(RunPostBuildEvent)' == 'OnOutputUpdated' " />
<OnError ExecuteTargets="_CleanRecordFileWrites" />
</Target>
<!--
==================================================================================================
Rebuild
Delete all intermediate and final build outputs, and then build the project from scratch.
==================================================================================================
-->
<PropertyGroup>
<RebuildDependsOn>
BeforeRebuild;
Clean;
$(MSBuildProjectDefaultTargets);
AfterRebuild;
</RebuildDependsOn>
<RebuildDependsOn Condition=" '$(MSBuildProjectDefaultTargets)' == 'Rebuild' ">
BeforeRebuild;
Clean;
Build;
AfterRebuild;
</RebuildDependsOn>
</PropertyGroup>
<Target
Name="Rebuild"
DependsOnTargets="$(RebuildDependsOn)"
Outputs="$(TargetPath)" />
<!--
==================================================================================================
BeforeRebuild
Redefine this target in your project in order to run tasks just before Rebuild.
==================================================================================================
-->
<Target Name="BeforeRebuild" />
<!--
==================================================================================================
AfterRebuild
Redefine this target in your project in order to run tasks just after Rebuild.
==================================================================================================
-->
<Target Name="AfterRebuild" />
<!--
==================================================================================================
BuildOnlySettings
This target is called only when doing a real build. It is not called during project load.
==================================================================================================
-->
<PropertyGroup>
<BuildingProject>false</BuildingProject>
</PropertyGroup>
<Target Name="BuildOnlySettings">
<CreateProperty Value="true">
<Output TaskParameter="Value" PropertyName="BuildingProject" />
</CreateProperty>
</Target>
<!--
==================================================================================================
PrepareForBuild
Prepare the prerequisites for building.
==================================================================================================
-->
<Target
Name="PrepareForBuild">
<!--
These CreateProperty calls are required because TargetDir and TargetPath are defined
to contain an item list. We want that item list to be expanded so that it can be used
as a regular property value and not as an item-list-with-transform.
-->
<CreateProperty Value="$(TargetDir)">
<Output TaskParameter="Value" PropertyName="TargetDir" />
</CreateProperty>
<CreateProperty Value="$(TargetPath)">
<Output TaskParameter="Value" PropertyName="TargetPath" />
</CreateProperty>
<!-- Create the directories for intermediate and final build products. -->
<MakeDir Directories="$(IntermediateOutputPath);$(OutDir)"/>
</Target>
<!--
==================================================================================================
PreBuildEvent
Run the pre-build event if there is one.
==================================================================================================
-->
<PropertyGroup>
<PreBuildEventDependsOn></PreBuildEventDependsOn>
</PropertyGroup>
<Target
Name="PreBuildEvent"
DependsOnTargets="$(PreBuildEventDependsOn)"
Condition=" '$(PreBuildEvent)' != '' ">
<Exec WorkingDirectory="$(OutDir)" Command="$(PreBuildEvent)" />
</Target>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Resolve References Targets
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
==================================================================================================
ResolveReferences
==================================================================================================
-->
<PropertyGroup>
<ResolveReferencesDependsOn>
BeforeResolveReferences;
SplitProjectReferencesByType;
ResolveProjectReferences;
ResolveVCProjectReferences;
ResolveWixLibraryReferences;
AfterResolveReferences
</ResolveReferencesDependsOn>
</PropertyGroup>
<Target
Name="ResolveReferences"
DependsOnTargets="$(ResolveReferencesDependsOn)" />
<!--
==================================================================================================
BeforeResolveReferences
Redefine this target in your project in order to run tasks just before ResolveReferences.
==================================================================================================
-->
<Target Name="BeforeResolveReferences" />
<!--
==================================================================================================
AfterResolveReferences
Redefine this target in your project in order to run tasks just after ResolveReferences.
==================================================================================================
-->
<Target Name="AfterResolveReferences" />
<!--
==================================================================================================
SplitProjectReferencesByType
Split project references into two lists: VC project references and all others (handled by the
MSBuild engine)
[IN]
@(ProjectReference) - the list of all project references
[OUT]
@(VCProjectReference) - the list of VC (managed VC++ to be exact) project references
@(NonVCProjectReference) - the list of non-VC project references (MSBuild and potentially VSIP projects)
==================================================================================================
-->
<Target
Name="SplitProjectReferencesByType"
Condition=" '@(ProjectReference)' != '' ">
<!-- Assign a project configuration to each project reference if we're building a solution file. -->
<AssignProjectConfiguration
ProjectReferences="@(ProjectReference)"
SolutionConfigurationContents="$(CurrentSolutionConfigurationContents)"
Condition=" '$(BuildingSolutionFile)' == 'true' ">
<Output TaskParameter="AssignedProjects" ItemName="_ProjectReferenceWithConfiguration" />
</AssignProjectConfiguration>
<!--
Otherwise (regular command line build or building inside the IDE) just copy the references
as we don't need their configurations.
-->
<CreateItem Include="@(ProjectReference)" Condition=" '$(BuildingSolutionFile)' != 'true' ">
<Output TaskParameter="Include" ItemName="_ProjectReferenceWithConfiguration" />
</CreateItem>
<!-- Copy all VC project references to the VCProjectReference item list (using the VC project extension) -->
<CreateItem
Include="@(_ProjectReferenceWithConfiguration)"
Condition=" '%(Extension)' == '.vcproj' "
AdditionalMetadata="MSBuildSourceProjectFileFullPath=%(FullPath)">
<Output TaskParameter="Include" ItemName="VCProjectReference" />
</CreateItem>
<!-- Copy the rest of the project references to the NonVCProjectReference item list -->
<CreateItem
Include="@(_ProjectReferenceWithConfiguration)"
Condition=" '%(Extension)' != '.vcproj' "
AdditionalMetadata="MSBuildSourceProjectFileFullPath=%(FullPath)">
<Output TaskParameter="Include" ItemName="NonVCProjectReference" />
</CreateItem>
</Target>
<!--
==================================================================================================
_SplitProjectReferencesByFileExistence
Split referenced projects into two lists: those that exist on disk and those that don't.
[IN]
@(NonVCProjectReference) - the list of non-VC project references (MSBuild and potentially VSIP projects)
[OUT]
@(_MSBuildProjectReferenceExistent) - the list of non-VC project references that exist on disk
@(_MSBuildProjectReferenceNonexistent) - the list of non-VC project references that don't exist on disk
==================================================================================================
-->
<Target
Name="_SplitProjectReferencesByFileExistence"
DependsOnTargets="SplitProjectReferencesByType"
Condition=" '@(NonVCProjectReference)' != '' ">
<!--
Use this task for matching projects with pre-resolved project outputs set by the IDE if building
inside the IDE. The IDE only includes non-MSBuild projects in the output list. We'll use MSBuild
to resolve MSBuild projects. This task will resolve VSIP (3rd party) project references and
create a new item list with only project references to projects in the MSBuild format.
-->
<ResolveNonMSBuildProjectOutput
ProjectReferences="@(NonVCProjectReference)"
PreresolvedProjectOutputs="$(VSIDEResolvedNonMSBuildProjectOutputs)"
Condition=" '$(BuildingInsideVisualStudio)' == 'true' ">
<Output TaskParameter="ResolvedOutputPaths" ItemName="_ResolvedProjectReferencePaths" />
<Output TaskParameter="UnresolvedProjectReferences" ItemName="_MSBuildProjectReference" />
</ResolveNonMSBuildProjectOutput>
<!--
If building from the command line, simply copy the NonVCProjectReference item list to
_MSBuildProjectReference, since we have to assume all non-VC projects are in the MSBuild format.
We have no way of building VSIP (3rd party) projects from the command line.
-->
<CreateItem Include="@(NonVCProjectReference)" Condition=" '$(BuildingInsideVisualStudio)' != 'true' ">
<Output TaskParameter="Include" ItemName="_MSBuildProjectReference"/>
</CreateItem>
<!-- Break the project list into two lists: those that exist on disk and those that don't. -->
<CreateItem Include="@(_MSBuildProjectReference)" Condition="Exists('%(Identity)')">
<Output TaskParameter="Include" ItemName="_MSBuildProjectReferenceExistent"/>
</CreateItem>
<CreateItem Include="@(_MSBuildProjectReference)" Condition="!Exists('%(Identity)')">
<Output TaskParameter="Include" ItemName="_MSBuildProjectReferenceNonexistent"/>
</CreateItem>
</Target>
<!--
================================================================================================
ResolveProjectReferences
Builds all of the referenced projects to get their outputs.
[IN]
@(NonVCProjectReference) - The list of non-VC project references.
[OUT]
@(_ResolvedProjectReferencePaths) - Paths to referenced projects.
================================================================================================
-->
<Target
Name="ResolveProjectReferences"
DependsOnTargets="_SplitProjectReferencesByFileExistence"
Condition=" '@(NonVCProjectReference)' != '' ">
<!--
When building this project from the IDE or when building a .sln from the command line, just
gather the referenced build outputs. The code that builds the .sln will already have built
the project, so there's no need to do it again here.
The ContinueOnError setting is here so that, during project load, as much information as
possible will be passed to the compilers.
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Targets="GetTargetPath"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
Condition="('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true') and '@(_MSBuildProjectReferenceExistent)' != '' "
ContinueOnError="!$(BuildingProject)">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" />
</MSBuild>
<!--
Build referenced projects when building from the command line.
The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default target
is used during a P2P reference. However if a custom build process requires that the referenced
project has a different target to build it can be specified.
-->
<MSBuild
Projects="@(_MSBuildProjectReferenceExistent)"
Targets="$(ProjectReferenceBuildTargets)"
Condition=" '$(BuildingInsideVisualStudio)' != 'true' and '$(BuildingSolutionFile)' != 'true' and '@(_MSBuildProjectReferenceExistent)' != '' ">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" />
</MSBuild>
<!-- Issue a warning for each non-existent project. -->
<Warning
Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
Condition=" '@(_MSBuildProjectReferenceNonexistent)' != '' " />
</Target>
<!--
================================================================================================
GetTargetPath
This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be
produced if we built this project.
================================================================================================
-->
<Target
Name="GetTargetPath"
DependsOnTargets="PrepareForBuild"
Outputs="$(TargetPath)" />
<!--
================================================================================================
ResolveVCProjectReferences
Find outputs of referenced VC projects (currently we never build VC projects ourselves).
[IN]
@(VCProjectReference) - the list of VC project references
[OUT]
@(_ResolvedProjectReferencePaths) - paths to projects' outputs
================================================================================================
-->
<Target
Name="ResolveVCProjectReferences"
Condition=" '@(VCProjectReference)' != '' "
DependsOnTargets="SplitProjectReferencesByType">
<!--
Use the task for matching projects with pre-resolved project outputs set by the IDE
if building inside the IDE.
-->
<ResolveNonMSBuildProjectOutput
ProjectReferences="@(VCProjectReference)"
PreresolvedProjectOutputs="$(VSIDEResolvedNonMSBuildProjectOutputs)"
Condition=" '$(BuildingInsideVisualStudio)' == 'true' ">
<Output TaskParameter="ResolvedOutputPaths" ItemName="_ResolvedVCProjectReferencePaths" />
</ResolveNonMSBuildProjectOutput>
<!--
Use the task that uses VC project engine if building from the command line. Invoking this
task only makes sense for building solution files, otherwise we won't have the necessary
configuration information.
-->
<ResolveVCProjectOutput
ProjectReferences="@(VCProjectReference)"
Configuration="%(VCProjectReference.FullConfiguration)"
SolutionFile="$(SolutionPath)"
Override="$(VCBuildOverride)"
Condition=" '$(BuildingSolutionFile)' == 'true' ">
<Output TaskParameter="ResolvedOutputPaths" ItemName="_ResolvedVCProjectReferencePaths" />
</ResolveVCProjectOutput>
<Message Importance="low" Text="VSIDEResolvedNonMSBuildProjectOutputs=$(VSIDEResolvedNonMSBuildProjectOutputs)" />
<Message Importance="low" Text="BuildingInsideVisualStudio=$(BuildingInsideVisualStudio)" />
<Message Importance="low" Text="BuildingSolutionFile=$(BuildingSolutionFile)" />
<Message Importance="low" Text="_ResolvedVCProjectReferencePaths=$(_ResolvedVCProjectReferencePaths)" />
<Error
Text="MSBuild cannot resolve the reference to the Visual C++ project '%(VCProjectReference.Identity)' when building a stand-alone MSBuild project. To correctly resolve this reference, please build the solution file containing these projects."
Condition=" '$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true' " />
<CreateItem Include="@(_ResolvedVCProjectReferencePaths)">
<Output TaskParameter="Include" ItemName="_ResolvedProjectReferencePaths" />
</CreateItem>
</Target>
<!--
================================================================================================
ResolveWixLibraryReferences
Resolve the library references by copying them to the local build directory. Used in Votive
when CopyLocal = true on a wixlib or wix extension reference node.
[IN]
@(WixLibrary) - The list of .wixlib files.
@(WixExtension) - The list of wix dll extension files.
================================================================================================
-->
<!-- Resolve the library references by copying them to the local build directory. Used in Votive when CopyLocal = true on a wixlib reference node. -->
<PropertyGroup>
<ResolveWixLibraryReferencesDependsOn>
PrepareForBuild
</ResolveWixLibraryReferencesDependsOn>
</PropertyGroup>
<Target
Name="ResolveWixLibraryReferences"
Inputs="@(WixLibrary);
@(WixExtension);
$(MSBuildAllProjects)"
Outputs="@(WixLibrary->'$(OutDir)%(Filename)%(Extension)');
@(WixExtension->'$(OutDir)%(Filename)%(Extension)')"
DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)"
Condition=" '@(WixLibrary)@(WixExtension)' != ''">
<!-- TODO: Recurse any project references that build wixlibs or wixext and add their outputs to WixLibrary or WixExtension -->
<!-- TODO: Copy the references marked with CopyLocal=true to the output directory -->
</Target>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
Compiler Define Targets
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
==================================================================================================
AddCompilerDefineConstants
Adds solution and project references to the constants passed into the compiler.
==================================================================================================
-->
<PropertyGroup>
<AddCompilerDefineConstantsDependsOn>
ResolveReferences;
AddSolutionDefineConstants;
AddProjectReferenceDefineConstants;
</AddCompilerDefineConstantsDependsOn>
</PropertyGroup>
<Target
Name="AddCompilerDefineConstants"
DependsOnTargets="$(AddCompilerDefineConstantsDependsOn)">
</Target>
<!--
==================================================================================================
AddSolutionDefineConstants
Adds solution references to the constants passed into the compiler, but only when building
from the Visual Studio IDE or when building a solution file via the command line.
[OUT]
$(SolutionDefineConstants) - the list of solution variables to be passed into the compiler
==================================================================================================
-->
<PropertyGroup>
<DefineSolutionProperties Condition=" '$(DefineSolutionProperties)' == '' ">true</DefineSolutionProperties>
</PropertyGroup>
<Target
Name="AddSolutionDefineConstants"
Condition=" '$(DefineSolutionProperties)' == 'true' ">
<Warning
Text="Solution properties are only available during IDE builds or when building the solution file from the command line. To turn off this warning set <DefineSolutionProperties>false</DefineSolutionProperties> in your .wixproj file."
Condition=" '$(BuildingInsideVisualStudio)' != 'true' and '$(BuildingSolutionFile)' != 'true' " />
<CreateProperty Value="$(SolutionDefineConstants);DevEnvDir=$(DevEnvDir)" Condition=" '$(DevEnvDir)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
<CreateProperty Value="$(SolutionDefineConstants);SolutionDir=$(SolutionDir)" Condition=" '$(SolutionDir)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
<CreateProperty Value="$(SolutionDefineConstants);SolutionExt=$(SolutionExt)" Condition=" '$(SolutionExt)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
<CreateProperty Value="$(SolutionDefineConstants);SolutionFileName=$(SolutionFileName)" Condition=" '$(SolutionFileName)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
<CreateProperty Value="$(SolutionDefineConstants);SolutionName=$(SolutionName)" Condition=" '$(SolutionName)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
<CreateProperty Value="$(SolutionDefineConstants);SolutionPath=$(SolutionPath)" Condition=" '$(SolutionPath)' != '' ">
<Output TaskParameter="Value" PropertyName="SolutionDefineConstants" />
</CreateProperty>
</Target>
<!--
==================================================================================================
AddProjectReferenceDefineConstants
Adds project references to the constants passed into the compiler.
[IN]
@(_ResolvedProjectReferencePaths) - paths to projects' outputs
[OUT]
$(ProjectReferenceDefineConstants) - the list of referenced project variables to be passed into the compiler
==================================================================================================
-->
<Target
Name="AddProjectReferenceDefineConstants"
Condition=" '@(_ResolvedProjectReferencePaths)' != '' ">
<CreateProjectReferenceDefineConstants
ProjectReferencePaths="@(_ResolvedProjectReferencePaths)">
<Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" />
</CreateProjectReferenceDefineConstants>
</Target>
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
CompileAndLink Targets
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-->
<!--
==================================================================================================
CompileAndLink
==================================================================================================
-->
<PropertyGroup>
<CompileAndLinkDependsOn>
ResolveReferences;
BeforeCompileAndLink;
_TimeStampBeforeCompileAndLink;
Compile;
Lib;
Link;
_TimeStampAfterCompileAndLink;
AfterCompileAndLink
</CompileAndLinkDependsOn>
</PropertyGroup>
<Target
Name="CompileAndLink"
DependsOnTargets="$(CompileAndLinkDependsOn)" />
<!--
==================================================================================================
BeforeCompileAndLink
Redefine this target in your project in order to run tasks just before CompileAndLink.
==================================================================================================
-->
<Target Name="BeforeCompileAndLink" />
<!--
==================================================================================================
AfterCompileAndLink
Redefine this target in your project in order to run tasks just after CompileAndLink.
==================================================================================================
-->
<Target Name="AfterCompileAndLink" />
<!--
==================================================================================================
_TimeStampBeforeCompileAndLink
If post-build events are set to fire "OnOutputUpdated", then take before and after timestamps
so that we can compare them.
==================================================================================================
-->
<Target
Name="_TimeStampBeforeCompileAndLink"
Condition=" '$(RunPostBuildEvent)' == 'OnOutputUpdated' ">
<CreateItem Include="%(TargetOutput.ModifiedTime)">
<Output TaskParameter="Include" PropertyName="_TargetOutputTimestampBeforeCompileAndLink" />
</CreateItem>
</Target>
<!--
==================================================================================================
_TimeStampAfterCompileAndLink
If post-build events are set to fire "OnOutputUpdated", then take before and after timestamps
so that we can compare them.
==================================================================================================
-->
<Target
Name="_TimeStampAfterCompileAndLink"
Condition=" '$(RunPostBuildEvent)' == 'OnOutputUpdated' ">
<CreateItem Include="%(TargetOutput.ModifiedTime)">
<Output TaskParameter="Include" PropertyName="_TargetOutputTimestampAfterCompileAndLink" />
</CreateItem>
</Target>
<!--
================================================================================================
Compile
Compiles the wxs files into wixobj files using candle.exe.
[IN]
@(Compile) - The list of wxs files to compile.
@(Content) - Files that the project uses in the installer.
@(WixExtension) - The list of wixlib or wix dll extensions.
[OUT]
@(CompileObjOutput) - The compiled .wixobj files.
================================================================================================
-->
<PropertyGroup>
<CompileDependsOn>
PrepareForBuild
</CompileDependsOn>
</PropertyGroup>