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