aboutsummaryrefslogtreecommitdiff
path: root/src/tools/WixToolset.Heat
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/WixToolset.Heat/WixToolset.Heat.csproj12
-rw-r--r--src/tools/WixToolset.Heat/WixToolset.Heat.nuspec24
-rw-r--r--src/tools/WixToolset.Heat/WixToolset.Heat.targets526
-rw-r--r--src/tools/WixToolset.HeatTasks/HeatDirectory.cs48
-rw-r--r--src/tools/WixToolset.HeatTasks/HeatFile.cs45
-rw-r--r--src/tools/WixToolset.HeatTasks/HeatProject.cs73
-rw-r--r--src/tools/WixToolset.HeatTasks/HeatTask.cs52
-rw-r--r--src/tools/WixToolset.HeatTasks/RefreshBundleGeneratedFile.cs104
-rw-r--r--src/tools/WixToolset.HeatTasks/RefreshGeneratedFile.cs91
-rw-r--r--src/tools/WixToolset.HeatTasks/RefreshTask.cs59
-rw-r--r--src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj17
11 files changed, 0 insertions, 1051 deletions
diff --git a/src/tools/WixToolset.Heat/WixToolset.Heat.csproj b/src/tools/WixToolset.Heat/WixToolset.Heat.csproj
deleted file mode 100644
index 2166028a..00000000
--- a/src/tools/WixToolset.Heat/WixToolset.Heat.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
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 Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFrameworks>net6.0</TargetFrameworks>
7 <Description>WiX Toolset Heat MSBuild integration</Description>
8 <PublishDir>$(PublishRoot)WixToolset.Heat\</PublishDir>
9 <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile>
10 <NuspecBasePath>$(PublishDir)</NuspecBasePath>
11 </PropertyGroup>
12</Project>
diff --git a/src/tools/WixToolset.Heat/WixToolset.Heat.nuspec b/src/tools/WixToolset.Heat/WixToolset.Heat.nuspec
deleted file mode 100644
index 48e94797..00000000
--- a/src/tools/WixToolset.Heat/WixToolset.Heat.nuspec
+++ /dev/null
@@ -1,24 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3 <metadata>
4 <id>$id$</id>
5 <version>$version$</version>
6 <title>$title$</title>
7 <description>$description$</description>
8 <authors>$authors$</authors>
9 <icon>icon.png</icon>
10 <license type="file">OSMFEULA.txt</license>
11 <requireLicenseAcceptance>true</requireLicenseAcceptance>
12 <tags>$packageTags$</tags>
13 <copyright>$copyright$</copyright>
14 <projectUrl>$projectUrl$</projectUrl>
15 <repository type="$repositorytype$" url="$repositoryurl$" commit="$repositorycommit$" />
16 </metadata>
17
18 <files>
19 <file src="$eulaTxt$" />
20 <file src="$iconPng$" />
21 <file src="$projectFolder$\$id$.targets" target="build" />
22 <file src="tools\**\*" target="tools" />
23 </files>
24</package>
diff --git a/src/tools/WixToolset.Heat/WixToolset.Heat.targets b/src/tools/WixToolset.Heat/WixToolset.Heat.targets
deleted file mode 100644
index c20bd194..00000000
--- a/src/tools/WixToolset.Heat/WixToolset.Heat.targets
+++ /dev/null
@@ -1,526 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6 <!-- These properties can be overridden to support non-default installations. -->
7 <PropertyGroup>
8 <WixHeatBinDir Condition=" '$(WixHeatBinDir)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">$(MSBuildThisFileDirectory)..\tools\net6.0\</WixHeatBinDir>
9 <WixHeatBinDir Condition=" '$(WixHeatBinDir)' == '' ">$(MSBuildThisFileDirectory)..\tools\net472\</WixHeatBinDir>
10 <WixHeatTasksPath Condition=" '$(WixHeatTasksPath)' == '' ">$(WixHeatBinDir)WixToolset.HeatTasks.dll</WixHeatTasksPath>
11
12 <!--
13 For backwards compatibility, the MSBuild tasks always default to the x86 heat.exe even though a x64 heat.exe is available.
14 For "dotnet.exe build" the Heat tasks calculate the command-line to start heat.dll in .NET Core.
15 -->
16 <HeatToolDir Condition=" '$(HeatToolDir)' == '' and '$(MSBuildRuntimeType)' != 'Core' ">$(MSBuildThisFileDirectory)..\tools\net472\x86\</HeatToolDir>
17
18 <HeatExe Condition=" '$(HeatExe)' == '' ">$(MSBuildThisFileDirectory)..\tools\net472\x86\heat.exe</HeatExe>
19 <HeatExe64 Condition=" '$(HeatExe64)' == '' ">$(MSBuildThisFileDirectory)..\tools\net472\x64\heat.exe</HeatExe64>
20 </PropertyGroup>
21
22 <!-- These tasks are extensions for harvesting WiX source code from other sources. -->
23 <UsingTask TaskName="HeatFile" AssemblyFile="$(WixHeatTasksPath)" />
24 <UsingTask TaskName="HeatDirectory" AssemblyFile="$(WixHeatTasksPath)" />
25 <UsingTask TaskName="HeatProject" AssemblyFile="$(WixHeatTasksPath)" />
26
27 <UsingTask TaskName="RefreshGeneratedFile" AssemblyFile="$(WixHeatTasksPath)"/>
28 <UsingTask TaskName="RefreshBundleGeneratedFile" AssemblyFile="$(WixHeatTasksPath)"/>
29
30 <!-- Default Harvester properties-->
31 <PropertyGroup>
32 <HarvestNoLogo Condition=" '$(HarvestNoLogo)' == '' ">$(NoLogo)</HarvestNoLogo>
33 <HarvestSuppressAllWarnings Condition=" '$(HarvestSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</HarvestSuppressAllWarnings>
34 <HarvestSuppressSpecificWarnings Condition=" '$(HarvestSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</HarvestSuppressSpecificWarnings>
35 <HarvestTreatWarningsAsErrors Condition=" '$(HarvestTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</HarvestTreatWarningsAsErrors>
36 <HarvestTreatSpecificWarningsAsErrors Condition=" '$(HarvestTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</HarvestTreatSpecificWarningsAsErrors>
37 <HarvestVerboseOutput Condition=" '$(HarvestVerboseOutput)' == '' ">$(VerboseOutput)</HarvestVerboseOutput>
38 <HarvestAutogenerateGuids Condition=" '$(HarvestAutogenerateGuids)' == '' ">true</HarvestAutogenerateGuids>
39 <HarvestGenerateGuidsNow Condition=" '$(HarvestGenerateGuidsNow)' == '' ">false</HarvestGenerateGuidsNow>
40 <HarvestSuppressFragments Condition=" '$(HarvestSuppressFragments)' == '' ">true</HarvestSuppressFragments>
41 <HarvestSuppressUniqueIds Condition=" '$(HarvestSuppressUniqueIds)' == '' ">false</HarvestSuppressUniqueIds>
42 </PropertyGroup>
43
44 <!-- Default HarvestProjects properties -->
45 <PropertyGroup>
46 <!-- Project harvesting is defaulted to off until it works more consistently. -->
47 <EnableProjectHarvesting Condition=" '$(EnableProjectHarvesting)'=='' ">false</EnableProjectHarvesting>
48
49 <HarvestProjectsNoLogo Condition=" '$(HarvestProjectsNoLogo)' == '' ">$(HarvestNoLogo)</HarvestProjectsNoLogo>
50 <HarvestProjectsSuppressAllWarnings Condition=" '$(HarvestProjectsSuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestProjectsSuppressAllWarnings>
51 <HarvestProjectsSuppressSpecificWarnings Condition=" '$(HarvestProjectsSuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestProjectsSuppressSpecificWarnings>
52 <HarvestProjectsTreatWarningsAsErrors Condition=" '$(HarvestProjectsTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestProjectsTreatWarningsAsErrors>
53 <HarvestProjectsTreatSpecificWarningsAsErrors Condition=" '$(HarvestProjectsTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestProjectsTreatSpecificWarningsAsErrors>
54 <HarvestProjectsVerboseOutput Condition=" '$(HarvestProjectsVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestProjectsVerboseOutput>
55 <HarvestProjectsAutogenerateGuids Condition=" '$(HarvestProjectsAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestProjectsAutogenerateGuids>
56 <HarvestProjectsGenerateGuidsNow Condition=" '$(HarvestProjectsGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestProjectsGenerateGuidsNow>
57 <HarvestProjectsSuppressFragments Condition=" '$(HarvestProjectsSuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestProjectsSuppressFragments>
58 <HarvestProjectsSuppressUniqueIds Condition=" '$(HarvestProjectsSuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestProjectsSuppressUniqueIds>
59 <HarvestProjectsTransforms Condition=" '$(HarvestProjectsTransforms)' == '' ">$(HarvestTransforms)</HarvestProjectsTransforms>
60 <HarvestProjectsGeneratedFile Condition=" '$(HarvestProjectsGeneratedFile)' == '' and '$(OutputType)' != 'Bundle' ">$(IntermediateOutputPath)Product.Generated.wxs</HarvestProjectsGeneratedFile>
61 <HarvestProjectsGeneratedFile Condition=" '$(HarvestProjectsGeneratedFile)' == '' and '$(OutputType)' == 'Bundle' ">$(IntermediateOutputPath)Bundle.Generated.wxs</HarvestProjectsGeneratedFile>
62 <HarvestProjectsMsbuildBinPath Condition=" '$(HarvestProjectsMsbuildBinPath)' == '' ">$(MSBuildBinPath)</HarvestProjectsMsbuildBinPath>
63 </PropertyGroup>
64
65 <!-- Default HarvestDirectory properties -->
66 <PropertyGroup>
67 <HarvestDirectoryNoLogo Condition=" '$(HarvestDirectoryNoLogo)' == '' ">$(HarvestNoLogo)</HarvestDirectoryNoLogo>
68 <HarvestDirectorySuppressAllWarnings Condition=" '$(HarvestDirectorySuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestDirectorySuppressAllWarnings>
69 <HarvestDirectorySuppressSpecificWarnings Condition=" '$(HarvestDirectorySuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestDirectorySuppressSpecificWarnings>
70 <HarvestDirectoryTreatWarningsAsErrors Condition=" '$(HarvestDirectoryTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestDirectoryTreatWarningsAsErrors>
71 <HarvestDirectoryTreatSpecificWarningsAsErrors Condition=" '$(HarvestDirectoryTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestDirectoryTreatSpecificWarningsAsErrors>
72 <HarvestDirectoryVerboseOutput Condition=" '$(HarvestDirectoryVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestDirectoryVerboseOutput>
73 <HarvestDirectoryAutogenerateGuids Condition=" '$(HarvestDirectoryAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestDirectoryAutogenerateGuids>
74 <HarvestDirectoryGenerateGuidsNow Condition=" '$(HarvestDirectoryGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestDirectoryGenerateGuidsNow>
75 <HarvestDirectorySuppressFragments Condition=" '$(HarvestDirectorySuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestDirectorySuppressFragments>
76 <HarvestDirectorySuppressUniqueIds Condition=" '$(HarvestDirectorySuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestDirectorySuppressUniqueIds>
77 <HarvestDirectoryTransforms Condition=" '$(HarvestDirectoryTransforms)' == '' ">$(HarvestTransforms)</HarvestDirectoryTransforms>
78 </PropertyGroup>
79
80 <!-- Default HarvestFile properties -->
81 <PropertyGroup>
82 <HarvestFileNoLogo Condition=" '$(HarvestFileNoLogo)' == '' ">$(HarvestNoLogo)</HarvestFileNoLogo>
83 <HarvestFileSuppressAllWarnings Condition=" '$(HarvestFileSuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestFileSuppressAllWarnings>
84 <HarvestFileSuppressSpecificWarnings Condition=" '$(HarvestFileSuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestFileSuppressSpecificWarnings>
85 <HarvestFileTreatWarningsAsErrors Condition=" '$(HarvestFileTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestFileTreatWarningsAsErrors>
86 <HarvestFileTreatSpecificWarningsAsErrors Condition=" '$(HarvestFileTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestFileTreatSpecificWarningsAsErrors>
87 <HarvestFileVerboseOutput Condition=" '$(HarvestFileVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestFileVerboseOutput>
88 <HarvestFileAutogenerateGuids Condition=" '$(HarvestFileAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestFileAutogenerateGuids>
89 <HarvestFileGenerateGuidsNow Condition=" '$(HarvestFileGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestFileGenerateGuidsNow>
90 <HarvestFileSuppressFragments Condition=" '$(HarvestFileSuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestFileSuppressFragments>
91 <HarvestFileSuppressUniqueIds Condition=" '$(HarvestFileSuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestFileSuppressUniqueIds>
92 <HarvestFileTransforms Condition=" '$(HarvestFileTransforms)' == '' ">$(HarvestTransforms)</HarvestFileTransforms>
93 </PropertyGroup>
94
95 <!--
96 ==================================================================================================
97 Harvest
98 ==================================================================================================
99 -->
100 <PropertyGroup>
101 <CoreCompileDependsOn>
102 $(CoreCompileDependsOn);
103 Harvest
104 </CoreCompileDependsOn>
105 <HarvestDependsOn>
106 ConvertReferences;
107 ConvertBundleReferences;
108 HarvestProjects;
109 HarvestDirectory;
110 HarvestFile;
111 GenerateCode;
112 </HarvestDependsOn>
113 </PropertyGroup>
114 <Target
115 Name="Harvest"
116 DependsOnTargets="$(HarvestDependsOn)" />
117
118 <!--
119 ==================================================================================================
120 GenerateCode
121 ==================================================================================================
122 -->
123 <PropertyGroup>
124 <GenerateCodeDependsOn>
125 RefreshGeneratedFile;
126 RefreshBundleGeneratedFile
127 </GenerateCodeDependsOn>
128 </PropertyGroup>
129 <Target
130 Name="GenerateCode"
131 DependsOnTargets="$(GenerateCodeDependsOn)" />
132
133 <!--
134 ================================================================================================
135 ConvertReferences
136
137 Converts project references to HeatProject items to auto generate authoring.
138 ================================================================================================
139 -->
140 <Target
141 Name="ConvertReferences"
142 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module') ">
143
144 <ItemGroup>
145 <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' ">
146 <DirectoryIds>%(_MSBuildProjectReferenceExistent.RefTargetDir)</DirectoryIds>
147 <ProjectOutputGroups>Binaries;Symbols;Sources;Content;Satellites;Documents</ProjectOutputGroups>
148 <ProjectName>%(_MSBuildProjectReferenceExistent.Name)</ProjectName>
149 <HeatOutput>$(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs</HeatOutput>
150 </_HeatProjectReference>
151 <HeatProject Include="@(_HeatProjectReference)" />
152 </ItemGroup>
153
154 <ItemGroup>
155 <!-- Unconditionally generate Compile items so they are always linked in. -->
156 <Compile Include="$(HarvestProjectsGeneratedFile)" />
157 <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" />
158 </ItemGroup>
159
160 </Target>
161
162 <!--
163 ================================================================================================
164 ConvertBundleReferences
165
166 Converts project references in Bundle projects to HeatProject items to auto generate authoring.
167 ================================================================================================
168 -->
169 <Target
170 Name="ConvertBundleReferences"
171 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Bundle') ">
172
173 <ItemGroup>
174 <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' ">
175 <ProjectOutputGroups>Binaries;Symbols;Sources;Content;Satellites;Documents</ProjectOutputGroups>
176 <GenerateType>payloadgroup</GenerateType>
177 <HeatOutput>$(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs</HeatOutput>
178 </_HeatProjectReference>
179 <HeatProject Include="@(_HeatProjectReference)" />
180 </ItemGroup>
181
182 <ItemGroup>
183 <!-- Unconditionally generate Compile items so they are always linked in. -->
184 <Compile Include="$(HarvestProjectsGeneratedFile)" />
185 <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" />
186 </ItemGroup>
187
188 </Target>
189
190 <!--
191 ================================================================================================
192 CombineHarvestProjects
193
194 Combines HeatProject and HarvestProject items together and ensures each has HeatOutput metadata.
195 ================================================================================================
196 -->
197 <Target
198 Name="CombineHarvestProjects"
199 Condition=" '@(HeatProject)' != '' or '@(HarvestProject)' != '' ">
200
201 <!-- Add default HeatOutputs for those without one specified -->
202 <CreateItem Include="@(HeatProject)" Condition= " '%(HeatProject.HeatOutput)' == '' "
203 AdditionalMetadata="HeatOutput=$(IntermediateOutputPath)_%(HeatProject.Filename).wxs">
204 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
205 </CreateItem>
206 <CreateItem Include="@(HarvestProject)" Condition= " '%(HarvestProject.HeatOutput)' == '' "
207 AdditionalMetadata="HeatOutput=$(IntermediateOutputPath)_%(HarvestProject.Filename).wxs">
208 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
209 </CreateItem>
210
211
212 <CreateItem Include="@(HeatProject)" Condition= " '%(HeatProject.HeatOutput)' != '' ">
213 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
214 </CreateItem>
215 <CreateItem Include="@(HarvestProject)" Condition= " '%(HarvestProject.HeatOutput)' != '' ">
216 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
217 </CreateItem>
218
219 </Target>
220
221 <!--
222 ================================================================================================
223 HarvestProjects
224
225 Harvests outputs of other MSBuild projects files using the VS project extension to heat.exe.
226
227 [IN]
228 @(HarvestProject)
229 @(HeatProject)
230 - The list of projects to harvest. HeatProject is provided for backward compatibility.
231 You should use HarvestProject instead.
232
233 %(HarvestProject.Transforms)
234 %(HeatProject.Transforms)
235 - XSL transforms to apply to the harvested WiX.
236
237 %(HarvestProject.ProjectOutputGroups)
238 %(HeatProjects.ProjectOutputGroups)
239 - The project output groups to harvest
240
241 %(HarvestProject.AdditionalOptions)
242 %(HeatProjects.AdditionalOptions)
243 - Any additional harvesting command line options
244
245 [OUT]
246 %(HeatOutput)
247 - The generated .wxs files which are added to the @(Compile) item list.
248 ================================================================================================
249 -->
250 <ItemDefinitionGroup>
251 <HeatProject>
252 <Transforms>$(HarvestProjectsTransforms)</Transforms>
253 <ProjectOutputGroups>$(HarvestProjectsProjectOutputGroups)</ProjectOutputGroups>
254 <DirectoryIds>$(HarvestProjectsDirectoryIds)</DirectoryIds>
255 <AdditionalOptions>$(HarvestProjectsAdditionalOptions)</AdditionalOptions>
256 </HeatProject>
257 <HarvestProject>
258 <Transforms>$(HarvestProjectsTransforms)</Transforms>
259 <ProjectOutputGroups>$(HarvestProjectsProjectOutputGroups)</ProjectOutputGroups>
260 <DirectoryIds>$(HarvestProjectsDirectoryIds)</DirectoryIds>
261 <AdditionalOptions>$(HarvestProjectsAdditionalOptions)</AdditionalOptions>
262 </HarvestProject>
263 </ItemDefinitionGroup>
264
265 <PropertyGroup>
266 <HarvestProjectsDependsOn>CombineHarvestProjects</HarvestProjectsDependsOn>
267 </PropertyGroup>
268 <Target Name="HarvestProjects"
269 DependsOnTargets="$(HarvestProjectsDependsOn)"
270 Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(ProjectPath)"
271 Outputs="@(_AllHeatProjects -> '%(HeatOutput)')"
272 Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') ">
273
274 <HeatProject
275 NoLogo="true"
276 SuppressAllWarnings="$(HarvestProjectsSuppressAllWarnings)"
277 SuppressSpecificWarnings="$(HarvestProjectsSuppressSpecificWarnings)"
278 TreatWarningsAsErrors="$(HarvestProjectsTreatWarningsAsErrors)"
279 TreatSpecificWarningsAsErrors="$(HarvestProjectsTreatSpecificWarningsAsErrors)"
280 VerboseOutput="$(HarvestProjectsVerboseOutput)"
281 AutogenerateGuids="$(HarvestProjectsAutogenerateGuids)"
282 GenerateGuidsNow="$(HarvestProjectsGenerateGuidsNow)"
283 OutputFile="%(_AllHeatProjects.HeatOutput)"
284 SuppressFragments="$(HarvestProjectsSuppressFragments)"
285 SuppressUniqueIds="$(HarvestProjectsSuppressUniqueIds)"
286 Transforms="%(_AllHeatProjects.Transforms)"
287 Project="%(_AllHeatProjects.FullPath)"
288 ProjectOutputGroups="%(_AllHeatProjects.ProjectOutputGroups)"
289 GenerateType="%(_AllHeatProjects.GenerateType)"
290 MsbuildBinPath="$(HarvestProjectsMsbuildBinPath)"
291 DirectoryIds="%(_AllHeatProjects.DirectoryIds)"
292 ProjectName="%(_AllHeatProjects.ProjectName)"
293 Configuration="%(_AllHeatProjects.Configuration)"
294 Platform="%(_AllHeatProjects.Platform)"
295 GenerateWixVariables="$(HarvestProjectsGenerateWixVariables)"
296 UseToolsVersion="$(HarvestProjectsUseToolsVersion)"
297 AdditionalOptions="%(_AllHeatProjects.AdditionalOptions)"
298 ToolPath="$(HeatToolDir)">
299
300 <Output TaskParameter="OutputFile" ItemName="Compile" />
301 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
302
303 </HeatProject>
304
305 </Target>
306
307 <!--
308 ================================================================================================
309 HarvestDirectory
310
311 Harvests directories using heat.exe.
312
313 [IN]
314 @(HarvestDirectory) - The list of directories to harvest.
315 %(HarvestDirectory.Transforms) - XSL transforms to apply to the harvested WiX.
316 %(HarvestDirectory.ComponentGroupName) - The name of the ComponentGroup to create.
317 %(HarvestDirectory.DirectoryRefId) - The ID of the directory to reference instead of TARGETDIR.
318 %(HarvestDirectory.KeepEmptyDirectories) - Whether to create Directory entries for empty directories.
319 %(HarvestDirectory.PreprocessorVariable) - Substitute SourceDir for another variable name (ex: var.Dir).
320 %(HarvestDirectory.SuppressCom) - Suppress COM elements.
321 %(HarvestDirectory.SuppressRootDirectory) - Suppress a Directory element for the root directory.
322 %(HarvestDirectory.SuppressRegistry) - Suppress registry harvesting.
323 %(HarvestDirectory.AdditionalOptions) - Any additional harvesting command line options.
324
325 [OUT]
326 $(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs
327 - The generated .wxs files which are added to the @(Compile) item list.
328 ================================================================================================
329 -->
330
331 <ItemDefinitionGroup>
332 <HarvestDirectory>
333 <Transforms>$(HarvestDirectoryTransforms)</Transforms>
334 <ComponentGroupName>$(HarvestDirectoryComponentGroupName)</ComponentGroupName>
335 <DirectoryRefId>$(HarvestDirectoryDirectoryRefId)</DirectoryRefId>
336 <KeepEmptyDirectories>$(HarvestDirectoryKeepEmptyDirectories)</KeepEmptyDirectories>
337 <PreprocessorVariable>$(HarvestDirectoryPreprocessorVariable)</PreprocessorVariable>
338 <SuppressCom>$(HarvestDirectorySuppressCom)</SuppressCom>
339 <SuppressRootDirectory>$(HarvestDirectorySuppressRootDirectory)</SuppressRootDirectory>
340 <SuppressRegistry>$(HarvestDirectorySuppressRegistry)</SuppressRegistry>
341 <AdditionalOptions>$(HarvestDirectoryAdditionalOptions)</AdditionalOptions>
342 </HarvestDirectory>
343 </ItemDefinitionGroup>
344
345 <PropertyGroup>
346 <HarvestDirectoryDependsOn>
347 GetHarvestDirectoryContent
348 </HarvestDirectoryDependsOn>
349 </PropertyGroup>
350
351 <!-- Creates items to include content since wildcards will not work in Target/@Inputs. -->
352 <Target Name="GetHarvestDirectoryContent">
353 <CreateItem Include="@(HarvestDirectory->'%(FullPath)\**\*')">
354 <Output TaskParameter="Include" ItemName="_HarvestDirectoryContent" />
355 </CreateItem>
356 </Target>
357
358 <Target Name="HarvestDirectory"
359 DependsOnTargets="$(HarvestDirectoryDependsOn)"
360 Inputs="@(_HarvestDirectoryContent);%(HarvestDirectory.Transforms)"
361 Outputs="$(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs"
362 Condition=" '@(HarvestDirectory)' != '' ">
363
364 <HeatDirectory
365 NoLogo="true"
366 SuppressAllWarnings="$(HarvestDirectorySuppressAllWarnings)"
367 SuppressSpecificWarnings="$(HarvestDirectorySuppressSpecificWarnings)"
368 TreatWarningsAsErrors="$(HarvestDirectoryTreatWarningsAsErrors)"
369 TreatSpecificWarningsAsErrors="$(HarvestDirectoryTreatSpecificWarningsAsErrors)"
370 VerboseOutput="$(HarvestDirectoryVerboseOutput)"
371 AutogenerateGuids="$(HarvestDirectoryAutogenerateGuids)"
372 GenerateGuidsNow="$(HarvestDirectoryGenerateGuidsNow)"
373 OutputFile="$(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs"
374 SuppressFragments="$(HarvestDirectorySuppressFragments)"
375 SuppressUniqueIds="$(HarvestDirectorySuppressUniqueIds)"
376 Transforms="%(HarvestDirectory.Transforms)"
377 Directory="@(HarvestDirectory)"
378 ComponentGroupName="%(HarvestDirectory.ComponentGroupName)"
379 DirectoryRefId="%(HarvestDirectory.DirectoryRefId)"
380 KeepEmptyDirectories="%(HarvestDirectory.KeepEmptyDirectories)"
381 PreprocessorVariable="%(HarvestDirectory.PreprocessorVariable)"
382 SuppressCom="%(HarvestDirectory.SuppressCom)"
383 SuppressRootDirectory="%(HarvestDirectory.SuppressRootDirectory)"
384 SuppressRegistry="%(HarvestDirectory.SuppressRegistry)"
385 AdditionalOptions="%(HarvestDirectory.AdditionalOptions)"
386 ToolPath="$(HeatToolDir)">
387
388 <Output TaskParameter="OutputFile" ItemName="Compile" />
389 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
390
391 </HeatDirectory>
392
393 </Target>
394
395 <!--
396 ================================================================================================
397 HarvestFile
398
399 Harvests files of different types using heat.exe. This can harvest registry from
400 self-registering files, files with typelibs, and more.
401
402 [IN]
403 @(HarvestFile) - The list of files to harvest.
404 %(HarvestFile.Transforms) - XSL transforms to apply to the harvested WiX.
405 %(HarvestFile.ComponentGroupName) - The name of the ComponentGroup to create.
406 %(HarvestFile.DirectoryRefId) - The ID of the directory to reference instead of TARGETDIR.
407 %(HarvestFile.PreprocessorVariable) - Substitute SourceDir for another variable name (ex: var.Dir).
408 %(HarvestFile.SuppressCom) - Suppress COM elements.
409 %(HarvestFile.SuppressRootDirectory) - Suppress a Directory element for the root directory.
410 $(HarvestFile.SuppressRegistry) - Suppress registry harvesting.
411 %(HarvestFile.AdditionalOptions) - Any additional harvesting command line options.
412
413 [OUT]
414 $(IntermediateOutputPath)_%(HarvestFile.Filename)_file.wxs
415 - The generated .wxs files which are added to the @(Compile) item list.
416 ================================================================================================
417 -->
418
419 <ItemDefinitionGroup>
420 <HarvestFile>
421 <Transforms>$(HarvestFileTransforms)</Transforms>
422 <ComponentGroupName>$(HarvestFileComponentGroupName)</ComponentGroupName>
423 <DirectoryRefId>$(HarvestFileDirectoryRefId)</DirectoryRefId>
424 <PreprocessorVariable>$(HarvestFilePreprocessorVariable)</PreprocessorVariable>
425 <SuppressCom>$(HarvestFileSuppressCom)</SuppressCom>
426 <SuppressRegistry>$(HarvestFileSuppressRegistry)</SuppressRegistry>
427 <SuppressRootDirectory>$(HarvestFileSuppressRootDirectory)</SuppressRootDirectory>
428 <AdditionalOptions>$(HarvestFileAdditionalOptions)</AdditionalOptions>
429 </HarvestFile>
430 </ItemDefinitionGroup>
431
432 <PropertyGroup>
433 <HarvestFileDependsOn></HarvestFileDependsOn>
434 </PropertyGroup>
435 <Target Name="HarvestFile"
436 DependsOnTargets="$(HarvestFileDependsOn)"
437 Inputs="@(HarvestFile);%(HarvestFile.Transforms)"
438 Outputs="@(HarvestFile->'$(IntermediateOutputPath)_%(ComponentGroupName)_%(DirectoryRefId)_%(Filename)%(Extension)_file.wxs')"
439 Condition=" '@(HarvestFile)' != '' ">
440
441 <HeatFile
442 NoLogo="true"
443 SuppressAllWarnings="$(HarvestFileSuppressAllWarnings)"
444 SuppressSpecificWarnings="$(HarvestFileSuppressSpecificWarnings)"
445 TreatWarningsAsErrors="$(HarvestFileTreatWarningsAsErrors)"
446 TreatSpecificWarningsAsErrors="$(HarvestFileTreatSpecificWarningsAsErrors)"
447 VerboseOutput="$(HarvestFileVerboseOutput)"
448 AutogenerateGuids="$(HarvestFileAutogenerateGuids)"
449 GenerateGuidsNow="$(HarvestFileGenerateGuidsNow)"
450 OutputFile="$(IntermediateOutputPath)_%(HarvestFile.ComponentGroupName)_%(HarvestFile.DirectoryRefId)_%(HarvestFile.Filename)%(HarvestFile.Extension)_file.wxs"
451 SuppressFragments="$(HarvestFileSuppressFragments)"
452 SuppressUniqueIds="$(HarvestFileSuppressUniqueIds)"
453 Transforms="%(HarvestFile.Transforms)"
454 File="@(HarvestFile)"
455 ComponentGroupName="%(HarvestFile.ComponentGroupName)"
456 DirectoryRefId="%(HarvestFile.DirectoryRefId)"
457 PreprocessorVariable="%(HarvestFile.PreprocessorVariable)"
458 SuppressCom="%(HarvestFile.SuppressCom)"
459 SuppressRegistry="%(HarvestFile.SuppressRegistry)"
460 SuppressRootDirectory="%(HarvestFile.SuppressRootDirectory)"
461 AdditionalOptions="%(HarvestFile.AdditionalOptions)"
462 ToolPath="$(HeatToolDir)">
463
464 <Output TaskParameter="OutputFile" ItemName="Compile" />
465 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
466
467 </HeatFile>
468
469 </Target>
470
471 <!--
472 ================================================================================================
473 RefreshGeneratedFile
474
475 Generates code based on metadata defined in project references.
476
477 [IN]
478 @(_MSBuildResolvedProjectReferencePaths) - The list of MSBuildable project references.
479
480 [OUT]
481 @(_GeneratedFiles) - The generated source file.
482 ================================================================================================
483 -->
484 <PropertyGroup>
485 <RefreshGeneratedFileDependsOn></RefreshGeneratedFileDependsOn>
486 </PropertyGroup>
487 <Target Name="RefreshGeneratedFile"
488 DependsOnTargets="$(RefreshGeneratedFileDependsOn)"
489 Inputs="@(_MSBuildResolvedProjectReferencePaths);@(Compile);$(ProjectPath)"
490 Outputs="@(_GeneratedFiles)"
491 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module') and '@(_GeneratedFiles)' != '' ">
492
493 <RefreshGeneratedFile
494 GeneratedFiles="@(_GeneratedFiles)"
495 ProjectReferencePaths="@(_MSBuildResolvedProjectReferencePaths)" />
496
497 </Target>
498
499 <!--
500 ================================================================================================
501 RefreshBundleGeneratedFile
502
503 Generates code for bundle projects based on metadata defined in project references.
504
505 [IN]
506 @(_MSBuildResolvedProjectReferencePaths) - The list of MSBuildable project references.
507
508 [OUT]
509 @(_GeneratedFiles) - The generated source file.
510 ================================================================================================
511 -->
512 <PropertyGroup>
513 <RefreshBundleGeneratedFileDependsOn></RefreshBundleGeneratedFileDependsOn>
514 </PropertyGroup>
515 <Target Name="RefreshBundleGeneratedFile"
516 DependsOnTargets="$(RefreshBundleGeneratedFileDependsOn)"
517 Inputs="@(_MSBuildResolvedProjectReferencePaths);@(Compile);$(ProjectPath)"
518 Outputs="@(_GeneratedFiles)"
519 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Bundle' and '@(_GeneratedFiles)' != '') ">
520
521 <RefreshBundleGeneratedFile
522 GeneratedFiles="@(_GeneratedFiles)"
523 ProjectReferencePaths="@(_MSBuildResolvedProjectReferencePaths)" />
524 </Target>
525
526</Project>
diff --git a/src/tools/WixToolset.HeatTasks/HeatDirectory.cs b/src/tools/WixToolset.HeatTasks/HeatDirectory.cs
deleted file mode 100644
index 14a8acfa..00000000
--- a/src/tools/WixToolset.HeatTasks/HeatDirectory.cs
+++ /dev/null
@@ -1,48 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using Microsoft.Build.Framework;
6 using WixToolset.BaseBuildTasks;
7
8 public sealed class HeatDirectory : HeatTask
9 {
10 public string ComponentGroupName { get; set; }
11
12 [Required]
13 public string Directory { get; set; }
14
15 public string DirectoryRefId { get; set; }
16
17 public bool KeepEmptyDirectories { get; set; }
18
19 public string PreprocessorVariable { get; set; }
20
21 public bool SuppressCom { get; set; }
22
23 public bool SuppressRootDirectory { get; set; }
24
25 public bool SuppressRegistry { get; set; }
26
27 public string Template { get; set; }
28
29 protected override string OperationName => "dir";
30
31 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
32 {
33 commandLineBuilder.AppendSwitch(this.OperationName);
34 commandLineBuilder.AppendFileNameIfNotNull(this.Directory);
35
36 commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.ComponentGroupName);
37 commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.DirectoryRefId);
38 commandLineBuilder.AppendIfTrue("-ke", this.KeepEmptyDirectories);
39 commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
40 commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);
41 commandLineBuilder.AppendIfTrue("-srd", this.SuppressRootDirectory);
42 commandLineBuilder.AppendSwitchIfNotNull("-template ", this.Template);
43 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
44
45 base.BuildCommandLine(commandLineBuilder);
46 }
47 }
48}
diff --git a/src/tools/WixToolset.HeatTasks/HeatFile.cs b/src/tools/WixToolset.HeatTasks/HeatFile.cs
deleted file mode 100644
index b39de7da..00000000
--- a/src/tools/WixToolset.HeatTasks/HeatFile.cs
+++ /dev/null
@@ -1,45 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using Microsoft.Build.Framework;
6 using WixToolset.BaseBuildTasks;
7
8 public sealed class HeatFile : HeatTask
9 {
10 public string ComponentGroupName { get; set; }
11
12 public string DirectoryRefId { get; set; }
13
14 [Required]
15 public string File { get; set; }
16
17 public string PreprocessorVariable { get; set; }
18
19 public bool SuppressCom { get; set; }
20
21 public bool SuppressRegistry { get; set; }
22
23 public bool SuppressRootDirectory { get; set; }
24
25 public string Template { get; set; }
26
27 protected override string OperationName => "file";
28
29 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
30 {
31 commandLineBuilder.AppendSwitch(this.OperationName);
32 commandLineBuilder.AppendFileNameIfNotNull(this.File);
33
34 commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.ComponentGroupName);
35 commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.DirectoryRefId);
36 commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
37 commandLineBuilder.AppendIfTrue("-srd", this.SuppressRootDirectory);
38 commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);
39 commandLineBuilder.AppendSwitchIfNotNull("-template ", this.Template);
40 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
41
42 base.BuildCommandLine(commandLineBuilder);
43 }
44 }
45}
diff --git a/src/tools/WixToolset.HeatTasks/HeatProject.cs b/src/tools/WixToolset.HeatTasks/HeatProject.cs
deleted file mode 100644
index 998c14ab..00000000
--- a/src/tools/WixToolset.HeatTasks/HeatProject.cs
+++ /dev/null
@@ -1,73 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using Microsoft.Build.Framework;
6 using WixToolset.BaseBuildTasks;
7
8 public sealed class HeatProject : HeatTask
9 {
10 private string[] projectOutputGroups;
11
12 public string Configuration { get; set; }
13
14 public string DirectoryIds { get; set; }
15
16 public bool GenerateWixVariables { get; set; }
17
18 public string GenerateType { get; set; }
19
20 public string MsbuildBinPath { get; set; }
21
22 public string Platform { get; set; }
23
24 [Required]
25 public string Project { get; set; }
26
27 public string ProjectName { get; set; }
28
29 public string[] ProjectOutputGroups
30 {
31 get
32 {
33 return this.projectOutputGroups;
34 }
35 set
36 {
37 this.projectOutputGroups = value;
38
39 // If it's just one string and it contains semicolons, let's
40 // split it into separate items.
41 if (this.projectOutputGroups.Length == 1)
42 {
43 this.projectOutputGroups = this.projectOutputGroups[0].Split(new char[] { ';' });
44 }
45 }
46 }
47
48 public bool UseToolsVersion { get; set; }
49
50 protected override string OperationName => "project";
51
52 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
53 {
54 commandLineBuilder.AppendSwitch(this.OperationName);
55 commandLineBuilder.AppendFileNameIfNotNull(this.Project);
56
57 commandLineBuilder.AppendSwitchIfNotNull("-configuration ", this.Configuration);
58 commandLineBuilder.AppendSwitchIfNotNull("-directoryid ", this.DirectoryIds);
59 commandLineBuilder.AppendSwitchIfNotNull("-generate ", this.GenerateType);
60 commandLineBuilder.AppendSwitchIfNotNull("-msbuildbinpath ", this.MsbuildBinPath);
61 commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.Platform);
62 commandLineBuilder.AppendArrayIfNotNull("-pog ", this.ProjectOutputGroups);
63 commandLineBuilder.AppendSwitchIfNotNull("-projectname ", this.ProjectName);
64 commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables);
65
66#if !NETCOREAPP
67 commandLineBuilder.AppendIfTrue("-usetoolsversion", this.UseToolsVersion);
68#endif
69
70 base.BuildCommandLine(commandLineBuilder);
71 }
72 }
73}
diff --git a/src/tools/WixToolset.HeatTasks/HeatTask.cs b/src/tools/WixToolset.HeatTasks/HeatTask.cs
deleted file mode 100644
index cad6635b..00000000
--- a/src/tools/WixToolset.HeatTasks/HeatTask.cs
+++ /dev/null
@@ -1,52 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using Microsoft.Build.Framework;
6 using WixToolset.BaseBuildTasks;
7
8 /// <summary>
9 /// A base MSBuild task to run the WiX harvester.
10 /// Specific harvester tasks should extend this class.
11 /// </summary>
12 public abstract partial class HeatTask : BaseToolsetTask
13 {
14 public bool AutogenerateGuids { get; set; }
15
16 public bool GenerateGuidsNow { get; set; }
17
18 [Required]
19 [Output]
20 public ITaskItem OutputFile { get; set; }
21
22 public bool SuppressFragments { get; set; }
23
24 public bool SuppressUniqueIds { get; set; }
25
26 public string[] Transforms { get; set; }
27
28 /// <summary>
29 /// Gets the name of the heat operation performed by the task.
30 /// </summary>
31 /// <remarks>This is the first parameter passed on the heat.exe command-line.</remarks>
32 /// <value>The name of the heat operation performed by the task.</value>
33 protected abstract string OperationName { get; }
34
35 protected sealed override string ToolName => "heat.exe";
36
37 /// <summary>
38 /// Builds a command line from options in this task.
39 /// </summary>
40 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
41 {
42 base.BuildCommandLine(commandLineBuilder);
43
44 commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids);
45 commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow);
46 commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments);
47 commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds);
48 commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms);
49 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
50 }
51 }
52}
diff --git a/src/tools/WixToolset.HeatTasks/RefreshBundleGeneratedFile.cs b/src/tools/WixToolset.HeatTasks/RefreshBundleGeneratedFile.cs
deleted file mode 100644
index 8f1ad167..00000000
--- a/src/tools/WixToolset.HeatTasks/RefreshBundleGeneratedFile.cs
+++ /dev/null
@@ -1,104 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using System;
6 using System.Collections;
7 using System.Globalization;
8 using System.IO;
9 using System.Xml;
10 using Microsoft.Build.Framework;
11
12 /// <summary>
13 /// This task refreshes the generated file for bundle projects.
14 /// </summary>
15 public class RefreshBundleGeneratedFile : RefreshTask
16 {
17 /// <summary>
18 /// Gets a complete list of external cabs referenced by the given installer database file.
19 /// </summary>
20 /// <returns>True upon completion of the task execution.</returns>
21 public override bool Execute()
22 {
23 var payloadGroupRefs = new ArrayList();
24 var packageGroupRefs = new ArrayList();
25 for (var i = 0; i < this.ProjectReferencePaths.Length; i++)
26 {
27 var item = this.ProjectReferencePaths[i];
28
29 if (!String.IsNullOrEmpty(item.GetMetadata(DoNotHarvest)))
30 {
31 continue;
32 }
33
34 var projectPath = item.GetMetadata("MSBuildSourceProjectFile");
35 var projectName = Path.GetFileNameWithoutExtension(projectPath);
36 var referenceName = GetIdentifierFromName(GetMetadataOrDefault(item, "Name", projectName));
37
38 var pogs = item.GetMetadata("RefProjectOutputGroups").Split(';');
39 foreach (var pog in pogs)
40 {
41 if (!String.IsNullOrEmpty(pog))
42 {
43 // TODO: Add payload group references and package group references once heat is generating them
44 ////payloadGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
45 packageGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
46 }
47 }
48 }
49
50 var doc = new XmlDocument();
51
52 var head = doc.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
53 doc.AppendChild(head);
54
55 var rootElement = doc.CreateElement("Wix");
56 rootElement.SetAttribute("xmlns", "http://wixtoolset.org/schemas/v4/wxs");
57 doc.AppendChild(rootElement);
58
59 var fragment = doc.CreateElement("Fragment");
60 rootElement.AppendChild(fragment);
61
62 var payloadGroup = doc.CreateElement("PayloadGroup");
63 payloadGroup.SetAttribute("Id", "Bundle.Generated.Payloads");
64 fragment.AppendChild(payloadGroup);
65
66 var packageGroup = doc.CreateElement("PackageGroup");
67 packageGroup.SetAttribute("Id", "Bundle.Generated.Packages");
68 fragment.AppendChild(packageGroup);
69
70 foreach (string payloadGroupRef in payloadGroupRefs)
71 {
72 var payloadGroupRefElement = doc.CreateElement("PayloadGroupRef");
73 payloadGroupRefElement.SetAttribute("Id", payloadGroupRef);
74 payloadGroup.AppendChild(payloadGroupRefElement);
75 }
76
77 foreach (string packageGroupRef in packageGroupRefs)
78 {
79 var packageGroupRefElement = doc.CreateElement("PackageGroupRef");
80 packageGroupRefElement.SetAttribute("Id", packageGroupRef);
81 packageGroup.AppendChild(packageGroupRefElement);
82 }
83
84 foreach (var item in this.GeneratedFiles)
85 {
86 var fullPath = item.GetMetadata("FullPath");
87
88 payloadGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath) + ".Payloads");
89 packageGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath) + ".Packages");
90 try
91 {
92 doc.Save(fullPath);
93 }
94 catch (Exception e)
95 {
96 // e.Message will be something like: "Access to the path 'fullPath' is denied."
97 this.Log.LogMessage(MessageImportance.High, "Unable to save generated file to '{0}'. {1}", fullPath, e.Message);
98 }
99 }
100
101 return true;
102 }
103 }
104}
diff --git a/src/tools/WixToolset.HeatTasks/RefreshGeneratedFile.cs b/src/tools/WixToolset.HeatTasks/RefreshGeneratedFile.cs
deleted file mode 100644
index 1e43cc1f..00000000
--- a/src/tools/WixToolset.HeatTasks/RefreshGeneratedFile.cs
+++ /dev/null
@@ -1,91 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using System;
6 using System.Collections;
7 using System.Globalization;
8 using System.IO;
9 using System.Xml;
10 using Microsoft.Build.Framework;
11
12 /// <summary>
13 /// This task refreshes the generated file that contains ComponentGroupRefs
14 /// to harvested output.
15 /// </summary>
16 public class RefreshGeneratedFile : RefreshTask
17 {
18 /// <summary>
19 /// Gets a complete list of external cabs referenced by the given installer database file.
20 /// </summary>
21 /// <returns>True upon completion of the task execution.</returns>
22 public override bool Execute()
23 {
24 var componentGroupRefs = new ArrayList();
25
26 for (var i = 0; i < this.ProjectReferencePaths.Length; i++)
27 {
28 var item = this.ProjectReferencePaths[i];
29
30 if (!String.IsNullOrEmpty(item.GetMetadata(DoNotHarvest)))
31 {
32 continue;
33 }
34
35 var projectPath = item.GetMetadata("MSBuildSourceProjectFile");
36 var projectName = Path.GetFileNameWithoutExtension(projectPath);
37 var referenceName = GetIdentifierFromName(GetMetadataOrDefault(item, "Name", projectName));
38
39 var pogs = item.GetMetadata("RefProjectOutputGroups").Split(';');
40 foreach (var pog in pogs)
41 {
42 if (!String.IsNullOrEmpty(pog))
43 {
44 componentGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
45 }
46 }
47 }
48
49 var doc = new XmlDocument();
50
51 var head = doc.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
52 doc.AppendChild(head);
53
54 var rootElement = doc.CreateElement("Wix");
55 rootElement.SetAttribute("xmlns", "http://wixtoolset.org/schemas/v4/wxs");
56 doc.AppendChild(rootElement);
57
58 var fragment = doc.CreateElement("Fragment");
59 rootElement.AppendChild(fragment);
60
61 var componentGroup = doc.CreateElement("ComponentGroup");
62 componentGroup.SetAttribute("Id", "Product.Generated");
63 fragment.AppendChild(componentGroup);
64
65 foreach (string componentGroupRef in componentGroupRefs)
66 {
67 var componentGroupRefElement = doc.CreateElement("ComponentGroupRef");
68 componentGroupRefElement.SetAttribute("Id", componentGroupRef);
69 componentGroup.AppendChild(componentGroupRefElement);
70 }
71
72 foreach (var item in this.GeneratedFiles)
73 {
74 var fullPath = item.GetMetadata("FullPath");
75
76 componentGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath));
77 try
78 {
79 doc.Save(fullPath);
80 }
81 catch (Exception e)
82 {
83 // e.Message will be something like: "Access to the path 'fullPath' is denied."
84 this.Log.LogMessage(MessageImportance.High, "Unable to save generated file to '{0}'. {1}", fullPath, e.Message);
85 }
86 }
87
88 return true;
89 }
90 }
91}
diff --git a/src/tools/WixToolset.HeatTasks/RefreshTask.cs b/src/tools/WixToolset.HeatTasks/RefreshTask.cs
deleted file mode 100644
index 0b378272..00000000
--- a/src/tools/WixToolset.HeatTasks/RefreshTask.cs
+++ /dev/null
@@ -1,59 +0,0 @@
1// 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.
2
3namespace WixToolset.HeatTasks
4{
5 using System;
6 using System.Text.RegularExpressions;
7 using Microsoft.Build.Framework;
8 using Microsoft.Build.Utilities;
9
10 /// <summary>
11 /// A base MSBuild task to refresh generated files.
12 /// </summary>
13 public abstract class RefreshTask : Task
14 {
15 private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]");
16 private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}"); // non 'words' and assorted valid characters
17
18 /// <summary>Metadata key name to turn off harvesting of project references.</summary>
19 protected const string DoNotHarvest = "DoNotHarvest";
20
21 /// <summary>
22 /// The list of files to generate.
23 /// </summary>
24 [Required]
25 public ITaskItem[] GeneratedFiles { get; set; }
26
27 /// <summary>
28 /// All the project references in the project.
29 /// </summary>
30 [Required]
31 public ITaskItem[] ProjectReferencePaths { get; set; }
32
33 /// <summary>
34 /// Return an identifier based on passed file/directory name
35 /// </summary>
36 /// <param name="name">File/directory name to generate identifer from</param>
37 /// <returns>A version of the name that is a legal identifier.</returns>
38 /// <remarks>This is duplicated from WiX's Common class.</remarks>
39 protected static string GetIdentifierFromName(string name)
40 {
41 var result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_".
42
43 // MSI identifiers must begin with an alphabetic character or an
44 // underscore. Prefix all other values with an underscore.
45 if (AddPrefix.IsMatch(name))
46 {
47 result = String.Concat("_", result);
48 }
49
50 return result;
51 }
52
53 protected static string GetMetadataOrDefault(ITaskItem item, string metadataName, string defaultValue)
54 {
55 var value = item.GetMetadata(metadataName);
56 return String.IsNullOrWhiteSpace(value) ? defaultValue : value;
57 }
58 }
59}
diff --git a/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj b/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj
deleted file mode 100644
index 21460810..00000000
--- a/src/tools/WixToolset.HeatTasks/WixToolset.HeatTasks.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
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 Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFrameworks>net6.0;net472</TargetFrameworks>
7 <Title>WiX Toolset Heat MSBuild Tasks</Title>
8 <DebugType>embedded</DebugType>
9 <PublishRepositoryUrl>true</PublishRepositoryUrl>
10 <PlatformTarget>AnyCPU</PlatformTarget>
11 </PropertyGroup>
12
13 <ItemGroup>
14 <PackageReference Include="Microsoft.Build.Tasks.Core" />
15 <PackageReference Include="WixInternal.BaseBuildTasks.Sources" />
16 </ItemGroup>
17</Project>