diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.BuildTasks/DoIt.cs | 73 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/HeatDirectory.cs | 11 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/HeatFile.cs | 11 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/HeatProject.cs | 11 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/HeatTask.cs | 52 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/ToolsetTask.cs | 105 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj | 3 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/wix.harvest.targets | 14 | ||||
| -rw-r--r-- | src/WixToolset.BuildTasks/wix.targets | 3 | ||||
| -rw-r--r-- | src/WixToolset.Tools.Core/WixToolset.Tools.Core.csproj | 2 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs | 75 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj | 56 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs | 21 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj | 9 | ||||
| -rw-r--r-- | src/wix/wix.csproj | 2 | ||||
| -rw-r--r-- | src/wixcop/WixCop.csproj | 2 |
16 files changed, 302 insertions, 148 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 | ||
| 3 | namespace WixToolset.BuildTasks | 3 | namespace 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 | |||
| 3 | namespace 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 | <!-- |
diff --git a/src/WixToolset.Tools.Core/WixToolset.Tools.Core.csproj b/src/WixToolset.Tools.Core/WixToolset.Tools.Core.csproj index 04869f00..eb091635 100644 --- a/src/WixToolset.Tools.Core/WixToolset.Tools.Core.csproj +++ b/src/WixToolset.Tools.Core/WixToolset.Tools.Core.csproj | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | </ItemGroup> | 15 | </ItemGroup> |
| 16 | 16 | ||
| 17 | <ItemGroup> | 17 | <ItemGroup> |
| 18 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/> | 18 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> |
| 19 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> | 19 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> |
| 20 | </ItemGroup> | 20 | </ItemGroup> |
| 21 | </Project> | 21 | </Project> |
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs new file mode 100644 index 00000000..de78c0bc --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs | |||
| @@ -0,0 +1,75 @@ | |||
| 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 | |||
| 3 | namespace WixToolsetTest.BuildTasks | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.BuildTasks; | ||
| 10 | using WixToolset.Core.TestPackage; | ||
| 11 | using WixToolset.Data; | ||
| 12 | using WixToolset.Data.Tuples; | ||
| 13 | using Xunit; | ||
| 14 | |||
| 15 | public class MsbuildHeatFixture | ||
| 16 | { | ||
| 17 | private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(HeatTask).Assembly.CodeBase).AbsolutePath), "wix.targets"); | ||
| 18 | |||
| 19 | [Fact] | ||
| 20 | public void CanBuildHeatFilePackage() | ||
| 21 | { | ||
| 22 | var projectPath = TestData.Get(@"TestData\HeatFilePackage\HeatFilePackage.wixproj"); | ||
| 23 | |||
| 24 | using (var fs = new DisposableFileSystem()) | ||
| 25 | { | ||
| 26 | var baseFolder = fs.GetFolder(); | ||
| 27 | var binFolder = Path.Combine(baseFolder, @"bin\"); | ||
| 28 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
| 29 | |||
| 30 | var result = MsbuildRunner.Execute(projectPath, new[] | ||
| 31 | { | ||
| 32 | $"-p:WixTargetsPath={WixTargetsPath}", | ||
| 33 | $"-p:IntermediateOutputPath={intermediateFolder}", | ||
| 34 | $"-p:OutputPath={binFolder}" | ||
| 35 | }); | ||
| 36 | result.AssertSuccess(); | ||
| 37 | |||
| 38 | var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); | ||
| 39 | Assert.Single(heatCommandLines); | ||
| 40 | |||
| 41 | var warnings = result.Output.Where(line => line.Contains(": warning")); | ||
| 42 | Assert.Empty(warnings); | ||
| 43 | |||
| 44 | var generatedFilePath = Path.Combine(intermediateFolder, @"_HeatFilePackage_file.wxs"); | ||
| 45 | Assert.True(File.Exists(generatedFilePath)); | ||
| 46 | |||
| 47 | var generatedContents = File.ReadAllText(generatedFilePath); | ||
| 48 | var testXml = generatedContents.GetTestXml(); | ||
| 49 | Assert.Equal(@"<Wix>" + | ||
| 50 | "<Fragment>" + | ||
| 51 | "<DirectoryRef Id='INSTALLFOLDER'>" + | ||
| 52 | "<Component Id='HeatFilePackage.wixproj' Guid='*'>" + | ||
| 53 | "<File Id='HeatFilePackage.wixproj' KeyPath='yes' Source='SourceDir\\HeatFilePackage.wixproj' />" + | ||
| 54 | "</Component>" + | ||
| 55 | "</DirectoryRef>" + | ||
| 56 | "</Fragment>" + | ||
| 57 | "<Fragment>" + | ||
| 58 | "<ComponentGroup Id='ProductComponents'>" + | ||
| 59 | "<ComponentRef Id='HeatFilePackage.wixproj' />" + | ||
| 60 | "</ComponentGroup>" + | ||
| 61 | "</Fragment>" + | ||
| 62 | "</Wix>", testXml); | ||
| 63 | |||
| 64 | var pdbPath = Path.Combine(binFolder, "HeatFilePackage.wixpdb"); | ||
| 65 | Assert.True(File.Exists(pdbPath)); | ||
| 66 | |||
| 67 | var intermediate = Intermediate.Load(pdbPath); | ||
| 68 | var section = intermediate.Sections.Single(); | ||
| 69 | |||
| 70 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); | ||
| 71 | Assert.Equal(@"SourceDir\HeatFilePackage.wixproj", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | } | ||
| 75 | } | ||
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj new file mode 100644 index 00000000..87f4388a --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
| 6 | </PropertyGroup> | ||
| 7 | |||
| 8 | <PropertyGroup> | ||
| 9 | <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid> | ||
| 10 | </PropertyGroup> | ||
| 11 | |||
| 12 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
| 13 | <PlatformName>$(Platform)</PlatformName> | ||
| 14 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
| 15 | <DefineConstants>Debug</DefineConstants> | ||
| 16 | </PropertyGroup> | ||
| 17 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
| 18 | <PlatformName>$(Platform)</PlatformName> | ||
| 19 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
| 20 | </PropertyGroup> | ||
| 21 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> | ||
| 22 | <PlatformName>$(Platform)</PlatformName> | ||
| 23 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
| 24 | <DefineConstants>Debug</DefineConstants> | ||
| 25 | </PropertyGroup> | ||
| 26 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> | ||
| 27 | <PlatformName>$(Platform)</PlatformName> | ||
| 28 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
| 29 | </PropertyGroup> | ||
| 30 | |||
| 31 | <ItemGroup> | ||
| 32 | <Compile Include="Package.wxs" /> | ||
| 33 | </ItemGroup> | ||
| 34 | |||
| 35 | <ItemGroup> | ||
| 36 | <BindInputPaths Include="." /> | ||
| 37 | </ItemGroup> | ||
| 38 | |||
| 39 | <PropertyGroup> | ||
| 40 | <HarvestFileSuppressUniqueIds>true</HarvestFileSuppressUniqueIds> | ||
| 41 | </PropertyGroup> | ||
| 42 | |||
| 43 | <ItemGroup> | ||
| 44 | <HarvestFile Include="HeatFilePackage.wixproj"> | ||
| 45 | <ComponentGroupName>ProductComponents</ComponentGroupName> | ||
| 46 | <DirectoryRefId>INSTALLFOLDER</DirectoryRefId> | ||
| 47 | <SuppressRootDirectory>true</SuppressRootDirectory> | ||
| 48 | </HarvestFile> | ||
| 49 | </ItemGroup> | ||
| 50 | |||
| 51 | <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> | ||
| 52 | <Import Project="$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets') " /> | ||
| 53 | <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> | ||
| 54 | <Error Text="WiX Toolset build tools (v4.0 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." /> | ||
| 55 | </Target> | ||
| 56 | </Project> \ No newline at end of file | ||
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs new file mode 100644 index 00000000..e509c464 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | |||
| 3 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 4 | <Product Id="*" Name="HeatFilePackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
| 5 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | ||
| 6 | |||
| 7 | <MediaTemplate /> | ||
| 8 | |||
| 9 | <Feature Id="ProductFeature" Title="HeatFileFeature"> | ||
| 10 | <ComponentGroupRef Id="ProductComponents" /> | ||
| 11 | </Feature> | ||
| 12 | </Product> | ||
| 13 | |||
| 14 | <Fragment> | ||
| 15 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 16 | <Directory Id="ProgramFilesFolder"> | ||
| 17 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
| 18 | </Directory> | ||
| 19 | </Directory> | ||
| 20 | </Fragment> | ||
| 21 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj index eba81c0c..7573339f 100644 --- a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj +++ b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj | |||
| @@ -9,6 +9,14 @@ | |||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | <Content Include="TestData\HeatFilePackage\HeatFilePackage.wixproj" CopyToOutputDirectory="PreserveNewest" /> | ||
| 13 | <Content Include="TestData\HeatFilePackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 14 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\MsiPackage.wixproj" CopyToOutputDirectory="PreserveNewest" /> | ||
| 15 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\Package.de-de.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
| 16 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
| 17 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 18 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 19 | <Content Include="TestData\MultiCulturalMsiPackage\MsiPackage\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
| 12 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj" CopyToOutputDirectory="PreserveNewest" /> | 20 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj" CopyToOutputDirectory="PreserveNewest" /> |
| 13 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 21 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 14 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| @@ -24,6 +32,7 @@ | |||
| 24 | <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472'" /> | 32 | <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472'" /> |
| 25 | <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.7.179" Condition="'$(TargetFramework)'=='netcoreapp2.1' " /> | 33 | <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.7.179" Condition="'$(TargetFramework)'=='netcoreapp2.1' " /> |
| 26 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | 34 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> |
| 35 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> | ||
| 27 | </ItemGroup> | 36 | </ItemGroup> |
| 28 | 37 | ||
| 29 | <ItemGroup> | 38 | <ItemGroup> |
diff --git a/src/wix/wix.csproj b/src/wix/wix.csproj index ea820230..4fd8c8ee 100644 --- a/src/wix/wix.csproj +++ b/src/wix/wix.csproj | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | </ItemGroup> | 26 | </ItemGroup> |
| 27 | 27 | ||
| 28 | <ItemGroup> | 28 | <ItemGroup> |
| 29 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" /> | 29 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> |
| 30 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> | 30 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> |
| 31 | </ItemGroup> | 31 | </ItemGroup> |
| 32 | </Project> | 32 | </Project> |
diff --git a/src/wixcop/WixCop.csproj b/src/wixcop/WixCop.csproj index 858d3b52..0e6be055 100644 --- a/src/wixcop/WixCop.csproj +++ b/src/wixcop/WixCop.csproj | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | </ItemGroup> | 25 | </ItemGroup> |
| 26 | 26 | ||
| 27 | <ItemGroup> | 27 | <ItemGroup> |
| 28 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/> | 28 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> |
| 29 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> | 29 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" /> |
| 30 | </ItemGroup> | 30 | </ItemGroup> |
| 31 | </Project> | 31 | </Project> |
