aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/wix.targets
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks/wix.targets')
-rw-r--r--src/WixToolset.BuildTasks/wix.targets1353
1 files changed, 1353 insertions, 0 deletions
diff --git a/src/WixToolset.BuildTasks/wix.targets b/src/WixToolset.BuildTasks/wix.targets
new file mode 100644
index 00000000..eadd33ec
--- /dev/null
+++ b/src/WixToolset.BuildTasks/wix.targets
@@ -0,0 +1,1353 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="_CheckRequiredProperties" DefaultTargets="Build">
6 <PropertyGroup>
7 <WixTargetsImported>true</WixTargetsImported>
8 </PropertyGroup>
9
10 <!--
11 //////////////////////////////////////////////////////////////////////////////////////////////////
12 //////////////////////////////////////////////////////////////////////////////////////////////////
13 Extension Points
14 //////////////////////////////////////////////////////////////////////////////////////////////////
15 //////////////////////////////////////////////////////////////////////////////////////////////////
16 -->
17
18 <!-- Allow a user-customized targets files to be used as part of the build. -->
19 <Import Project="$(CustomBeforeWixTargets)" Condition=" '$(CustomBeforeWixTargets)' != '' and Exists('$(CustomBeforeWixTargets)')" />
20
21 <!-- These properties can be overridden to support non-default installations. -->
22 <PropertyGroup>
23 <WixBinDir Condition=" '$(WixBinDir)' == ''">$(MSBuildThisFileDirectory)</WixBinDir>
24 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixBinDir)WixToolset.BuildTasks.dll</WixTasksPath>
25 <WixHarvestTargetsPath Condition=" '$(WixHarvestTargetsPath)' == '' ">$(WixBinDir)wix.harvest.targets</WixHarvestTargetsPath>
26 <WixSigningTargetsPath Condition=" '$(WixSigningTargetsPath)' == '' ">$(WixBinDir)wix.signing.targets</WixSigningTargetsPath>
27 <LuxTargetsPath Condition=" '$(LuxTargetsPath)' == '' ">$(WixBinDir)lux.targets</LuxTargetsPath>
28 <LuxTasksPath Condition=" '$(LuxTasksPath)' == '' ">$(WixBinDir)LuxTasks.dll</LuxTasksPath>
29 </PropertyGroup>
30
31 <!-- This makes the project files a dependency of all targets so that things rebuild if they change -->
32 <PropertyGroup>
33 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
34 <MSBuildAllProjects Condition="Exists('$(WixHarvestTargetsPath)')">$(MSBuildAllProjects);$(WixHarvestTargetsPath)</MSBuildAllProjects>
35 <MSBuildAllProjects Condition="Exists('$(WixSigningTargetsPath)')">$(MSBuildAllProjects);$(WixSigningTargetsPath)</MSBuildAllProjects>
36 <MSBuildAllProjects Condition="Exists('$(LuxTargetsPath)')">$(MSBuildAllProjects);$(LuxTargetsPath)</MSBuildAllProjects>
37 <MSBuildAllProjects Condition="Exists('$(CustomBeforeWixTargets)')">$(MSBuildAllProjects);$(CustomBeforeWixTargets)</MSBuildAllProjects>
38 <MSBuildAllProjects Condition="Exists('$(CustomAfterWixTargets)')">$(MSBuildAllProjects);$(CustomAfterWixTargets)</MSBuildAllProjects>
39 </PropertyGroup>
40
41 <!--
42 //////////////////////////////////////////////////////////////////////////////////////////////////
43 //////////////////////////////////////////////////////////////////////////////////////////////////
44 Declarations for Microsoft.Common.targets
45 //////////////////////////////////////////////////////////////////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////////////////////////////
47 -->
48
49 <PropertyGroup>
50 <DefaultLanguageSourceExtension>.wxs</DefaultLanguageSourceExtension>
51 <Language>wix</Language>
52 <TargetRuntime>Managed</TargetRuntime>
53
54 <!-- Use OutputName to set the AssemblyName for Microsoft.Common.targets -->
55 <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName>
56 <AssemblyName>$(OutputName)</AssemblyName>
57
58 <!-- Default the OutputType to a known WiX toolset TYPE. -->
59 <_OriginalOutputType>$(OutputType)</_OriginalOutputType>
60 <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
61 </PropertyGroup>
62
63 <!--
64 IDE Macros available from both integrated builds and from command line builds.
65 The following properties are 'macros' that are available via IDE for pre and post build steps.
66 All of them should be added to WixBuildMacroCollection to ensure that they are shown in the UI.
67 -->
68 <PropertyGroup>
69 <TargetExt Condition=" '$(OutputType)' == 'Package' ">.msi</TargetExt>
70 <TargetExt Condition=" '$(OutputType)' == 'Module' ">.msm</TargetExt>
71 <TargetExt Condition=" '$(OutputType)' == 'PatchCreation' ">.pcp</TargetExt>
72 <TargetExt Condition=" '$(OutputType)' == 'Library' ">.wixlib</TargetExt>
73 <TargetExt Condition=" '$(OutputType)' == 'Bundle' ">.exe</TargetExt>
74 </PropertyGroup>
75
76 <!-- Provide the correct output name for the .wixpdb -->
77 <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true'">
78 <_DebugSymbolsIntermediatePath Include="$(PdbOutputDir)$(TargetPdbName)" Condition=" '@(_DebugSymbolsIntermediatePath)' == '' " />
79 </ItemGroup>
80
81 <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
82
83 <PropertyGroup>
84 <!-- Default pdb output path to the intermediate output directory -->
85 <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(IntermediateOutputPath)</PdbOutputDir>
86 <PdbOutputDir Condition=" '$(PdbOutputDir)' != '' and !HasTrailingSlash('$(PdbOutputDir)') ">$(PdbOutputDir)\</PdbOutputDir>
87
88 <!-- Example, C:\MyProjects\MyProject\bin\debug\ -->
89 <TargetPdbDir Condition=" '$(PdbOutputDir)'!='' ">$([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`))</TargetPdbDir>
90
91 <!-- Example, MySetup.wixpdb" -->
92 <TargetPdbName Condition=" '$(TargetPdbName)' == '' ">$(TargetName).wixpdb</TargetPdbName>
93
94 <!-- Example, C:\MyProjects\MyProject\bin\debug\MyPackage.wixpdb -->
95 <TargetPdbPath Condition=" '$(TargetPdbPath)' == '' ">$(TargetPdbDir)$(TargetPdbName)</TargetPdbPath>
96 </PropertyGroup>
97
98 <!--
99 //////////////////////////////////////////////////////////////////////////////////////////////////
100 //////////////////////////////////////////////////////////////////////////////////////////////////
101 Property Declarations
102 //////////////////////////////////////////////////////////////////////////////////////////////////
103 //////////////////////////////////////////////////////////////////////////////////////////////////
104 -->
105
106 <!-- These tasks can be used as general-purpose build tasks. -->
107 <UsingTask TaskName="Candle" AssemblyFile="$(WixTasksPath)" />
108 <UsingTask TaskName="DoIt" AssemblyFile="$(WixTasksPath)" />
109 <UsingTask TaskName="Lit" AssemblyFile="$(WixTasksPath)" />
110 <UsingTask TaskName="Light" AssemblyFile="$(WixTasksPath)" />
111 <UsingTask TaskName="Torch" AssemblyFile="$(WixTasksPath)" />
112
113 <!-- These tasks are specific to the build process defined in this file, and are not considered general-purpose build tasks. -->
114 <UsingTask TaskName="CreateItemAvoidingInference" AssemblyFile="$(WixTasksPath)" />
115 <UsingTask TaskName="CreateProjectReferenceDefineConstants" AssemblyFile="$(WixTasksPath)" />
116 <UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" />
117 <UsingTask TaskName="ResolveWixReferences" AssemblyFile="$(WixTasksPath)"/>
118 <UsingTask TaskName="ReplaceString" AssemblyFile="$(WixTasksPath)"/>
119 <UsingTask TaskName="GetCabList" AssemblyFile="$(WixTasksPath)" />
120 <UsingTask TaskName="GetLooseFileList" AssemblyFile="$(WixTasksPath)" />
121 <UsingTask TaskName="GenerateCompileWithObjectPath" AssemblyFile="$(WixTasksPath)"/>
122
123 <!-- WiX tools are 32bit EXEs, so run them out-of-proc when MSBuild is not 32bit. -->
124 <PropertyGroup>
125 <RunWixToolsOutOfProc Condition=" '$(PROCESSOR_ARCHITECTURE)'!='x86' ">true</RunWixToolsOutOfProc>
126 </PropertyGroup>
127
128 <PropertyGroup>
129 <BindContentsFile Condition=" '$(BindContentsFile)' == '' ">$(MSBuildProjectFile).BindContentsFileList.txt</BindContentsFile>
130 <BindOutputsFile Condition=" '$(BindOutputsFile)' == '' ">$(MSBuildProjectFile).BindOutputsFileList.txt</BindOutputsFile>
131 <BindBuiltOutputsFile Condition=" '$(BindBuiltOutputsFile)' == '' ">$(MSBuildProjectFile).BindBuiltOutputsFileList.txt</BindBuiltOutputsFile>
132 </PropertyGroup>
133
134 <PropertyGroup>
135 <CabinetCachePath Condition=" '$(CabinetCachePath)'=='' and '$(ReuseCabinetCache)'=='true' ">$(IntermediateOutputPath)cabcache\</CabinetCachePath>
136 </PropertyGroup>
137
138 <PropertyGroup>
139 <WixToolDir Condition=" '$(WixToolDir)' == ''">$(WixBinDir)</WixToolDir>
140 <WixExtDir Condition=" '$(WixExtDir)' == ''">$(WixToolDir)</WixExtDir>
141 </PropertyGroup>
142
143 <!--
144 Set the SignTargetPath item directly when output is a Bundle. The AssignCultures target
145 sets SignTargetPath item for other output types based on the cultures provided.
146 -->
147 <ItemGroup>
148 <SignTargetPath Include="$(TargetPath)" Condition=" '$(OutputType)' == 'Bundle' AND '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' " />
149 </ItemGroup>
150
151 <!--
152 //////////////////////////////////////////////////////////////////////////////////////////////////
153 //////////////////////////////////////////////////////////////////////////////////////////////////
154 Default Compiler, Linker, and Librarian Property Declarations
155 //////////////////////////////////////////////////////////////////////////////////////////////////
156 //////////////////////////////////////////////////////////////////////////////////////////////////
157 -->
158
159 <!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup -->
160 <ItemGroup>
161 <WixExtension Include="$(WixExtension)" Condition=" '$(WixExtension)' != '' " />
162 </ItemGroup>
163
164 <!-- Defaut Compiler properties. -->
165 <PropertyGroup>
166 <CompilerNoLogo Condition=" '$(CompilerNoLogo)' == '' ">$(NoLogo)</CompilerNoLogo>
167 <CompilerSuppressAllWarnings Condition=" '$(CompilerSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</CompilerSuppressAllWarnings>
168 <CompilerSuppressSpecificWarnings Condition=" '$(CompilerSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</CompilerSuppressSpecificWarnings>
169 <CompilerTreatWarningsAsErrors Condition=" '$(CompilerTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</CompilerTreatWarningsAsErrors>
170 <CompilerTreatSpecificWarningsAsErrors Condition=" '$(CompilerTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</CompilerTreatSpecificWarningsAsErrors>
171 <CompilerVerboseOutput Condition=" '$(CompilerVerboseOutput)' == '' ">$(VerboseOutput)</CompilerVerboseOutput>
172 <!-- TODO: This probably doesn't work any longer since Platform won't be defined until Microsoft.Common.targets is included -->
173 <InstallerPlatform Condition=" '$(InstallerPlatform)' == '' and '$(Platform)' != 'AnyCPU' and '$(Platform)' != 'Any CPU' ">$(Platform)</InstallerPlatform>
174 </PropertyGroup>
175
176 <!-- Default Lib properties. -->
177 <PropertyGroup>
178 <LibNoLogo Condition=" '$(LibNoLogo)' == '' ">$(NoLogo)</LibNoLogo>
179 <LibBindFiles Condition=" '$(LibBindFiles)' == '' ">$(BindFiles)</LibBindFiles>
180 <LibPedantic Condition=" '$(LibPedantic)' == '' ">$(Pedantic)</LibPedantic>
181 <LibSuppressAllWarnings Condition=" '$(LibSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</LibSuppressAllWarnings>
182 <LibSuppressSpecificWarnings Condition=" '$(LibSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</LibSuppressSpecificWarnings>
183 <LibSuppressSchemaValidation Condition=" '$(LibSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LibSuppressSchemaValidation>
184 <LibSuppressIntermediateFileVersionMatching Condition=" '$(LibSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LibSuppressIntermediateFileVersionMatching>
185 <LibTreatWarningsAsErrors Condition=" '$(LibTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LibTreatWarningsAsErrors>
186 <LibTreatSpecificWarningsAsErrors Condition=" '$(LibTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</LibTreatSpecificWarningsAsErrors>
187 <LibVerboseOutput Condition=" '$(LibVerboseOutput)' == '' ">$(VerboseOutput)</LibVerboseOutput>
188 </PropertyGroup>
189
190 <!-- Default Linker properties. -->
191 <PropertyGroup>
192 <LinkerNoLogo Condition=" '$(LinkerNoLogo)' == '' ">$(NoLogo)</LinkerNoLogo>
193 <LinkerBindFiles Condition=" '$(LinkerBindFiles)' == '' ">$(BindFiles)</LinkerBindFiles>
194 <LinkerPedantic Condition=" '$(LinkerPedantic)' == '' ">$(Pedantic)</LinkerPedantic>
195 <LinkerSuppressAllWarnings Condition=" '$(LinkerSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</LinkerSuppressAllWarnings>
196 <LinkerSuppressSpecificWarnings Condition=" '$(LinkerSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</LinkerSuppressSpecificWarnings>
197 <LinkerSuppressSchemaValidation Condition=" '$(LinkerSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LinkerSuppressSchemaValidation>
198 <LinkerSuppressIntermediateFileVersionMatching Condition=" '$(LinkerSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LinkerSuppressIntermediateFileVersionMatching>
199 <LinkerTreatWarningsAsErrors Condition=" '$(LinkerTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LinkerTreatWarningsAsErrors>
200 <LinkerTreatSpecificWarningsAsErrors Condition=" '$(LinkerTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</LinkerTreatSpecificWarningsAsErrors>
201 <LinkerVerboseOutput Condition=" '$(LinkerVerboseOutput)' == '' ">$(VerboseOutput)</LinkerVerboseOutput>
202 </PropertyGroup>
203
204 <!-- If BindInputPaths (or LinkerBindInputPaths) was passed in via the command line, then convert it to an ItemGroup -->
205 <ItemGroup>
206 <BindInputPaths Include="$(BindInputPaths)" Condition=" '$(BindInputPaths)' != '' " />
207 <LinkerBindInputPaths Include="$(LinkerBindInputPaths)" Condition=" '$(LinkerBindInputPaths)' != '' " />
208 </ItemGroup>
209
210 <!-- Default Lit and Light "properties" -->
211 <ItemGroup>
212 <LinkerBindInputPaths Condition=" '@(LinkerBindInputPaths)' == '' " Include="@(BindInputPaths)" />
213 </ItemGroup>
214
215 <!--
216 //////////////////////////////////////////////////////////////////////////////////////////////////
217 //////////////////////////////////////////////////////////////////////////////////////////////////
218 Initial Targets
219 //////////////////////////////////////////////////////////////////////////////////////////////////
220 //////////////////////////////////////////////////////////////////////////////////////////////////
221 -->
222
223 <!--
224 ==================================================================================================
225 _CheckRequiredProperties
226
227 Checks properties that must be set in the main project file or on the command line before
228 using this .TARGETS file.
229
230 [IN]
231 $(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension)
232 $(OutputType) - Possible values are 'package', 'PatchCreation', 'module', 'library', 'bundle'
233 ==================================================================================================
234 -->
235 <PropertyGroup>
236 <_PleaseSetThisInProjectFile>Please set this in the project file before the &lt;Import&gt; of the wix.targets file.</_PleaseSetThisInProjectFile>
237 <_OutputTypeDescription>The OutputType defines whether a Windows Installer package (.msi), PatchCreation (.pcp), merge module (.msm), wix library (.wixlib), or self-extracting executable (.exe) is being built. $(_PleaseSetThisInProjectFile) Possible values are 'Package', 'Module', 'Library', and 'Bundle'.</_OutputTypeDescription>
238 </PropertyGroup>
239 <Target Name="_CheckRequiredProperties">
240
241 <Error
242 Code="WIXTARGETS100"
243 Condition=" '$(OutputName)' == '' "
244 Text="The OutputName property is not set in project &quot;$(MSBuildProjectFile)&quot;. The OutputName defines the name of the output without a file extension. $(_PleaseSetThisInProjectFile)" />
245
246 <Warning
247 Code="WIXTARGETS101"
248 Condition=" '$(_OriginalOutputType)' == '' "
249 Text="The OutputType property is not set in project &quot;$(MSBuildProjectFile)&quot;. Defaulting to '$(OutputType)'. $(_OutputTypeDescription)" />
250
251 <Error
252 Code="WIXTARGETS102"
253 Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'PatchCreation' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' and '$(OutputType)' != 'Bundle' "
254 Text="The OutputType property '$(OutputType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. $(_OutputTypeDescription)" />
255
256 <Error
257 Code="WIXTARGETS103"
258 Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' &lt; '4.0' "
259 Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project &quot;$(MSBuildProjectFile)&quot;. You must use MSBuild v4.0 or later." />
260
261 </Target>
262
263 <!--
264 //////////////////////////////////////////////////////////////////////////////////////////////////
265 //////////////////////////////////////////////////////////////////////////////////////////////////
266 Build Targets
267 //////////////////////////////////////////////////////////////////////////////////////////////////
268 //////////////////////////////////////////////////////////////////////////////////////////////////
269 -->
270
271 <!--
272 ==================================================================================================
273 CoreBuild - OVERRIDE DependsOn
274
275 The core build step calls each of the build targets.
276
277 This is where we insert our targets into the build process.
278 ==================================================================================================
279 -->
280 <PropertyGroup>
281 <CoreBuildDependsOn>
282 BuildOnlySettings;
283 PrepareForBuild;
284 PreBuildEvent;
285 ResolveReferences;
286
287 <!--CompileAndLink;-->
288 DoIt;
289 Signing;
290
291 GetTargetPath;
292 PrepareForRun;
293 IncrementalClean;
294 PostBuildEvent
295 </CoreBuildDependsOn>
296 </PropertyGroup>
297
298
299 <!--
300 //////////////////////////////////////////////////////////////////////////////////////////////////
301 //////////////////////////////////////////////////////////////////////////////////////////////////
302 Resolve References Targets
303 //////////////////////////////////////////////////////////////////////////////////////////////////
304 //////////////////////////////////////////////////////////////////////////////////////////////////
305 -->
306
307 <!--
308 ==================================================================================================
309 ResolveReferences - OVERRIDE DependsOn
310
311 ==================================================================================================
312 -->
313 <PropertyGroup>
314 <ResolveReferencesDependsOn>
315 BeforeResolveReferences;
316 AssignProjectConfiguration;
317 ResolveProjectReferences;
318 ResolveWixLibraryReferences;
319 ResolveWixExtensionReferences;
320 AfterResolveReferences
321 </ResolveReferencesDependsOn>
322 </PropertyGroup>
323
324 <!--
325 ================================================================================================
326 ResolveProjectReferences
327
328 Builds all of the referenced projects to get their outputs.
329
330 [IN]
331 @(NonVCProjectReference) - The list of non-VC project references.
332
333 [OUT]
334 @(ProjectReferenceWithConfiguration) - The list of non-VC project references.
335 @(WixLibProjects) - Paths to any .wixlibs that were built by referenced projects.
336 ================================================================================================
337 -->
338 <Target
339 Name="ResolveProjectReferences"
340 DependsOnTargets="AssignProjectConfiguration;_SplitProjectReferencesByFileExistence"
341 Condition=" '@(ProjectReferenceWithConfiguration)' != '' ">
342
343 <!-- Issue a warning for each non-existent project. -->
344 <Warning
345 Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
346 Condition=" '@(_MSBuildProjectReferenceNonexistent)' != '' " />
347
348 <!--
349 When building this project from the IDE or when building a .sln from the command line or
350 when only building .wixlib project references, gather the referenced build outputs. The
351 code that builds the .sln will already have built the project, so there's no need to do
352 it again here and when building only .wixlib project references we'll use the results to
353 determine which projects to build.
354
355 The ContinueOnError setting is here so that, during project load, as much information as
356 possible will be passed to the compilers.
357 -->
358 <MSBuild
359 Projects="@(_MSBuildProjectReferenceExistent)"
360 Targets="%(_MSBuildProjectReferenceExistent.Targets);GetTargetPath"
361 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
362 Condition="('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '@(_MSBuildProjectReferenceExistent)' != '' "
363 ContinueOnError="!$(BuildingProject)">
364
365 <Output TaskParameter="TargetOutputs" ItemName="_GatheredProjectReferencePaths" />
366 </MSBuild>
367
368 <!--
369 Determine which project references should be built. Note: we will not build any project references
370 if building in the IDE because it builds project references directly.
371
372 If BuildProjectReferences is 'true' (the default) then take all MSBuild project references that exist
373 on disk and add them to the list of things to build. This is the easy case.
374 -->
375 <CreateItem
376 Include="@(_MSBuildProjectReferenceExistent)"
377 Condition=" '$(BuildProjectReferences)' == 'true' and '$(BuildingInsideVisualStudio)' != 'true' ">
378
379 <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
380 </CreateItem>
381
382 <!--
383 If BuildProjectReferences is 'wixlib' then build only the MSBuild project references that exist and
384 create a .wixlib file. That requires us to first filter the gathered project references down to only
385 those that build .wixlibs.
386 -->
387 <CreateItem
388 Include="@(_GatheredProjectReferencePaths)"
389 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '%(Extension)' == '.wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
390
391 <Output TaskParameter="Include" ItemName="_ReferencedWixLibPaths" />
392 </CreateItem>
393
394 <!--
395 The second step when building only 'wixlib' project references is to create the list of existing MSBuild
396 project references that do *not* build a .wixlib. These are the projects that will be skipped.
397 -->
398 <CreateItem
399 Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
400 Exclude="@(_ReferencedWixLibPaths->'%(MSBuildSourceProjectFile)')"
401 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
402
403 <Output TaskParameter="Include" ItemName="_ProjectReferencesToSkip" />
404 </CreateItem>
405
406 <!--
407 Finally, when building only 'wixlib' project references, the list of projects to build are naturally the
408 list of projects *not* being skipped.
409 -->
410 <CreateItem
411 Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
412 Exclude="@(_ProjectReferencesToSkip)"
413 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
414
415 <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
416 </CreateItem>
417
418 <!-- Display a warning for all projects being skipped. -->
419 <Warning
420 Text="BuildProjectReferences set to '$(BuildProjectReferences)'. Skipping the non-Library project: %(_ProjectReferencesToSkip.Identity)"
421 Condition=" '@(_ProjectReferencesToSkip)' != '' " />
422
423 <Message
424 Importance="low"
425 Text="Project reference to build: %(_ProjectReferencesToBuild.Identity), properties: %(_ProjectReferencesToBuild.Properties)"
426 Condition=" '@(_ProjectReferencesToBuild)' != '' " />
427
428 <!--
429 Build referenced projects when building from the command line.
430
431 The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default target
432 is used during a P2P reference. However if a custom build process requires that the referenced
433 project has a different target to build it can be specified.
434 -->
435 <MSBuild
436 Projects="@(_ProjectReferencesToBuild)"
437 Targets="$(ProjectReferenceBuildTargets)"
438 Properties="%(_ProjectReferencesToBuild.SetConfiguration);%(_ProjectReferencesToBuild.SetPlatform)"
439 Condition=" '@(_ProjectReferencesToBuild)' != '' ">
440
441 <Output TaskParameter="TargetOutputs" ItemName="_BuiltProjectReferencePaths" />
442 </MSBuild>
443
444 <!--
445 VC project references must build GetNativeTargetPath because neither GetTargetPath nor the return of the default build
446 target return the output for a native .vcxproj.
447 -->
448 <MSBuild
449 Projects="@(_MSBuildProjectReferenceExistent)"
450 Targets="GetNativeTargetPath"
451 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
452 Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' ">
453
454 <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" />
455 <Output TaskParameter="TargetOutputs" ItemName="_MSBuildResolvedProjectReferencePaths" />
456 </MSBuild>
457
458 <!-- Assign the unique gathered and built project references to the resolved project
459 reference paths. -->
460 <RemoveDuplicates Inputs="@(_GatheredProjectReferencePaths);@(_BuiltProjectReferencePaths)">
461 <Output TaskParameter="Filtered" ItemName="_ResolvedProjectReferencePaths" />
462 <Output TaskParameter="Filtered" ItemName="_MSBuildResolvedProjectReferencePaths" />
463 </RemoveDuplicates>
464
465 <!-- Create list of all .wixlib project references. -->
466 <CreateItem
467 Include="@(_ResolvedProjectReferencePaths)"
468 Condition=" '%(Extension)' == '.wixlib' ">
469
470 <Output TaskParameter="Include" ItemName="WixLibProjects" />
471 </CreateItem>
472
473 <Message
474 Importance="low"
475 Text="Library from referenced projects: %(WixLibProjects.Identity)"
476 Condition=" '@(WixLibProjects)' != '' " />
477
478 </Target>
479
480 <!--
481 ================================================================================================
482 ResolveWixLibraryReferences
483
484 Resolve the library references to full paths.
485
486 [IN]
487 @(WixLibrary) - The list of .wixlib files.
488
489 [OUT]
490 @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries
491 ================================================================================================
492 -->
493 <PropertyGroup>
494 <ResolveWixLibraryReferencesDependsOn></ResolveWixLibraryReferencesDependsOn>
495 </PropertyGroup>
496 <Target
497 Name="ResolveWixLibraryReferences"
498 DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)"
499 Condition=" '@(WixLibrary)' != ''">
500
501 <!--
502 The WixLibrarySearchPaths property is set to find assemblies in the following order:
503
504 (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
505 (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
506 (3) Treat the reference's Include as if it were a real file name.
507 (4) Path specified by the WixExtDir property.
508 -->
509 <CreateProperty Condition=" '$(WixLibrarySearchPaths)' == '' " Value="
510 $(ReferencePaths);
511 {HintPathFromItem};
512 {RawFileName};
513 $(WixExtDir)
514 ">
515 <Output TaskParameter="Value" PropertyName="WixLibrarySearchPaths" />
516 </CreateProperty>
517
518 <ResolveWixReferences
519 WixReferences="@(WixLibrary)"
520 SearchPaths="$(WixLibrarySearchPaths)"
521 SearchFilenameExtensions=".wixlib">
522 <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixLibraryPaths" />
523 </ResolveWixReferences>
524
525 <!-- Remove duplicate library items that would cause build errors -->
526 <RemoveDuplicates Inputs="@(_AllResolvedWixLibraryPaths)">
527 <Output TaskParameter="Filtered" ItemName="_ResolvedWixLibraryPaths" />
528 </RemoveDuplicates>
529
530 </Target>
531
532 <!--
533 ==================================================================================================
534 ResolveWixExtensionReferences
535
536 Resolves WiX extension references to full paths. Any properties you use
537 to resolve paths to extensions must be defined before importing this
538 file or the extensions will be automatically resolved to $(WixExtDir).
539
540 [IN]
541 @(WixExtension) - WixExtension item group
542
543 [OUT]
544 @(_ResolvedWixExtensionPaths) - Item group with full paths to extensions
545 ==================================================================================================
546 -->
547 <PropertyGroup>
548 <ResolveWixExtensionReferencesDependsOn></ResolveWixExtensionReferencesDependsOn>
549 </PropertyGroup>
550 <Target
551 Name="ResolveWixExtensionReferences"
552 DependsOnTargets="$(ResolveWixExtensionReferencesDependsOn)"
553 Condition=" '@(WixExtension)' != ''">
554
555 <!--
556 The WixExtensionSearchPaths property is set to find assemblies in the following order:
557
558 (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
559 (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
560 (3) Treat the reference's Include as if it were a real file name.
561 (4) Path specified by the WixExtDir property.
562 -->
563 <CreateProperty Condition=" '$(WixExtensionSearchPaths)' == '' " Value="
564 $(ReferencePaths);
565 {HintPathFromItem};
566 {RawFileName};
567 $(WixExtDir)
568 ">
569 <Output TaskParameter="Value" PropertyName="WixExtensionSearchPaths" />
570 </CreateProperty>
571
572 <ResolveWixReferences
573 WixReferences="@(WixExtension)"
574 SearchPaths="$(WixExtensionSearchPaths)"
575 SearchFilenameExtensions=".dll">
576 <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixExtensionPaths" />
577 </ResolveWixReferences>
578
579 <!-- Remove duplicate extension items that would cause build errors -->
580 <RemoveDuplicates Inputs="@(_AllResolvedWixExtensionPaths)">
581 <Output TaskParameter="Filtered" ItemName="_ResolvedWixExtensionPaths" />
582 </RemoveDuplicates>
583 </Target>
584
585 <!--
586 ================================================================================================
587 GetTargetPath - OVERRIDE DependsOn
588
589 This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be
590 produced if we built this project.
591 ================================================================================================
592 -->
593 <PropertyGroup>
594 <GetTargetPathDependsOn>AssignCultures</GetTargetPathDependsOn>
595 </PropertyGroup>
596
597
598 <!--
599 //////////////////////////////////////////////////////////////////////////////////////////////////
600 //////////////////////////////////////////////////////////////////////////////////////////////////
601 DoIt Targets
602 //////////////////////////////////////////////////////////////////////////////////////////////////
603 //////////////////////////////////////////////////////////////////////////////////////////////////
604 -->
605
606 <!--
607 ==================================================================================================
608 DoIt
609 ==================================================================================================
610 -->
611 <PropertyGroup>
612 <DoItDependsOn>
613 PrepareForBuild;
614 ResolveReferences;
615 BeforeCompile;
616 _TimeStampBeforeCompile;
617 Harvest;
618
619 CalculateDefineConstants;
620 GenerateCompileWithObjectPath;
621
622 AssignCultures;
623 ReadPreviousBindInputsAndBuiltOutputs;
624
625 ActuallyDoIt;
626
627 UpdateLinkFileWrites;
628 _TimeStampAfterCompile;
629 AfterCompile
630 </DoItDependsOn>
631 </PropertyGroup>
632 <Target
633 Name="DoIt"
634 DependsOnTargets="$(DoItDependsOn)" />
635
636 <Target
637 Name="ActuallyDoIt"
638
639 Inputs="@(Compile);
640 @(Content);
641 @(EmbeddedResource);
642 @(WixObject);
643 @(_ResolvedProjectReferencePaths);
644 @(_ResolvedWixLibraryPaths);
645 @(_ResolvedWixExtensionPaths);
646 @(_BindInputs);
647 $(MSBuildAllProjects)"
648 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
649 Condition=" '@(Compile)' != '' and ('$(OutputType)' == 'Bundle' or '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module')">
650
651
652 <PropertyGroup>
653 <PdbOutputFile>$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)</PdbOutputFile>
654 </PropertyGroup>
655
656 <DoIt
657 SourceFiles="@(_CompileWithObjectPath)"
658 LocalizationFiles="@(EmbeddedResource)"
659 ObjectFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(_ResolvedWixLibraryPaths)"
660
661 Cultures="%(CultureGroup.Identity)"
662
663 ExtensionDirectory="$(WixExtDir)"
664 Extensions="@(_ResolvedWixExtensionPaths)"
665
666 IntermediateDirectory="$(IntermediateOutputPath)"
667
668 OutputFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)"
669 PdbOutputFile="$(PdbOutputFile)"
670
671 AdditionalOptions="$(CompilerAdditionalOptions) $(LinkerAdditionalOptions)"
672 DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)"
673 IncludeSearchPaths="$(IncludeSearchPaths)"
674 InstallerPlatform="$(InstallerPlatform)"
675 NoLogo="true"
676 Pedantic="$(Pedantic)"
677 ReferencePaths="$(ReferencePaths)"
678
679 SuppressSpecificWarnings="$(CompilerSuppressSpecificWarnings);$(LinkerSuppressSpecificWarnings)"
680 TreatSpecificWarningsAsErrors="$(CompilerTreatSpecificWarningsAsErrors)"
681
682 BindInputPaths="@(LinkerBindInputPaths)"
683 BindFiles="$(LinkerBindFiles)"
684 BindContentsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)"
685 BindOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"
686 BindBuiltOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"
687
688 CabinetCachePath="$(CabinetCachePath)"
689 CabinetCreationThreadCount="$(CabinetCreationThreadCount)"
690 DefaultCompressionLevel="$(DefaultCompressionLevel)"
691
692 UnreferencedSymbolsFile="$(UnreferencedSymbolsFile)"
693 WixProjectFile="$(ProjectPath)"
694 WixVariables="$(WixVariables)"
695
696 SuppressValidation="$(SuppressValidation)"
697 SuppressIces="$(SuppressIces)"
698 AdditionalCub="$(AdditionalCub)" />
699
700 <!--
701 SuppressAllWarnings="$(CompilerSuppressAllWarnings);$(LinkerSuppressAllWarnings)"
702 TreatWarningsAsErrors="$(CompilerTreatWarningsAsErrors);$(LinkerTreatWarningsAsErrors)"
703 VerboseOutput="$(CompilerVerboseOutput);$(LinkerVerboseOutput)"
704 -->
705
706</Target>
707
708
709 <!--
710 //////////////////////////////////////////////////////////////////////////////////////////////////
711 //////////////////////////////////////////////////////////////////////////////////////////////////
712 CompileAndLink Targets
713 //////////////////////////////////////////////////////////////////////////////////////////////////
714 //////////////////////////////////////////////////////////////////////////////////////////////////
715 -->
716
717 <!--
718 ==================================================================================================
719 CompileAndLink
720 ==================================================================================================
721 -->
722 <PropertyGroup>
723 <CompileAndLinkDependsOn>
724 ResolveReferences;
725 BeforeCompile;
726 _TimeStampBeforeCompile;
727 Harvest;
728 Compile;
729 Lib;
730 Link;
731 UpdateLinkFileWrites;
732 _TimeStampAfterCompile;
733 AfterCompile
734 </CompileAndLinkDependsOn>
735 </PropertyGroup>
736 <Target
737 Name="CompileAndLink"
738 DependsOnTargets="$(CompileAndLinkDependsOn)" />
739
740 <!--
741 ==================================================================================================
742 CalculateDefineConstants
743
744 Adds project references to the constants passed into the compiler.
745
746 [IN]
747 @(_ResolvedProjectReferencePaths) - paths to projects' outputs
748 $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE
749
750 [OUT]
751 $(ProjectReferenceDefineConstants) - the list of referenced project variables to be passed into the compiler
752 ==================================================================================================
753 -->
754 <PropertyGroup>
755 <CalculateDefineConstantsDependsOn>ResolveReferences</CalculateDefineConstantsDependsOn>
756 </PropertyGroup>
757 <Target
758 Name="CalculateDefineConstants"
759 DependsOnTargets="$(CalculateDefineConstantsDependsOn)"
760 Condition=" '@(_ResolvedProjectReferencePaths)' != '' ">
761
762 <PropertyGroup>
763 <ProjectDefineConstants>
764 Configuration=$(ConfigurationName);
765 OutDir=$(OutDir);
766 Platform=$(PlatformName);
767 ProjectDir=$(ProjectDir);
768 ProjectExt=$(ProjectExt);
769 ProjectFileName=$(ProjectFileName);
770 ProjectName=$(ProjectName);
771 ProjectPath=$(ProjectPath);
772 TargetDir=$(TargetDir);
773 TargetExt=$(TargetExt);
774 TargetFileName=$(TargetFileName);
775 TargetName=$(TargetName);
776 TargetPath=$(TargetPath);
777 </ProjectDefineConstants>
778 </PropertyGroup>
779
780 <PropertyGroup>
781 <SolutionDefineConstants Condition=" '$(DevEnvDir)'!='*Undefined*' ">$(SolutionDefineConstants);DevEnvDir=$(DevEnvDir)</SolutionDefineConstants>
782 <SolutionDefineConstants Condition=" '$(SolutionDir)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionDir=$(SolutionDir)</SolutionDefineConstants>
783 <SolutionDefineConstants Condition=" '$(SolutionExt)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionExt=$(SolutionExt)</SolutionDefineConstants>
784 <SolutionDefineConstants Condition=" '$(SolutionFileName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionFileName=$(SolutionFileName)</SolutionDefineConstants>
785 <SolutionDefineConstants Condition=" '$(SolutionName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionName=$(SolutionName)</SolutionDefineConstants>
786 <SolutionDefineConstants Condition=" '$(SolutionPath)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionPath=$(SolutionPath)</SolutionDefineConstants>
787 </PropertyGroup>
788
789 <CreateProjectReferenceDefineConstants
790 ProjectReferencePaths="@(_ResolvedProjectReferencePaths)"
791 ProjectConfigurations="$(VSProjectConfigurations)">
792
793 <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" />
794 </CreateProjectReferenceDefineConstants>
795 </Target>
796
797 <!--
798 ================================================================================================
799 GenerateCompileWithObjectPath
800
801 Generates metadata on the for compile output objects.
802
803 ================================================================================================
804 -->
805 <PropertyGroup>
806 <GenerateCompileWithObjectPathDependsOn></GenerateCompileWithObjectPathDependsOn>
807 </PropertyGroup>
808 <Target
809 Name="GenerateCompileWithObjectPath"
810 Condition=" '@(Compile)' != '' ">
811
812 <GenerateCompileWithObjectPath
813 Compile="@(Compile)"
814 IntermediateOutputPath="$(IntermediateOutputPath)">
815 <Output TaskParameter="CompileWithObjectPath" ItemName="_CompileWithObjectPath" />
816 </GenerateCompileWithObjectPath>
817
818 </Target>
819
820 <!--
821 ================================================================================================
822 Compile
823
824 Compiles the wxs files into wixobj files using candle.exe.
825
826 [IN]
827 @(Compile) - The list of wxs files to compile.
828 @(Content) - Files that the project uses in the installer.
829 @(WixExtension) - The list of wixlib or wix dll extensions.
830
831 [OUT]
832 @(CompileObjOutput) - The compiled .wixobj files.
833 ================================================================================================
834 -->
835 <PropertyGroup>
836 <CompileDependsOn>
837 PrepareForBuild;
838 ResolveReferences;
839 CalculateDefineConstants;
840 GenerateCompileWithObjectPath
841 </CompileDependsOn>
842 </PropertyGroup>
843 <Target
844 Name="Compile"
845 Inputs="@(Compile);
846 @(Content);
847 @(_ResolvedWixExtensionPaths);
848 @(_ResolvedProjectReferencePaths);
849 $(MSBuildAllProjects)"
850 Outputs="@(_CompileWithObjectPath -> '%(ObjectPath)%(Filename).wixobj')"
851 DependsOnTargets="$(CompileDependsOn)"
852 Condition=" '@(Compile)' != '' ">
853
854 <Candle
855 SourceFiles="@(_CompileWithObjectPath)"
856 AdditionalOptions="$(CompilerAdditionalOptions)"
857 DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)"
858 ExtensionDirectory="$(WixExtDir)"
859 Extensions="@(_ResolvedWixExtensionPaths)"
860 PreprocessToStdOut="$(PreprocessToStdOut)"
861 PreprocessToFile="$(PreprocessToFile)"
862 IncludeSearchPaths="$(IncludeSearchPaths)"
863 InstallerPlatform="$(InstallerPlatform)"
864 IntermediateDirectory="$(IntermediateOutputPath)"
865 NoLogo="$(CompilerNoLogo)"
866 OutputFile="%(_CompileWithObjectPath.ObjectPath)"
867 Pedantic="$(Pedantic)"
868 ReferencePaths="$(ReferencePaths)"
869 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
870 SuppressAllWarnings="$(CompilerSuppressAllWarnings)"
871 SuppressSpecificWarnings="$(CompilerSuppressSpecificWarnings)"
872 ToolPath="$(WixToolDir)"
873 TreatWarningsAsErrors="$(CompilerTreatWarningsAsErrors)"
874 TreatSpecificWarningsAsErrors="$(CompilerTreatSpecificWarningsAsErrors)"
875 VerboseOutput="$(CompilerVerboseOutput)">
876 </Candle>
877
878 <!-- These will be still be set even if the Compile target is up to date. -->
879 <ItemGroup>
880 <CompileObjOutput Include="@(_CompileWithObjectPath -> '%(ObjectPath)%(Filename).wixobj')" />
881 <FileWrites Include="@(CompileObjOutput)" />
882 </ItemGroup>
883 </Target>
884
885 <!--
886 ================================================================================================
887 Lib
888
889 Links the .wixobj, .wxl, .wixlib, wix extensions into a .wixlib file using lit.exe.
890
891 [IN]
892 @(CompileObjOutput) - The compiled .wixobj file.
893 @(EmbeddedResource) - The list of wxl files to use for localization.
894 @(WixObject) - The list of .wixobj files.
895 @(WixLibrary) - The list of .wixlib files.
896 @(WixExtension) - The list of wix dll extension files.
897
898 [OUT]
899 $(TargetPath) - The compiled .wixlib file.
900 ================================================================================================
901 -->
902 <PropertyGroup>
903 <LibDependsOn>
904 PrepareForBuild;
905 ResolveReferences
906 </LibDependsOn>
907 </PropertyGroup>
908 <Target
909 Name="Lib"
910 Inputs="@(CompileObjOutput);
911 @(EmbeddedResource);
912 @(WixObject);
913 @(WixLibrary);
914 @(_ResolvedWixExtensionPaths);
915 $(MSBuildAllProjects)"
916 Outputs="$(TargetPath)"
917 DependsOnTargets="$(LibDependsOn)"
918 Condition=" '$(OutputType)' == 'Library' ">
919
920 <Lit
921 ObjectFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(WixLibrary)"
922 AdditionalOptions="$(LibAdditionalOptions)"
923 BindInputPaths="@(LinkerBindInputPaths)"
924 BindFiles="$(LibBindFiles)"
925 ExtensionDirectory="$(WixExtDir)"
926 Extensions="@(_ResolvedWixExtensionPaths)"
927 LocalizationFiles="@(EmbeddedResource)"
928 NoLogo="$(LibNoLogo)"
929 OutputFile="$(TargetPath)"
930 Pedantic="$(LibPedantic)"
931 ReferencePaths="$(ReferencePaths)"
932 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
933 SuppressAllWarnings="$(LibSuppressAllWarnings)"
934 SuppressIntermediateFileVersionMatching="$(LibSuppressIntermediateFileVersionMatching)"
935 SuppressSchemaValidation="$(LibSuppressSchemaValidation)"
936 SuppressSpecificWarnings="$(LibSuppressSpecificWarnings)"
937 ToolPath="$(WixToolDir)"
938 TreatWarningsAsErrors="$(LibTreatWarningsAsErrors)"
939 VerboseOutput="$(LibVerboseOutput)" />
940 </Target>
941
942 <!--
943 ================================================================================================
944 AssignCultures
945
946 Determines the final list of culture groups to build based on either the Cultures property or
947 those specified in .wxl files.
948
949 Culture groups specified in the Cultures property must be specified as a semi-colon
950 delimited list of groups, with comma-delimited cultures within a group.
951 For example:
952 <Cultures>en-US,en;en-GB,en</Cultures>
953 This will build 2 targets, outputing to en-US and en-GB sub-folders. Light will first look
954 for strings in the first culture (en-US or en-GB) then the second (en).
955
956 Cultures of .wxl files will be used when the Culture property is not set. The culture of a
957 .wxl file is determined by the Culture attribute in the WixLocalization element in the file
958
959 Sets the OutputFolder metadata on each culture group. In most cases this is the same as the
960 first culture in the culture group. When the Culture's property is unspecified and no .wxl
961 files are provided this is the same as the output directory. When the Culture's property
962 specifies a single culture group and no .wxl files are provided this is the same as the output
963 directory.
964
965 Updates the TargetPath and TargetPdbPath properties to be used in subsequent targets.
966
967 [IN]
968 @(EmbeddedResource) - The list of wxl files to use for localization.
969 $(Cultures) - The list of culture groups to build.
970
971 [OUT]
972 @(CultureGroup) - The list of culture group strings with OutputFolder metadata
973 $(TargetPath) - Property list of target link output MSIs/MSMs
974 $(TargetPdbPath) - Property list of target output pdbs
975 @(SignTargetPath) - The list of target to be signed
976
977 ================================================================================================
978 -->
979 <Target
980 Name="AssignCultures"
981 Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
982
983 <WixAssignCulture
984 Cultures="$(Cultures)"
985 Files="@(EmbeddedResource)">
986
987 <Output TaskParameter="CultureGroups" ItemName="CultureGroup" />
988 </WixAssignCulture>
989
990 <!-- Build an itemgroup of outputs -->
991 <ItemGroup>
992 <_TargetPathItems Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)" />
993 <_TargetPdbPathItems Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)" />
994 </ItemGroup>
995
996 <!-- Convert the itemgroup to a semicolon-delimited property -->
997 <PropertyGroup>
998 <TargetPath>@(_TargetPathItems)</TargetPath>
999 <TargetPdbPath>@(_TargetPdbPathItems)</TargetPdbPath>
1000 </PropertyGroup>
1001
1002 <!-- Set the sign target items, if we're signing output. -->
1003 <ItemGroup Condition=" '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' ">
1004 <SignTargetPath Include="@(_TargetPathItems)" />
1005 </ItemGroup>
1006 </Target>
1007
1008 <!--
1009 ================================================================================================
1010 ReadPreviousBindInputsAndBuiltOutputs
1011
1012 Reads a previous build's Bind contents and built outputs file into @(_BindInputs) and
1013 @(_BindBuiltOutputs) respectively.
1014
1015 Note: Only the *built* outputs are used because using files copied to output folder
1016 can cause perpetual incremental build.
1017
1018 Imagine the case where you have: Msi.wixproj -> Lib.wixproj -> Exe.csproj. The
1019 Exe.csproj cannot be both an input to Lib.wixproj and an output of Msi.wixproj
1020 (as an uncompressed file) because the Lib.wixproj will always newer than the
1021 Exe.csproj.
1022
1023 [IN]
1024
1025 [OUT]
1026 @(_BindInputs) - the content files required to bind (i.e. the Binary/@SourceFile and File/@Source files).
1027 @(_BindBuiltOutputs) - the previously built .msi, .msm, .pcp, .exe .wixpdb, .cabs, etc.
1028 Does not include content copied to output folder.
1029 ================================================================================================
1030 -->
1031 <Target
1032 Name="ReadPreviousBindInputsAndBuiltOutputs"
1033 Condition=" '$(OutputType)' == 'Bundle' or '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
1034
1035 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)">
1036 <Output TaskParameter="Lines" ItemName="_BindInputs" />
1037 </ReadLinesFromFile>
1038
1039 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)">
1040 <Output TaskParameter="Lines" ItemName="_BindBuiltOutputs" />
1041 </ReadLinesFromFile>
1042
1043 <Message Importance="low" Text="Previous bind inputs: @(_BindInputs)" />
1044 <Message Importance="low" Text="Previous bind outputs: @(_BindBuiltOutputs)" />
1045 </Target>
1046
1047 <!--
1048 ================================================================================================
1049 Link
1050
1051 Links the .wixobj, .wxl, .wixlib, wix extensions into an .msi or .msm file using light.exe,
1052 once per culture group. All WXL files are passed into light and the culture switch determines
1053 which are used
1054
1055 [IN]
1056 @(CompileObjOutput) - The compiled .wixobj file.
1057 @(CultureGroup) - The cultures to build
1058 @(EmbeddedResource) - The list of wxl files to use for localization.
1059 @(WixObject) - The list of .wixobj files.
1060 @(WixLibrary) - The list of .wixlib files.
1061 @(WixExtension) - The list of wix dll extension files.
1062
1063 [OUT]
1064 $(TargetDir)\%(Culture)\$(TargetName)$(TargetExt) - The compiled .msi, .msm, or .exe files.
1065 ================================================================================================
1066 -->
1067 <PropertyGroup>
1068 <LinkDependsOn>
1069 PrepareForBuild;
1070 ResolveReferences;
1071 AssignCultures;
1072 ReadPreviousBindInputsAndBuiltOutputs;
1073 </LinkDependsOn>
1074 </PropertyGroup>
1075 <Target
1076 Name="Link"
1077 Inputs="@(CompileObjOutput);
1078 @(EmbeddedResource);
1079 @(WixObject);
1080 @(_ResolvedProjectReferencePaths);
1081 @(_ResolvedWixLibraryPaths);
1082 @(_ResolvedWixExtensionPaths);
1083 $(MSBuildAllProjects);
1084 @(_BindInputs)"
1085 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
1086 DependsOnTargets="$(LinkDependsOn)"
1087 Condition=" '$(OutputType)' == 'Bundle' or '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
1088
1089 <PropertyGroup>
1090 <PdbOutputFile>$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)</PdbOutputFile>
1091 </PropertyGroup>
1092
1093 <!-- Call light using the culture subdirectory for output -->
1094 <Light
1095 ObjectFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(_ResolvedWixLibraryPaths)"
1096 AdditionalOptions="$(LinkerAdditionalOptions)"
1097 AllowIdenticalRows="$(AllowIdenticalRows)"
1098 AllowUnresolvedReferences="$(AllowUnresolvedReferences)"
1099 AdditionalCub="$(AdditionalCub)"
1100 BackwardsCompatibleGuidGeneration="$(BackwardsCompatibleGuidGeneration)"
1101 BindInputPaths="@(LinkerBindInputPaths)"
1102 BindFiles="$(LinkerBindFiles)"
1103 BindContentsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)"
1104 BindOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"
1105 BindBuiltOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"
1106 CabinetCachePath="$(CabinetCachePath)"
1107 CabinetCreationThreadCount="$(CabinetCreationThreadCount)"
1108 Cultures="%(CultureGroup.Identity)"
1109 CustomBinder="$(CustomBinder)"
1110 DefaultCompressionLevel="$(DefaultCompressionLevel)"
1111 DropUnrealTables="$(DropUnrealTables)"
1112 ExactAssemblyVersions="$(ExactAssemblyVersions)"
1113 ExtensionDirectory="$(WixExtDir)"
1114 Extensions="@(_ResolvedWixExtensionPaths)"
1115 Ices="$(Ices)"
1116 LeaveTemporaryFiles="$(LeaveTemporaryFiles)"
1117 LocalizationFiles="@(EmbeddedResource)"
1118 NoLogo="$(LinkerNoLogo)"
1119 OutputAsXml="$(OutputAsXml)"
1120 OutputFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)"
1121 PdbOutputFile="$(PdbOutputFile)"
1122 Pedantic="$(LinkerPedantic)"
1123 ReferencePaths="$(ReferencePaths)"
1124 ReuseCabinetCache="$(ReuseCabinetCache)"
1125 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
1126 SuppressAclReset="$(SuppressAclReset)"
1127 SuppressAllWarnings="$(LinkerSuppressAllWarnings)"
1128 SuppressAssemblies="$(SuppressAssemblies)"
1129 SuppressDefaultAdminSequenceActions="$(SuppressDefaultAdminSequenceActions)"
1130 SuppressDefaultAdvSequenceActions="$(SuppressDefaultAdvSequenceActions)"
1131 SuppressDefaultUISequenceActions="$(SuppressDefaultUISequenceActions)"
1132 SuppressFileHashAndInfo="$(SuppressFileHashAndInfo)"
1133 SuppressFiles="$(SuppressFiles)"
1134 SuppressIntermediateFileVersionMatching="$(LinkerSuppressIntermediateFileVersionMatching)"
1135 SuppressIces="$(SuppressIces)"
1136 SuppressLayout="$(SuppressLayout)"
1137 SuppressLocalization="$(SuppressLocalization)"
1138 SuppressMsiAssemblyTableProcessing="$(SuppressMsiAssemblyTableProcessing)"
1139 SuppressPdbOutput="$(SuppressPdbOutput)"
1140 SuppressSchemaValidation="$(LinkerSuppressSchemaValidation)"
1141 SuppressValidation="$(SuppressValidation)"
1142 SuppressSpecificWarnings="$(LinkerSuppressSpecificWarnings)"
1143 SuppressTagSectionIdAttributeOnTuples="$(SuppressTagSectionIdAttributeOnTuples)"
1144 ToolPath="$(WixToolDir)"
1145 TreatWarningsAsErrors="$(LinkerTreatWarningsAsErrors)"
1146 UnreferencedSymbolsFile="$(UnreferencedSymbolsFile)"
1147 VerboseOutput="$(LinkerVerboseOutput)"
1148 WixProjectFile="$(ProjectPath)"
1149 WixVariables="$(WixVariables)" />
1150 </Target>
1151
1152 <!--
1153 ================================================================================================
1154 UpdateLinkFileWrites
1155
1156 Reads the bind outputs file(s) output generated during Link to correctly set the @(FileWrites)
1157 item. Most targets have it easy because they can do a static mapping from inputs to the outputs.
1158 However, the Link target outputs are determined after a rather complex calculation we call
1159 linking and binding!
1160
1161 This target runs independently after Link to ensure that @(FileWrites) is updated even if the
1162 "Light" task fails.
1163
1164 [IN]
1165 Path to bind outputs file(s).
1166
1167 [OUT]
1168 @(FileWrites) updated with outputs from bind.
1169 ================================================================================================
1170 -->
1171 <Target
1172 Name="UpdateLinkFileWrites"
1173 Condition=" '$(OutputType)' == 'Bundle' or '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
1174
1175 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1176 <Output TaskParameter="Lines" ItemName="FileWrites"/>
1177 </ReadLinesFromFile>
1178
1179 <ItemGroup>
1180 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)" />
1181 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)" />
1182 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)" />
1183 </ItemGroup>
1184
1185 <Message Importance="low" Text="Build files after link: @(FileWrites)" />
1186 </Target>
1187
1188 <!--
1189 //////////////////////////////////////////////////////////////////////////////////////////////////
1190 //////////////////////////////////////////////////////////////////////////////////////////////////
1191 AllProjectOutputGroups Section
1192 //////////////////////////////////////////////////////////////////////////////////////////////////
1193 //////////////////////////////////////////////////////////////////////////////////////////////////
1194 -->
1195
1196 <!--
1197 ==================================================================================================
1198 AllProjectOutputGroups - OVERRIDE Target
1199
1200 ==================================================================================================
1201 -->
1202 <Target
1203 Name="AllProjectOutputGroups"
1204 DependsOnTargets="
1205 BuiltProjectOutputGroup;
1206 DebugSymbolsProjectOutputGroup;
1207 SourceFilesProjectOutputGroup;
1208 ContentFilesProjectOutputGroup" />
1209
1210 <!--
1211 This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE.
1212 Reading an item is faster than invoking a target.
1213 -->
1214 <ItemGroup>
1215 <BuiltProjectOutputGroupKeyOutput Include="$(TargetPath)">
1216 <IsKeyOutput>true</IsKeyOutput>
1217 <FinalOutputPath>$(TargetPath)</FinalOutputPath>
1218 <TargetPath>$(TargetFileName)</TargetPath>
1219 </BuiltProjectOutputGroupKeyOutput>
1220 </ItemGroup>
1221
1222 <!--
1223 ==================================================================================================
1224 BuiltProjectOutputGroup - OVERRIDE Target
1225 ==================================================================================================
1226 -->
1227 <PropertyGroup>
1228 <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignCultures</BuiltProjectOutputGroupDependsOn>
1229 </PropertyGroup>
1230 <Target
1231 Name="BuiltProjectOutputGroup"
1232 Outputs="@(BuiltProjectOutputGroupOutput)"
1233 DependsOnTargets="$(BuiltProjectOutputGroupDependsOn)">
1234
1235 <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below -->
1236
1237 <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from linker. -->
1238 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1239 <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/>
1240 </ReadLinesFromFile>
1241
1242 <!-- If we didn't get anything from the bind outputs text file, default to the target path. -->
1243 <ItemGroup Condition=" '@(_BuiltProjectOutputGroupOutputIntermediate)'=='' ">
1244 <_BuiltProjectOutputGroupOutputIntermediate Include="$(TargetPath)" />
1245 </ItemGroup>
1246
1247 <!-- Convert intermediate items into final items; this way we can get the full path for each item -->
1248 <ItemGroup>
1249 <BuiltProjectOutputGroupOutput Include="@(_BuiltProjectOutputGroupOutputIntermediate->'%(FullPath)')">
1250 <!-- For compatibility with 2.0 -->
1251 <OriginalItemSpec Condition="'%(_BuiltProjectOutputGroupOutputIntermediate.OriginalItemSpec)' == ''">%(_BuiltProjectOutputGroupOutputIntermediate.FullPath)</OriginalItemSpec>
1252 </BuiltProjectOutputGroupOutput>
1253 </ItemGroup>
1254 </Target>
1255
1256 <!--
1257 ==================================================================================================
1258 DebugSymbolsProjectOutputGroup
1259
1260 Populates the Debug Symbols project output group.
1261 ==================================================================================================
1262 -->
1263 <PropertyGroup>
1264 <DebugSymbolsProjectOutputGroupDependsOn>AssignCultures</DebugSymbolsProjectOutputGroupDependsOn>
1265 </PropertyGroup>
1266 <Target
1267 Name="DebugSymbolsProjectOutputGroup"
1268 Outputs="@(DebugSymbolsProjectOutputGroupOutput)"
1269 DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)">
1270
1271 <!-- Include build output pdb(s). Different than predefined itemgroup since AssignCultures target may change -->
1272 <ItemGroup>
1273 <DebugSymbolsProjectOutputGroupOutput Include="$(TargetPdbPath)" Condition=" '$(SuppressPdbOutput)' != 'true' "/>
1274 </ItemGroup>
1275 </Target>
1276
1277
1278 <!--
1279 ==================================================================================================
1280 CopyFilesToOutputDirectory - OVERRIDE Target
1281
1282 Copy all build outputs, satellites and other necessary files to the final directory.
1283 ============================================================
1284 -->
1285 <Target
1286 Name="CopyFilesToOutputDirectory">
1287
1288 <PropertyGroup>
1289 <!-- By default we're using hard links to copy to the output directory, disabling this could slow the build significantly -->
1290 <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition=" '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == '' ">true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>
1291 </PropertyGroup>
1292
1293 <PropertyGroup>
1294 <CopyBuildOutputToOutputDirectory Condition="'$(CopyBuildOutputToOutputDirectory)'==''">true</CopyBuildOutputToOutputDirectory>
1295 <CopyOutputSymbolsToOutputDirectory Condition="'$(CopyOutputSymbolsToOutputDirectory)'==''">true</CopyOutputSymbolsToOutputDirectory>
1296 <FullIntermediateOutputPath>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)))</FullIntermediateOutputPath>
1297 </PropertyGroup>
1298
1299 <!-- Copy the bound files. -->
1300 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1301 <Output TaskParameter="Lines" ItemName="_FullPathToCopy"/>
1302 </ReadLinesFromFile>
1303
1304 <ItemGroup>
1305 <_FullPathToCopy Include="$(TargetPath)" Condition=" '@(_FullPathToCopy)'=='' " />
1306 <_RelativePath Include="$([MSBuild]::MakeRelative($(FullIntermediateOutputPath), %(_FullPathToCopy.Identity)))" />
1307 </ItemGroup>
1308
1309 <Copy
1310 SourceFiles="@(_RelativePath->'$(IntermediateOutputPath)%(Identity)')"
1311 DestinationFiles="@(_RelativePath->'$(OutDir)%(Identity)')"
1312 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
1313 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
1314 Retries="$(CopyRetryCount)"
1315 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
1316 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
1317 Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
1318 >
1319
1320 <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
1321 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
1322
1323 </Copy>
1324
1325 <Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(TargetPath)" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />
1326 <!--<Message Importance="High" Text="$(MSBuildProjectName) -&gt; @(MainAssembly->'%(FullPath)')" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />-->
1327
1328 <!-- Copy the debug information file (.pdb), if any
1329 <Copy
1330 SourceFiles="@(_DebugSymbolsIntermediatePath)"
1331 DestinationFiles="@(_DebugSymbolsOutputPath)"
1332 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
1333 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
1334 Retries="$(CopyRetryCount)"
1335 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
1336 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
1337 Condition="'$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true' and '$(CopyOutputSymbolsToOutputDirectory)'=='true'">
1338
1339 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
1340
1341 </Copy>
1342 -->
1343 </Target>
1344
1345
1346 <Import Project="$(WixHarvestTargetsPath)" Condition=" '$(WixHarvestTargetsPath)' != '' and Exists('$(WixHarvestTargetsPath)')" />
1347 <Import Project="$(WixSigningTargetsPath)" Condition=" '$(WixSigningTargetsPath)' != '' and Exists('$(WixSigningTargetsPath)')" />
1348 <Import Project="$(LuxTargetsPath)" Condition=" '$(LuxTargetsPath)' != '' and Exists('$(LuxTargetsPath)')" />
1349
1350 <!-- Extension point: Define CustomAfterWixTargets to a .targets file that you want to include after this file. -->
1351 <Import Project="$(CustomAfterWixTargets)" Condition=" '$(CustomAfterWixTargets)' != '' and Exists('$(CustomAfterWixTargets)')" />
1352
1353</Project>