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