aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks')
-rw-r--r--src/WixToolset.BuildTasks/DoIt.cs73
-rw-r--r--src/WixToolset.BuildTasks/HeatDirectory.cs11
-rw-r--r--src/WixToolset.BuildTasks/HeatFile.cs11
-rw-r--r--src/WixToolset.BuildTasks/HeatProject.cs11
-rw-r--r--src/WixToolset.BuildTasks/HeatTask.cs52
-rw-r--r--src/WixToolset.BuildTasks/ToolsetTask.cs105
-rw-r--r--src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj3
-rw-r--r--src/WixToolset.BuildTasks/wix.harvest.targets14
-rw-r--r--src/WixToolset.BuildTasks/wix.targets3
9 files changed, 138 insertions, 145 deletions
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs
index 1872f9e4..d95d6e3c 100644
--- a/src/WixToolset.BuildTasks/DoIt.cs
+++ b/src/WixToolset.BuildTasks/DoIt.cs
@@ -16,10 +16,8 @@ namespace WixToolset.BuildTasks
16 /// <summary> 16 /// <summary>
17 /// An MSBuild task to run the WiX compiler. 17 /// An MSBuild task to run the WiX compiler.
18 /// </summary> 18 /// </summary>
19 public sealed class DoIt : Task 19 public sealed class DoIt : ToolsetTask
20 { 20 {
21 public string AdditionalOptions { get; set; }
22
23 public string[] Cultures { get; set; } 21 public string[] Cultures { get; set; }
24 22
25 public string[] DefineConstants { get; set; } 23 public string[] DefineConstants { get; set; }
@@ -37,8 +35,6 @@ namespace WixToolset.BuildTasks
37 35
38 public ITaskItem[] LocalizationFiles { get; set; } 36 public ITaskItem[] LocalizationFiles { get; set; }
39 37
40 public bool NoLogo { get; set; }
41
42 public ITaskItem[] LibraryFiles { get; set; } 38 public ITaskItem[] LibraryFiles { get; set; }
43 39
44 [Output] 40 [Output]
@@ -59,32 +55,6 @@ namespace WixToolset.BuildTasks
59 public string[] ReferencePaths { get; set; } 55 public string[] ReferencePaths { get; set; }
60 56
61 57
62 /// <summary>
63 /// Gets or sets whether all warnings should be suppressed.
64 /// </summary>
65 public bool SuppressAllWarnings { get; set; }
66
67 /// <summary>
68 /// Gets or sets a list of specific warnings to be suppressed.
69 /// </summary>
70 public string[] SuppressSpecificWarnings { get; set; }
71
72 /// <summary>
73 /// Gets or sets whether all warnings should be treated as errors.
74 /// </summary>
75 public bool TreatWarningsAsErrors { get; set; }
76
77 /// <summary>
78 /// Gets or sets a list of specific warnings to treat as errors.
79 /// </summary>
80 public string[] TreatSpecificWarningsAsErrors { get; set; }
81
82 /// <summary>
83 /// Gets or sets whether to display verbose output.
84 /// </summary>
85 public bool VerboseOutput { get; set; }
86
87
88 public ITaskItem[] BindInputPaths { get; set; } 58 public ITaskItem[] BindInputPaths { get; set; }
89 59
90 public bool BindFiles { get; set; } 60 public bool BindFiles { get; set; }
@@ -109,37 +79,10 @@ namespace WixToolset.BuildTasks
109 public string[] SuppressIces { get; set; } 79 public string[] SuppressIces { get; set; }
110 public string AdditionalCub { get; set; } 80 public string AdditionalCub { get; set; }
111 81
112 public override bool Execute() 82 protected override string TaskShortName => "WIX";
113 {
114 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
115
116 var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode);
117
118 try
119 {
120 this.ExecuteCore(serviceProvider, listener);
121 }
122 catch (WixException e)
123 {
124 listener.Write(e.Error);
125 }
126 catch (Exception e)
127 {
128 this.Log.LogErrorFromException(e, showStackTrace: true, showDetail: true, null);
129
130 if (e is NullReferenceException || e is SEHException)
131 {
132 throw;
133 }
134 }
135 83
136 return !this.Log.HasLoggedErrors; 84 protected override void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener listener, string commandLineString)
137 }
138
139 private void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener listener)
140 { 85 {
141 var commandLineString = this.BuildCommandLine();
142
143 this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString); 86 this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString);
144 87
145 var messaging = serviceProvider.GetService<IMessaging>(); 88 var messaging = serviceProvider.GetService<IMessaging>();
@@ -155,10 +98,8 @@ namespace WixToolset.BuildTasks
155 command?.Execute(); 98 command?.Execute();
156 } 99 }
157 100
158 private string BuildCommandLine() 101 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
159 { 102 {
160 var commandLineBuilder = new WixCommandLineBuilder();
161
162 commandLineBuilder.AppendTextUnquoted("build"); 103 commandLineBuilder.AppendTextUnquoted("build");
163 104
164 commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform); 105 commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform);
@@ -166,14 +107,12 @@ namespace WixToolset.BuildTasks
166 commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType); 107 commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType);
167 commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile); 108 commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile);
168 commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType); 109 commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType);
169 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
170 commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures); 110 commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures);
171 commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants); 111 commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants);
172 commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths); 112 commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths);
173 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); 113 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
174 commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); 114 commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation);
175 commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); 115 commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces);
176 commandLineBuilder.AppendArrayIfNotNull("-sw ", this.SuppressSpecificWarnings);
177 commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); 116 commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile);
178 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); 117 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
179 commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); 118 commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory);
@@ -181,14 +120,14 @@ namespace WixToolset.BuildTasks
181 commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); 120 commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile);
182 commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); 121 commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile);
183 122
123 base.BuildCommandLine(commandLineBuilder);
124
184 commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles); 125 commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles);
185 commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings()); 126 commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings());
186 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); 127 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
187 commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles); 128 commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles);
188 commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); 129 commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions);
189 commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); 130 commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
190
191 return commandLineBuilder.ToString();
192 } 131 }
193 132
194 private IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, IMessaging messaging, string[] extensions) 133 private IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, IMessaging messaging, string[] extensions)
diff --git a/src/WixToolset.BuildTasks/HeatDirectory.cs b/src/WixToolset.BuildTasks/HeatDirectory.cs
index 112418e7..79da303a 100644
--- a/src/WixToolset.BuildTasks/HeatDirectory.cs
+++ b/src/WixToolset.BuildTasks/HeatDirectory.cs
@@ -4,7 +4,6 @@ namespace WixToolset.BuildTasks
4{ 4{
5 using Microsoft.Build.Framework; 5 using Microsoft.Build.Framework;
6 6
7#if false
8 public sealed class HeatDirectory : HeatTask 7 public sealed class HeatDirectory : HeatTask
9 { 8 {
10 private string directory; 9 private string directory;
@@ -77,14 +76,8 @@ namespace WixToolset.BuildTasks
77 get { return "dir"; } 76 get { return "dir"; }
78 } 77 }
79 78
80 /// <summary> 79 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
81 /// Generate the command line arguments to write to the response file from the properties.
82 /// </summary>
83 /// <returns>Command line string.</returns>
84 protected override string GenerateResponseFileCommands()
85 { 80 {
86 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
87
88 commandLineBuilder.AppendSwitch(this.OperationName); 81 commandLineBuilder.AppendSwitch(this.OperationName);
89 commandLineBuilder.AppendFileNameIfNotNull(this.Directory); 82 commandLineBuilder.AppendFileNameIfNotNull(this.Directory);
90 83
@@ -98,8 +91,6 @@ namespace WixToolset.BuildTasks
98 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable); 91 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
99 92
100 base.BuildCommandLine(commandLineBuilder); 93 base.BuildCommandLine(commandLineBuilder);
101 return commandLineBuilder.ToString();
102 } 94 }
103 } 95 }
104#endif
105} 96}
diff --git a/src/WixToolset.BuildTasks/HeatFile.cs b/src/WixToolset.BuildTasks/HeatFile.cs
index e21d61f5..57fe579d 100644
--- a/src/WixToolset.BuildTasks/HeatFile.cs
+++ b/src/WixToolset.BuildTasks/HeatFile.cs
@@ -4,7 +4,6 @@ namespace WixToolset.BuildTasks
4{ 4{
5 using Microsoft.Build.Framework; 5 using Microsoft.Build.Framework;
6 6
7#if false
8 public sealed class HeatFile : HeatTask 7 public sealed class HeatFile : HeatTask
9 { 8 {
10 private string file; 9 private string file;
@@ -70,14 +69,8 @@ namespace WixToolset.BuildTasks
70 get { return "file"; } 69 get { return "file"; }
71 } 70 }
72 71
73 /// <summary> 72 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
74 /// Generate the command line arguments to write to the response file from the properties.
75 /// </summary>
76 /// <returns>Command line string.</returns>
77 protected override string GenerateResponseFileCommands()
78 { 73 {
79 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
80
81 commandLineBuilder.AppendSwitch(this.OperationName); 74 commandLineBuilder.AppendSwitch(this.OperationName);
82 commandLineBuilder.AppendFileNameIfNotNull(this.File); 75 commandLineBuilder.AppendFileNameIfNotNull(this.File);
83 76
@@ -90,8 +83,6 @@ namespace WixToolset.BuildTasks
90 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable); 83 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
91 84
92 base.BuildCommandLine(commandLineBuilder); 85 base.BuildCommandLine(commandLineBuilder);
93 return commandLineBuilder.ToString();
94 } 86 }
95 } 87 }
96#endif
97} 88}
diff --git a/src/WixToolset.BuildTasks/HeatProject.cs b/src/WixToolset.BuildTasks/HeatProject.cs
index c8f56688..71679dc4 100644
--- a/src/WixToolset.BuildTasks/HeatProject.cs
+++ b/src/WixToolset.BuildTasks/HeatProject.cs
@@ -4,7 +4,6 @@ namespace WixToolset.BuildTasks
4{ 4{
5 using Microsoft.Build.Framework; 5 using Microsoft.Build.Framework;
6 6
7#if false
8 public sealed class HeatProject : HeatTask 7 public sealed class HeatProject : HeatTask
9 { 8 {
10 private string configuration; 9 private string configuration;
@@ -83,14 +82,8 @@ namespace WixToolset.BuildTasks
83 get { return "project"; } 82 get { return "project"; }
84 } 83 }
85 84
86 /// <summary> 85 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
87 /// Generate the command line arguments to write to the response file from the properties.
88 /// </summary>
89 /// <returns>Command line string.</returns>
90 protected override string GenerateResponseFileCommands()
91 { 86 {
92 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
93
94 commandLineBuilder.AppendSwitch(this.OperationName); 87 commandLineBuilder.AppendSwitch(this.OperationName);
95 commandLineBuilder.AppendFileNameIfNotNull(this.Project); 88 commandLineBuilder.AppendFileNameIfNotNull(this.Project);
96 89
@@ -103,8 +96,6 @@ namespace WixToolset.BuildTasks
103 commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables); 96 commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables);
104 97
105 base.BuildCommandLine(commandLineBuilder); 98 base.BuildCommandLine(commandLineBuilder);
106 return commandLineBuilder.ToString();
107 } 99 }
108 } 100 }
109#endif
110} 101}
diff --git a/src/WixToolset.BuildTasks/HeatTask.cs b/src/WixToolset.BuildTasks/HeatTask.cs
index 8b12c48c..586f02f7 100644
--- a/src/WixToolset.BuildTasks/HeatTask.cs
+++ b/src/WixToolset.BuildTasks/HeatTask.cs
@@ -2,24 +2,18 @@
2 2
3namespace WixToolset.BuildTasks 3namespace WixToolset.BuildTasks
4{ 4{
5 using System;
6 using System.Diagnostics;
7 using System.Globalization;
8 using System.IO;
9 using System.Text;
10
11 using Microsoft.Build.Framework; 5 using Microsoft.Build.Framework;
12 using Microsoft.Build.Utilities; 6 using WixToolset.Extensibility;
7 using WixToolset.Extensibility.Data;
8 using WixToolset.Extensibility.Services;
9 using WixToolset.Harvesters;
13 10
14#if false
15 /// <summary> 11 /// <summary>
16 /// A base MSBuild task to run the WiX harvester. 12 /// A base MSBuild task to run the WiX harvester.
17 /// Specific harvester tasks should extend this class. 13 /// Specific harvester tasks should extend this class.
18 /// </summary> 14 /// </summary>
19 public abstract class HeatTask : WixToolTask 15 public abstract class HeatTask : ToolsetTask
20 { 16 {
21 private const string HeatToolName = "Heat.exe";
22
23 private bool autogenerageGuids; 17 private bool autogenerageGuids;
24 private bool generateGuidsNow; 18 private bool generateGuidsNow;
25 private ITaskItem outputFile; 19 private ITaskItem outputFile;
@@ -65,15 +59,7 @@ namespace WixToolset.BuildTasks
65 set { this.transforms = value; } 59 set { this.transforms = value; }
66 } 60 }
67 61
68 /// <summary> 62 protected override string TaskShortName => "HEAT";
69 /// Get the name of the executable.
70 /// </summary>
71 /// <remarks>The ToolName is used with the ToolPath to get the location of heat.exe.</remarks>
72 /// <value>The name of the executable.</value>
73 protected override string ToolName
74 {
75 get { return HeatToolName; }
76 }
77 63
78 /// <summary> 64 /// <summary>
79 /// Gets the name of the heat operation performed by the task. 65 /// Gets the name of the heat operation performed by the task.
@@ -85,20 +71,19 @@ namespace WixToolset.BuildTasks
85 get; 71 get;
86 } 72 }
87 73
88 /// <summary> 74 protected override void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener listener, string commandLineString)
89 /// Get the path to the executable.
90 /// </summary>
91 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
92 /// <returns>The full path to the executable or simply heat.exe if it's expected to be in the system path.</returns>
93 protected override string GenerateFullPathToTool()
94 { 75 {
95 // If there's not a ToolPath specified, it has to be in the system path. 76 this.Log.LogMessage(MessageImportance.Normal, "heat.exe " + commandLineString);
96 if (String.IsNullOrEmpty(this.ToolPath)) 77
97 { 78 var messaging = serviceProvider.GetService<IMessaging>();
98 return HeatToolName; 79 messaging.SetListener(listener);
99 } 80
81 var arguments = serviceProvider.GetService<ICommandLineArguments>();
82 arguments.Populate(commandLineString);
100 83
101 return Path.Combine(Path.GetFullPath(this.ToolPath), HeatToolName); 84 var commandLine = HeatCommandLineFactory.CreateCommandLine(serviceProvider, true);
85 var command = commandLine.ParseStandardCommandLine(arguments);
86 command?.Execute();
102 } 87 }
103 88
104 /// <summary> 89 /// <summary>
@@ -110,14 +95,11 @@ namespace WixToolset.BuildTasks
110 95
111 commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids); 96 commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids);
112 commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow); 97 commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow);
113 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
114 commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments); 98 commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments);
115 commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds); 99 commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds);
116 commandLineBuilder.AppendArrayIfNotNull("-sw", this.SuppressSpecificWarnings);
117 commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms); 100 commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms);
118 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions); 101 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
119 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); 102 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
120 } 103 }
121 } 104 }
122#endif
123} 105}
diff --git a/src/WixToolset.BuildTasks/ToolsetTask.cs b/src/WixToolset.BuildTasks/ToolsetTask.cs
new file mode 100644
index 00000000..713a938b
--- /dev/null
+++ b/src/WixToolset.BuildTasks/ToolsetTask.cs
@@ -0,0 +1,105 @@
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.BuildTasks
4{
5 using System;
6 using System.Runtime.InteropServices;
7 using Microsoft.Build.Utilities;
8 using WixToolset.Core;
9 using WixToolset.Data;
10 using WixToolset.Extensibility;
11 using WixToolset.Extensibility.Services;
12
13 public abstract class ToolsetTask : Task
14 {
15 /// <summary>
16 /// Gets or sets additional options that are appended the the tool command-line.
17 /// </summary>
18 /// <remarks>
19 /// This allows the task to support extended options in the tool which are not
20 /// explicitly implemented as properties on the task.
21 /// </remarks>
22 public string AdditionalOptions { get; set; }
23
24 /// <summary>
25 /// Gets or sets whether to display the logo.
26 /// </summary>
27 public bool NoLogo { get; set; }
28
29 /// <summary>
30 /// Gets or sets whether all warnings should be suppressed.
31 /// </summary>
32 public bool SuppressAllWarnings { get; set; }
33
34 /// <summary>
35 /// Gets or sets a list of specific warnings to be suppressed.
36 /// </summary>
37 public string[] SuppressSpecificWarnings { get; set; }
38
39 /// <summary>
40 /// Gets or sets whether all warnings should be treated as errors.
41 /// </summary>
42 public bool TreatWarningsAsErrors { get; set; }
43
44 /// <summary>
45 /// Gets or sets a list of specific warnings to treat as errors.
46 /// </summary>
47 public string[] TreatSpecificWarningsAsErrors { get; set; }
48
49 /// <summary>
50 /// Gets or sets whether to display verbose output.
51 /// </summary>
52 public bool VerboseOutput { get; set; }
53
54 public override bool Execute()
55 {
56 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
57
58 var listener = new MsbuildMessageListener(this.Log, this.TaskShortName, this.BuildEngine.ProjectFileOfTaskNode);
59
60 try
61 {
62 var commandLineBuilder = new WixCommandLineBuilder();
63 this.BuildCommandLine(commandLineBuilder);
64
65 var commandLineString = commandLineBuilder.ToString();
66 this.ExecuteCore(serviceProvider, listener, commandLineString);
67 }
68 catch (WixException e)
69 {
70 listener.Write(e.Error);
71 }
72 catch (Exception e)
73 {
74 this.Log.LogErrorFromException(e, showStackTrace: true, showDetail: true, null);
75
76 if (e is NullReferenceException || e is SEHException)
77 {
78 throw;
79 }
80 }
81
82 return !this.Log.HasLoggedErrors;
83 }
84
85 /// <summary>
86 /// Builds a command line from options in this and derivative tasks.
87 /// </summary>
88 /// <remarks>
89 /// Derivative classes should call BuildCommandLine() on the base class to ensure that common command line options are added to the command.
90 /// </remarks>
91 protected virtual void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
92 {
93 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
94 commandLineBuilder.AppendArrayIfNotNull("-sw ", this.SuppressSpecificWarnings);
95 commandLineBuilder.AppendIfTrue("-sw", this.SuppressAllWarnings);
96 commandLineBuilder.AppendIfTrue("-v", this.VerboseOutput);
97 commandLineBuilder.AppendArrayIfNotNull("-wx ", this.TreatSpecificWarningsAsErrors);
98 commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors);
99 }
100
101 protected abstract void ExecuteCore(IWixToolsetServiceProvider serviceProvider, IMessageListener messageListener, string commandLineString);
102
103 protected abstract string TaskShortName { get; }
104 }
105}
diff --git a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj b/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
index f8983121..b86b1f53 100644
--- a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
+++ b/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
@@ -31,6 +31,7 @@
31 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> 31 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
32 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> 32 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
33 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" /> 33 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" />
34 <PackageReference Include="WixToolset.Harvesters" Version="4.0.*" />
34 </ItemGroup> 35 </ItemGroup>
35 36
36 <ItemGroup> 37 <ItemGroup>
@@ -39,7 +40,7 @@
39 </ItemGroup> 40 </ItemGroup>
40 41
41 <ItemGroup> 42 <ItemGroup>
42 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" /> 43 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
43 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> 44 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" />
44 </ItemGroup> 45 </ItemGroup>
45</Project> 46</Project>
diff --git a/src/WixToolset.BuildTasks/wix.harvest.targets b/src/WixToolset.BuildTasks/wix.harvest.targets
index e94dfcea..a8be17df 100644
--- a/src/WixToolset.BuildTasks/wix.harvest.targets
+++ b/src/WixToolset.BuildTasks/wix.harvest.targets
@@ -7,7 +7,7 @@
7 <!-- These properties can be overridden to support non-default installations. --> 7 <!-- These properties can be overridden to support non-default installations. -->
8 <PropertyGroup> 8 <PropertyGroup>
9 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileFullPath)</WixTargetsPath> 9 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileFullPath)</WixTargetsPath>
10 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixTargetsPath)WixTasks.dll</WixTasksPath> 10 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixTargetsPath)WixToolset.BuildTasks.dll</WixTasksPath>
11 </PropertyGroup> 11 </PropertyGroup>
12 12
13 <!-- These tasks are extensions for harvesting WiX source code from other sources. --> 13 <!-- These tasks are extensions for harvesting WiX source code from other sources. -->
@@ -260,10 +260,9 @@
260 Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') "> 260 Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') ">
261 261
262 <HeatProject 262 <HeatProject
263 NoLogo="$(HarvestProjectsNoLogo)" 263 NoLogo="true"
264 SuppressAllWarnings="$(HarvestProjectsSuppressAllWarnings)" 264 SuppressAllWarnings="$(HarvestProjectsSuppressAllWarnings)"
265 SuppressSpecificWarnings="$(HarvestProjectsSuppressSpecificWarnings)" 265 SuppressSpecificWarnings="$(HarvestProjectsSuppressSpecificWarnings)"
266 ToolPath="$(WixToolPath)"
267 TreatWarningsAsErrors="$(HarvestProjectsTreatWarningsAsErrors)" 266 TreatWarningsAsErrors="$(HarvestProjectsTreatWarningsAsErrors)"
268 TreatSpecificWarningsAsErrors="$(HarvestProjectsTreatSpecificWarningsAsErrors)" 267 TreatSpecificWarningsAsErrors="$(HarvestProjectsTreatSpecificWarningsAsErrors)"
269 VerboseOutput="$(HarvestProjectsVerboseOutput)" 268 VerboseOutput="$(HarvestProjectsVerboseOutput)"
@@ -280,7 +279,6 @@
280 ProjectName="%(_AllHeatProjects.ProjectName)" 279 ProjectName="%(_AllHeatProjects.ProjectName)"
281 Configuration="%(_AllHeatProjects.Configuration)" 280 Configuration="%(_AllHeatProjects.Configuration)"
282 Platform="%(_AllHeatProjects.Platform)" 281 Platform="%(_AllHeatProjects.Platform)"
283 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
284 GenerateWixVariables="$(HarvestProjectsGenerateWixVariables)" 282 GenerateWixVariables="$(HarvestProjectsGenerateWixVariables)"
285 AdditionalOptions="$(HarvestProjectsAdditionalOptions)"> 283 AdditionalOptions="$(HarvestProjectsAdditionalOptions)">
286 284
@@ -347,10 +345,9 @@
347 Condition=" '@(HarvestDirectory)' != '' "> 345 Condition=" '@(HarvestDirectory)' != '' ">
348 346
349 <HeatDirectory 347 <HeatDirectory
350 NoLogo="$(HarvestDirectoryNoLogo)" 348 NoLogo="true"
351 SuppressAllWarnings="$(HarvestDirectorySuppressAllWarnings)" 349 SuppressAllWarnings="$(HarvestDirectorySuppressAllWarnings)"
352 SuppressSpecificWarnings="$(HarvestDirectorySuppressSpecificWarnings)" 350 SuppressSpecificWarnings="$(HarvestDirectorySuppressSpecificWarnings)"
353 ToolPath="$(WixToolPath)"
354 TreatWarningsAsErrors="$(HarvestDirectoryTreatWarningsAsErrors)" 351 TreatWarningsAsErrors="$(HarvestDirectoryTreatWarningsAsErrors)"
355 TreatSpecificWarningsAsErrors="$(HarvestDirectoryTreatSpecificWarningsAsErrors)" 352 TreatSpecificWarningsAsErrors="$(HarvestDirectoryTreatSpecificWarningsAsErrors)"
356 VerboseOutput="$(HarvestDirectoryVerboseOutput)" 353 VerboseOutput="$(HarvestDirectoryVerboseOutput)"
@@ -365,7 +362,6 @@
365 DirectoryRefId="%(HarvestDirectory.DirectoryRefId)" 362 DirectoryRefId="%(HarvestDirectory.DirectoryRefId)"
366 KeepEmptyDirectories="%(HarvestDirectory.KeepEmptyDirectories)" 363 KeepEmptyDirectories="%(HarvestDirectory.KeepEmptyDirectories)"
367 PreprocessorVariable="%(HarvestDirectory.PreprocessorVariable)" 364 PreprocessorVariable="%(HarvestDirectory.PreprocessorVariable)"
368 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
369 SuppressCom="%(HarvestDirectory.SuppressCom)" 365 SuppressCom="%(HarvestDirectory.SuppressCom)"
370 SuppressRootDirectory="%(HarvestDirectory.SuppressRootDirectory)" 366 SuppressRootDirectory="%(HarvestDirectory.SuppressRootDirectory)"
371 SuppressRegistry="%(HarvestDirectory.SuppressRegistry)" 367 SuppressRegistry="%(HarvestDirectory.SuppressRegistry)"
@@ -423,10 +419,9 @@
423 Condition=" '@(HarvestFile)' != '' "> 419 Condition=" '@(HarvestFile)' != '' ">
424 420
425 <HeatFile 421 <HeatFile
426 NoLogo="$(HarvestFileNoLogo)" 422 NoLogo="true"
427 SuppressAllWarnings="$(HarvestFileSuppressAllWarnings)" 423 SuppressAllWarnings="$(HarvestFileSuppressAllWarnings)"
428 SuppressSpecificWarnings="$(HarvestFileSuppressSpecificWarnings)" 424 SuppressSpecificWarnings="$(HarvestFileSuppressSpecificWarnings)"
429 ToolPath="$(WixToolPath)"
430 TreatWarningsAsErrors="$(HarvestFileTreatWarningsAsErrors)" 425 TreatWarningsAsErrors="$(HarvestFileTreatWarningsAsErrors)"
431 TreatSpecificWarningsAsErrors="$(HarvestFileTreatSpecificWarningsAsErrors)" 426 TreatSpecificWarningsAsErrors="$(HarvestFileTreatSpecificWarningsAsErrors)"
432 VerboseOutput="$(HarvestFileVerboseOutput)" 427 VerboseOutput="$(HarvestFileVerboseOutput)"
@@ -440,7 +435,6 @@
440 ComponentGroupName="%(HarvestFile.ComponentGroupName)" 435 ComponentGroupName="%(HarvestFile.ComponentGroupName)"
441 DirectoryRefId="%(HarvestFile.DirectoryRefId)" 436 DirectoryRefId="%(HarvestFile.DirectoryRefId)"
442 PreprocessorVariable="%(HarvestFile.PreprocessorVariable)" 437 PreprocessorVariable="%(HarvestFile.PreprocessorVariable)"
443 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
444 SuppressCom="%(HarvestFile.SuppressCom)" 438 SuppressCom="%(HarvestFile.SuppressCom)"
445 SuppressRegistry="%(HarvestFile.SuppressRegistry)" 439 SuppressRegistry="%(HarvestFile.SuppressRegistry)"
446 SuppressRootDirectory="%(HarvestFile.SuppressRootDirectory)" 440 SuppressRootDirectory="%(HarvestFile.SuppressRootDirectory)"
diff --git a/src/WixToolset.BuildTasks/wix.targets b/src/WixToolset.BuildTasks/wix.targets
index 3c04760a..eb0f815a 100644
--- a/src/WixToolset.BuildTasks/wix.targets
+++ b/src/WixToolset.BuildTasks/wix.targets
@@ -122,8 +122,7 @@
122 </PropertyGroup> 122 </PropertyGroup>
123 123
124 <PropertyGroup> 124 <PropertyGroup>
125 <WixToolDir Condition=" '$(WixToolDir)' == ''">$(WixBinDir)</WixToolDir> 125 <WixExtDir Condition=" '$(WixExtDir)' == ''">$(WixBinDir)</WixExtDir>
126 <WixExtDir Condition=" '$(WixExtDir)' == ''">$(WixToolDir)</WixExtDir>
127 </PropertyGroup> 126 </PropertyGroup>
128 127
129 <!-- 128 <!--