diff options
Diffstat (limited to 'src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs')
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs b/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs new file mode 100644 index 00000000..c07c12b9 --- /dev/null +++ b/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs | |||
| @@ -0,0 +1,71 @@ | |||
| 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 Microsoft.Build.Framework; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// An MSBuild task to run WiX to reattach a (signed) bundle engine to its bundle. | ||
| 9 | /// </summary> | ||
| 10 | public sealed partial class ReattachSignedBundleEngine : WixExeBaseTask | ||
| 11 | { | ||
| 12 | /// <summary> | ||
| 13 | /// The bundle to which to attach the bundle engine. | ||
| 14 | /// </summary> | ||
| 15 | [Required] | ||
| 16 | public ITaskItem BundleFile { get; set; } | ||
| 17 | |||
| 18 | /// <summary> | ||
| 19 | /// The bundle engine file to reattach to the bundle. | ||
| 20 | /// </summary> | ||
| 21 | [Required] | ||
| 22 | public ITaskItem BundleEngineFile { get; set; } | ||
| 23 | |||
| 24 | /// <summary> | ||
| 25 | /// Gets or sets the intermedidate folder to use. | ||
| 26 | /// </summary> | ||
| 27 | public ITaskItem IntermediateDirectory { get; set; } | ||
| 28 | |||
| 29 | /// <summary> | ||
| 30 | /// Gets or sets the path to the output detached bundle. | ||
| 31 | /// </summary> | ||
| 32 | [Required] | ||
| 33 | public ITaskItem OutputFile { get; set; } | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Gets or sets the output. Only set if the task does work. | ||
| 37 | /// </summary> | ||
| 38 | [Output] | ||
| 39 | public ITaskItem Output { get; set; } | ||
| 40 | |||
| 41 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) | ||
| 42 | { | ||
| 43 | commandLineBuilder.AppendTextUnquoted("burn reattach"); | ||
| 44 | |||
| 45 | commandLineBuilder.AppendFileNameIfNotNull(this.BundleFile); | ||
| 46 | commandLineBuilder.AppendSwitchIfNotNull("-engine ", this.BundleEngineFile); | ||
| 47 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | ||
| 48 | commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); | ||
| 49 | |||
| 50 | base.BuildCommandLine(commandLineBuilder); | ||
| 51 | |||
| 52 | commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); | ||
| 53 | } | ||
| 54 | |||
| 55 | protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) | ||
| 56 | { | ||
| 57 | var exitCode = base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); | ||
| 58 | |||
| 59 | if (exitCode == 0) // successfully did work. | ||
| 60 | { | ||
| 61 | this.Output = this.OutputFile; | ||
| 62 | } | ||
| 63 | else if (exitCode == -1000) // no work done. | ||
| 64 | { | ||
| 65 | exitCode = 0; | ||
| 66 | } | ||
| 67 | |||
| 68 | return exitCode; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | } | ||
