aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.BuildTasks/AssemblyInfo.cs7
-rw-r--r--src/WixToolset.BuildTasks/BuildException.cs26
-rw-r--r--src/WixToolset.BuildTasks/Candle.cs199
-rw-r--r--src/WixToolset.BuildTasks/Common.cs41
-rw-r--r--src/WixToolset.BuildTasks/ConvertReferences.cs93
-rw-r--r--src/WixToolset.BuildTasks/CreateItemAvoidingInference.cs60
-rw-r--r--src/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs271
-rw-r--r--src/WixToolset.BuildTasks/DoIt-Compile.cs192
-rw-r--r--src/WixToolset.BuildTasks/DoIt.cs342
-rw-r--r--src/WixToolset.BuildTasks/FileSearchHelperMethods.cs60
-rw-r--r--src/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs146
-rw-r--r--src/WixToolset.BuildTasks/GetCabList.cs87
-rw-r--r--src/WixToolset.BuildTasks/GetLooseFileList.cs230
-rw-r--r--src/WixToolset.BuildTasks/GlobalSuppressions.cs8
-rw-r--r--src/WixToolset.BuildTasks/Insignia.cs118
-rw-r--r--src/WixToolset.BuildTasks/Light.cs488
-rw-r--r--src/WixToolset.BuildTasks/Lit.cs178
-rw-r--r--src/WixToolset.BuildTasks/Pyro.cs140
-rw-r--r--src/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs132
-rw-r--r--src/WixToolset.BuildTasks/RefreshGeneratedFile.cs118
-rw-r--r--src/WixToolset.BuildTasks/ReplaceString.cs54
-rw-r--r--src/WixToolset.BuildTasks/ResolveWixReferences.cs212
-rw-r--r--src/WixToolset.BuildTasks/TaskBase.cs65
-rw-r--r--src/WixToolset.BuildTasks/Torch.cs159
-rw-r--r--src/WixToolset.BuildTasks/WixAssignCulture.cs229
-rw-r--r--src/WixToolset.BuildTasks/WixCommandLineBuilder.cs177
-rw-r--r--src/WixToolset.BuildTasks/WixToolTask.cs403
-rw-r--r--src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj42
-rw-r--r--src/WixToolset.BuildTasks/heatdirectory.cs103
-rw-r--r--src/WixToolset.BuildTasks/heatfile.cs95
-rw-r--r--src/WixToolset.BuildTasks/heatproject.cs108
-rw-r--r--src/WixToolset.BuildTasks/heattask.cs121
-rw-r--r--src/WixToolset.BuildTasks/redirects/wix.ca.targets10
-rw-r--r--src/WixToolset.BuildTasks/redirects/wix.targets10
-rw-r--r--src/WixToolset.BuildTasks/wix.ca.targets123
-rw-r--r--src/WixToolset.BuildTasks/wix.harvest.targets511
-rw-r--r--src/WixToolset.BuildTasks/wix.signing.targets378
-rw-r--r--src/WixToolset.BuildTasks/wix.targets1356
-rw-r--r--src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.csproj28
-rw-r--r--src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.nuspec20
-rw-r--r--src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.props8
-rw-r--r--src/WixToolset.Core.TestPackage/WixRunner.cs39
-rw-r--r--src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MsiBackend.cs2
-rw-r--r--src/WixToolset.Core/WixToolset.Core.csproj2
-rw-r--r--src/candle/App.icobin1078 -> 0 bytes
-rw-r--r--src/candle/AssemblyInfo.cs11
-rw-r--r--src/candle/CandleCommandLine.cs343
-rw-r--r--src/candle/CandleStrings.Designer.cs81
-rw-r--r--src/candle/CandleStrings.resx142
-rw-r--r--src/candle/CompileFile.cs20
-rw-r--r--src/candle/app.config9
-rw-r--r--src/candle/candle.cs200
-rw-r--r--src/candle/candle.csproj62
-rw-r--r--src/candle/candle.exe.manifest9
-rw-r--r--src/candle/candle.rc10
-rw-r--r--src/light/App.icobin1078 -> 0 bytes
-rw-r--r--src/light/AssemblyInfo.cs9
-rw-r--r--src/light/LightCommandLine.cs421
-rw-r--r--src/light/LightStrings.Designer.cs104
-rw-r--r--src/light/LightStrings.resx174
-rw-r--r--src/light/app.config9
-rw-r--r--src/light/light.cs574
-rw-r--r--src/light/light.csproj24
-rw-r--r--src/test/Example.Extension/Data/example.txt (renamed from src/test/TestData/Example.Extension/Data/example.txt)0
-rw-r--r--src/test/Example.Extension/Data/example.wir (renamed from src/test/TestData/Example.Extension/Data/example.wir)bin534 -> 534 bytes
-rw-r--r--src/test/Example.Extension/Data/example.wxs (renamed from src/test/TestData/Example.Extension/Data/example.wxs)0
-rw-r--r--src/test/Example.Extension/Example.Extension.csproj (renamed from src/test/TestData/Example.Extension/Example.Extension.csproj)0
-rw-r--r--src/test/Example.Extension/ExampleCompilerExtension.cs (renamed from src/test/TestData/Example.Extension/ExampleCompilerExtension.cs)0
-rw-r--r--src/test/Example.Extension/ExampleExtensionData.cs (renamed from src/test/TestData/Example.Extension/ExampleExtensionData.cs)0
-rw-r--r--src/test/Example.Extension/ExampleExtensionFactory.cs (renamed from src/test/TestData/Example.Extension/ExampleExtensionFactory.cs)0
-rw-r--r--src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs (renamed from src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs)0
-rw-r--r--src/test/Example.Extension/ExampleTableDefinitions.cs (renamed from src/test/TestData/Example.Extension/ExampleTableDefinitions.cs)0
-rw-r--r--src/test/Example.Extension/ExampleTuple.cs (renamed from src/test/TestData/Example.Extension/ExampleTuple.cs)0
-rw-r--r--src/test/Example.Extension/ExampleTupleDefinitions.cs (renamed from src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs)0
-rw-r--r--src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs (renamed from src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs)0
-rw-r--r--src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs33
-rw-r--r--src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs64
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj57
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl11
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs21
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs10
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln31
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj55
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs21
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs10
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln31
-rw-r--r--src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj32
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs14
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs (renamed from src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs)70
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj7
-rw-r--r--src/test/WixToolsetTest.LightIntegration/LightFixture.cs48
-rw-r--r--src/test/WixToolsetTest.LightIntegration/TestData/Wixout/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.LightIntegration/TestData/Wixout/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.LightIntegration/TestData/Wixout/test.wixoutbin10354 -> 0 bytes
-rw-r--r--src/test/WixToolsetTest.LightIntegration/Utility/DisposableFileSystem.cs86
-rw-r--r--src/test/WixToolsetTest.LightIntegration/Utility/TestData.cs17
-rw-r--r--src/test/WixToolsetTest.LightIntegration/WixToolsetTest.LightIntegration.csproj30
-rw-r--r--src/wix/Program.cs122
-rw-r--r--src/wix/wix.cmd3
-rw-r--r--src/wix/wix.csproj30
105 files changed, 77 insertions, 10159 deletions
diff --git a/src/WixToolset.BuildTasks/AssemblyInfo.cs b/src/WixToolset.BuildTasks/AssemblyInfo.cs
deleted file mode 100644
index ae52fce8..00000000
--- a/src/WixToolset.BuildTasks/AssemblyInfo.cs
+++ /dev/null
@@ -1,7 +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
3using System.Reflection;
4using System.Runtime.InteropServices;
5
6[assembly: AssemblyCulture("")]
7[assembly: ComVisible(false)]
diff --git a/src/WixToolset.BuildTasks/BuildException.cs b/src/WixToolset.BuildTasks/BuildException.cs
deleted file mode 100644
index 953134ba..00000000
--- a/src/WixToolset.BuildTasks/BuildException.cs
+++ /dev/null
@@ -1,26 +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.BuildTasks
4{
5 using System;
6 using System.Globalization;
7
8 class BuildException : Exception
9 {
10 public BuildException()
11 {
12 }
13
14 public BuildException(string message) : base(message)
15 {
16 }
17
18 public BuildException(string message, Exception innerException) : base(message, innerException)
19 {
20 }
21
22 public BuildException(string format, params string[] args) : this(String.Format(CultureInfo.CurrentCulture, format, args))
23 {
24 }
25 }
26}
diff --git a/src/WixToolset.BuildTasks/Candle.cs b/src/WixToolset.BuildTasks/Candle.cs
deleted file mode 100644
index 82b15838..00000000
--- a/src/WixToolset.BuildTasks/Candle.cs
+++ /dev/null
@@ -1,199 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.Globalization;
9 using System.IO;
10 using System.Text;
11
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14
15 /// <summary>
16 /// An MSBuild task to run the WiX compiler.
17 /// </summary>
18 public sealed class CandleOld : WixToolTask
19 {
20 private const string CandleToolName = "candle.exe";
21
22 private string[] defineConstants;
23 private ITaskItem[] extensions;
24 private string[] includeSearchPaths;
25 private ITaskItem outputFile;
26 private bool pedantic;
27 private string installerPlatform;
28 private string preprocessToFile;
29 private bool preprocessToStdOut;
30 private ITaskItem[] sourceFiles;
31 private string extensionDirectory;
32 private string[] referencePaths;
33
34 public string[] DefineConstants
35 {
36 get { return this.defineConstants; }
37 set { this.defineConstants = value; }
38 }
39
40 public ITaskItem[] Extensions
41 {
42 get { return this.extensions; }
43 set { this.extensions = value; }
44 }
45
46 public string[] IncludeSearchPaths
47 {
48 get { return this.includeSearchPaths; }
49 set { this.includeSearchPaths = value; }
50 }
51
52 public string InstallerPlatform
53 {
54 get { return this.installerPlatform; }
55 set { this.installerPlatform = value; }
56 }
57
58 [Output]
59 [Required]
60 public ITaskItem OutputFile
61 {
62 get { return this.outputFile; }
63 set { this.outputFile = value; }
64 }
65
66 public bool Pedantic
67 {
68 get { return this.pedantic; }
69 set { this.pedantic = value; }
70 }
71
72 public string PreprocessToFile
73 {
74 get { return this.preprocessToFile; }
75 set { this.preprocessToFile = value; }
76 }
77
78 public bool PreprocessToStdOut
79 {
80 get { return this.preprocessToStdOut; }
81 set { this.preprocessToStdOut = value; }
82 }
83
84 [Required]
85 public ITaskItem[] SourceFiles
86 {
87 get { return this.sourceFiles; }
88 set { this.sourceFiles = value; }
89 }
90
91 public string ExtensionDirectory
92 {
93 get { return this.extensionDirectory; }
94 set { this.extensionDirectory = value; }
95 }
96
97 public string[] ReferencePaths
98 {
99 get { return this.referencePaths; }
100 set { this.referencePaths = value; }
101 }
102
103 /// <summary>
104 /// Get the name of the executable.
105 /// </summary>
106 /// <remarks>The ToolName is used with the ToolPath to get the location of candle.exe.</remarks>
107 /// <value>The name of the executable.</value>
108 protected override string ToolName
109 {
110 get { return CandleToolName; }
111 }
112
113 /// <summary>
114 /// Get the path to the executable.
115 /// </summary>
116 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
117 /// <returns>The full path to the executable or simply candle.exe if it's expected to be in the system path.</returns>
118 protected override string GenerateFullPathToTool()
119 {
120 // If there's not a ToolPath specified, it has to be in the system path.
121 if (String.IsNullOrEmpty(this.ToolPath))
122 {
123 return CandleToolName;
124 }
125
126 return Path.Combine(Path.GetFullPath(this.ToolPath), CandleToolName);
127 }
128
129 /// <summary>
130 /// Builds a command line from options in this task.
131 /// </summary>
132 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
133 {
134 base.BuildCommandLine(commandLineBuilder);
135
136 commandLineBuilder.AppendIfTrue("-p", this.PreprocessToStdOut);
137 commandLineBuilder.AppendSwitchIfNotNull("-p", this.PreprocessToFile);
138 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
139 commandLineBuilder.AppendArrayIfNotNull("-d", this.DefineConstants);
140 commandLineBuilder.AppendArrayIfNotNull("-I", this.IncludeSearchPaths);
141 commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
142 commandLineBuilder.AppendSwitchIfNotNull("-arch ", this.InstallerPlatform);
143 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
144 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
145
146 // Support per-source-file output by looking at the SourceFiles items to
147 // see if there is any "CandleOutput" metadata. If there is, we do our own
148 // appending, otherwise we fall back to the built-in "append file names" code.
149 // Note also that the wix.targets "Compile" target does *not* automagically
150 // fix the "@(CompileObjOutput)" list to include these new output names.
151 // If you really want to use this, you're going to have to clone the target
152 // in your own .targets file and create the output list yourself.
153 bool usePerSourceOutput = false;
154 if (this.SourceFiles != null)
155 {
156 foreach (ITaskItem item in this.SourceFiles)
157 {
158 if (!String.IsNullOrEmpty(item.GetMetadata("CandleOutput")))
159 {
160 usePerSourceOutput = true;
161 break;
162 }
163 }
164 }
165
166 if (usePerSourceOutput)
167 {
168 string[] newSourceNames = new string[this.SourceFiles.Length];
169 for (int iSource = 0; iSource < this.SourceFiles.Length; ++iSource)
170 {
171 ITaskItem item = this.SourceFiles[iSource];
172 if (null == item)
173 {
174 newSourceNames[iSource] = null;
175 }
176 else
177 {
178 string output = item.GetMetadata("CandleOutput");
179
180 if (!String.IsNullOrEmpty(output))
181 {
182 newSourceNames[iSource] = String.Concat(item.ItemSpec, ";", output);
183 }
184 else
185 {
186 newSourceNames[iSource] = item.ItemSpec;
187 }
188 }
189 }
190
191 commandLineBuilder.AppendFileNamesIfNotNull(newSourceNames, " ");
192 }
193 else
194 {
195 commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
196 }
197 }
198 }
199}
diff --git a/src/WixToolset.BuildTasks/Common.cs b/src/WixToolset.BuildTasks/Common.cs
deleted file mode 100644
index 803e9d14..00000000
--- a/src/WixToolset.BuildTasks/Common.cs
+++ /dev/null
@@ -1,41 +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
4{
5 using System;
6 using System.Globalization;
7 using System.Text;
8 using System.Text.RegularExpressions;
9
10 /// <summary>
11 /// Common WixTasks utility methods and types.
12 /// </summary>
13 internal static class Common
14 {
15 /// <summary>Metadata key name to turn off harvesting of project references.</summary>
16 public const string DoNotHarvest = "DoNotHarvest";
17
18 private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled);
19 private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters
20
21 /// <summary>
22 /// Return an identifier based on passed file/directory name
23 /// </summary>
24 /// <param name="name">File/directory name to generate identifer from</param>
25 /// <returns>A version of the name that is a legal identifier.</returns>
26 /// <remarks>This is duplicated from WiX's Common class.</remarks>
27 internal static string GetIdentifierFromName(string name)
28 {
29 string result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_".
30
31 // MSI identifiers must begin with an alphabetic character or an
32 // underscore. Prefix all other values with an underscore.
33 if (AddPrefix.IsMatch(name))
34 {
35 result = String.Concat("_", result);
36 }
37
38 return result;
39 }
40 }
41}
diff --git a/src/WixToolset.BuildTasks/ConvertReferences.cs b/src/WixToolset.BuildTasks/ConvertReferences.cs
deleted file mode 100644
index fe137633..00000000
--- a/src/WixToolset.BuildTasks/ConvertReferences.cs
+++ /dev/null
@@ -1,93 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Collections.Generic;
8 using System.Globalization;
9 using System.IO;
10 using System.Xml;
11 using Microsoft.Build.Framework;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
16 /// WixLocalization element inside the file.
17 /// </summary>
18 public class ConvertReferences : Task
19 {
20 private string projectOutputGroups;
21 private ITaskItem[] projectReferences;
22 private ITaskItem[] harvestItems;
23
24 /// <summary>
25 /// The total list of cabs in this database
26 /// </summary>
27 [Output]
28 public ITaskItem[] HarvestItems
29 {
30 get { return this.harvestItems; }
31 }
32
33 /// <summary>
34 /// The project output groups to harvest.
35 /// </summary>
36 [Required]
37 public string ProjectOutputGroups
38 {
39 get { return this.projectOutputGroups; }
40 set { this.projectOutputGroups = value; }
41 }
42
43 /// <summary>
44 /// All the project references in the project.
45 /// </summary>
46 [Required]
47 public ITaskItem[] ProjectReferences
48 {
49 get { return this.projectReferences; }
50 set { this.projectReferences = value; }
51 }
52
53 /// <summary>
54 /// Gets a complete list of external cabs referenced by the given installer database file.
55 /// </summary>
56 /// <returns>True upon completion of the task execution.</returns>
57 public override bool Execute()
58 {
59 List<ITaskItem> newItems = new List<ITaskItem>();
60
61 foreach(ITaskItem item in this.ProjectReferences)
62 {
63 Dictionary<string, string> newItemMetadeta = new Dictionary<string, string>();
64
65 if (!String.IsNullOrEmpty(item.GetMetadata(Common.DoNotHarvest)))
66 {
67 continue;
68 }
69
70 string refTargetDir = item.GetMetadata("RefTargetDir");
71 if (!String.IsNullOrEmpty(refTargetDir))
72 {
73 newItemMetadeta.Add("DirectoryIds", refTargetDir);
74 }
75
76 string refName = item.GetMetadata("Name");
77 if (!String.IsNullOrEmpty(refName))
78 {
79 newItemMetadeta.Add("ProjectName", refName);
80 }
81
82 newItemMetadeta.Add("ProjectOutputGroups", this.ProjectOutputGroups);
83
84 ITaskItem newItem = new TaskItem(item.ItemSpec, newItemMetadeta);
85 newItems.Add(newItem);
86 }
87
88 this.harvestItems = newItems.ToArray();
89
90 return true;
91 }
92 }
93}
diff --git a/src/WixToolset.BuildTasks/CreateItemAvoidingInference.cs b/src/WixToolset.BuildTasks/CreateItemAvoidingInference.cs
deleted file mode 100644
index 84816cac..00000000
--- a/src/WixToolset.BuildTasks/CreateItemAvoidingInference.cs
+++ /dev/null
@@ -1,60 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Collections.Generic;
8 using System.Globalization;
9 using System.IO;
10 using System.Xml;
11 using Microsoft.Build.Framework;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
16 /// WixLocalization element inside the file.
17 /// </summary>
18 public class CreateItemAvoidingInference : Task
19 {
20 private string inputProperties;
21 private ITaskItem[] outputItems;
22
23 /// <summary>
24 /// The output items.
25 /// </summary>
26 [Output]
27 public ITaskItem[] OuputItems
28 {
29 get { return this.outputItems; }
30 }
31
32 /// <summary>
33 /// The properties to converty to items.
34 /// </summary>
35 [Required]
36 public string InputProperties
37 {
38 get { return this.inputProperties; }
39 set { this.inputProperties = value; }
40 }
41
42 /// <summary>
43 /// Gets a complete list of external cabs referenced by the given installer database file.
44 /// </summary>
45 /// <returns>True upon completion of the task execution.</returns>
46 public override bool Execute()
47 {
48 List<ITaskItem> newItems = new List<ITaskItem>();
49
50 foreach (string property in this.inputProperties.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
51 {
52 newItems.Add(new TaskItem(property));
53 }
54
55 this.outputItems = newItems.ToArray();
56
57 return true;
58 }
59 }
60}
diff --git a/src/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs b/src/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs
deleted file mode 100644
index 7cda6b01..00000000
--- a/src/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs
+++ /dev/null
@@ -1,271 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9 using Microsoft.Build.Framework;
10 using Microsoft.Build.Utilities;
11
12 /// <summary>
13 /// An MSBuild task to create a list of preprocessor defines to be passed to candle from the
14 /// list of referenced projects.
15 /// </summary>
16 public sealed class CreateProjectReferenceDefineConstants : Task
17 {
18 private ITaskItem[] defineConstants;
19 private ITaskItem[] projectConfigurations;
20 private ITaskItem[] projectReferencePaths;
21
22 [Output]
23 public ITaskItem[] DefineConstants
24 {
25 get { return this.defineConstants; }
26 }
27
28 [Required]
29 public ITaskItem[] ProjectReferencePaths
30 {
31 get { return this.projectReferencePaths; }
32 set { this.projectReferencePaths = value; }
33 }
34
35 public ITaskItem[] ProjectConfigurations
36 {
37 get { return this.projectConfigurations; }
38 set { this.projectConfigurations = value; }
39 }
40
41 public override bool Execute()
42 {
43 List<ITaskItem> outputItems = new List<ITaskItem>();
44 Dictionary<string, string> defineConstants = new Dictionary<string, string>();
45
46 for (int i = 0; i < this.ProjectReferencePaths.Length; i++)
47 {
48 ITaskItem item = this.ProjectReferencePaths[i];
49
50 string configuration = item.GetMetadata("Configuration");
51 string fullConfiguration = item.GetMetadata("FullConfiguration");
52 string platform = item.GetMetadata("Platform");
53
54 string projectPath = CreateProjectReferenceDefineConstants.GetProjectPath(this.ProjectReferencePaths, i);
55 string projectDir = Path.GetDirectoryName(projectPath) + Path.DirectorySeparatorChar;
56 string projectExt = Path.GetExtension(projectPath);
57 string projectFileName = Path.GetFileName(projectPath);
58 string projectName = Path.GetFileNameWithoutExtension(projectPath);
59
60 string referenceName = CreateProjectReferenceDefineConstants.GetReferenceName(item, projectName);
61
62 string targetPath = item.GetMetadata("FullPath");
63 string targetDir = Path.GetDirectoryName(targetPath) + Path.DirectorySeparatorChar;
64 string targetExt = Path.GetExtension(targetPath);
65 string targetFileName = Path.GetFileName(targetPath);
66 string targetName = Path.GetFileNameWithoutExtension(targetPath);
67
68 // If there is no configuration metadata on the project reference task item,
69 // check for any additional configuration data provided in the optional task property.
70 if (String.IsNullOrEmpty(fullConfiguration))
71 {
72 fullConfiguration = this.FindProjectConfiguration(projectName);
73 if (!String.IsNullOrEmpty(fullConfiguration))
74 {
75 string[] typeAndPlatform = fullConfiguration.Split('|');
76 configuration = typeAndPlatform[0];
77 platform = (typeAndPlatform.Length > 1 ? typeAndPlatform[1] : String.Empty);
78 }
79 }
80
81 // write out the platform/configuration defines
82 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.Configuration", referenceName)] = configuration;
83 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.FullConfiguration", referenceName)] = fullConfiguration;
84 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.Platform", referenceName)] = platform;
85
86 // write out the ProjectX defines
87 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.ProjectDir", referenceName)] = projectDir;
88 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.ProjectExt", referenceName)] = projectExt;
89 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.ProjectFileName", referenceName)] = projectFileName;
90 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.ProjectName", referenceName)] = projectName;
91 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.ProjectPath", referenceName)] = projectPath;
92
93 // write out the TargetX defines
94 string targetDirDefine = String.Format(CultureInfo.InvariantCulture, "{0}.TargetDir", referenceName);
95 if (defineConstants.ContainsKey(targetDirDefine))
96 {
97 //if target dir was already defined, redefine it as the common root shared by multiple references from the same project
98 string commonDir = FindCommonRoot(targetDir, defineConstants[targetDirDefine]);
99 if (!String.IsNullOrEmpty(commonDir))
100 {
101 targetDir = commonDir;
102 }
103 }
104 defineConstants[targetDirDefine] = CreateProjectReferenceDefineConstants.EnsureEndsWithBackslash(targetDir);
105
106 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.TargetExt", referenceName)] = targetExt;
107 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.TargetFileName", referenceName)] = targetFileName;
108 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.TargetName", referenceName)] = targetName;
109
110 //if target path was already defined, append to it creating a list of multiple references from the same project
111 string targetPathDefine = String.Format(CultureInfo.InvariantCulture, "{0}.TargetPath", referenceName);
112 if (defineConstants.ContainsKey(targetPathDefine))
113 {
114 string oldTargetPath = defineConstants[targetPathDefine];
115 if (!targetPath.Equals(oldTargetPath, StringComparison.OrdinalIgnoreCase))
116 {
117 defineConstants[targetPathDefine] += ";" + targetPath;
118 }
119
120 //If there was only one targetpath we need to create its culture specific define
121 if (!oldTargetPath.Contains(";"))
122 {
123 string oldSubFolder = FindSubfolder(oldTargetPath, targetDir, targetFileName);
124 if (!String.IsNullOrEmpty(oldSubFolder))
125 {
126 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.{1}.TargetPath", referenceName, oldSubFolder.Replace('\\', '_'))] = oldTargetPath;
127 }
128 }
129
130 // Create a culture specific define
131 string subFolder = FindSubfolder(targetPath, targetDir, targetFileName);
132 if (!String.IsNullOrEmpty(subFolder))
133 {
134 defineConstants[String.Format(CultureInfo.InvariantCulture, "{0}.{1}.TargetPath", referenceName, subFolder.Replace('\\', '_'))] = targetPath;
135 }
136
137 }
138 else
139 {
140 defineConstants[targetPathDefine] = targetPath;
141 }
142 }
143
144 foreach (KeyValuePair<string, string> define in defineConstants)
145 {
146 outputItems.Add(new TaskItem(String.Format(CultureInfo.InvariantCulture, "{0}={1}", define.Key, define.Value)));
147 }
148
149 this.defineConstants = outputItems.ToArray();
150
151 return true;
152 }
153
154 public static string GetProjectPath(ITaskItem[] projectReferencePaths, int i)
155 {
156 return projectReferencePaths[i].GetMetadata("MSBuildSourceProjectFile");
157 }
158
159 public static string GetReferenceName(ITaskItem item, string projectName)
160 {
161 string referenceName = item.GetMetadata("Name");
162 if (String.IsNullOrEmpty(referenceName))
163 {
164 referenceName = projectName;
165 }
166
167 // We cannot have an equals sign in the variable name because it
168 // messes with the preprocessor definitions on the command line.
169 referenceName = referenceName.Replace('=', '_');
170
171 // We cannot have a double quote on the command line because it
172 // there is no way to escape it on the command line.
173 referenceName = referenceName.Replace('\"', '_');
174
175 // We cannot have parens in the variable name because the WiX
176 // preprocessor will not be able to parse it.
177 referenceName = referenceName.Replace('(', '_');
178 referenceName = referenceName.Replace(')', '_');
179
180 return referenceName;
181 }
182
183 /// <summary>
184 /// Look through the configuration data in the ProjectConfigurations property
185 /// to find the configuration for a project, if available.
186 /// </summary>
187 /// <param name="projectName">Name of the project that is being searched for.</param>
188 /// <returns>Full configuration spec, for example "Release|Win32".</returns>
189 private string FindProjectConfiguration(string projectName)
190 {
191 string configuration = String.Empty;
192
193 if (this.ProjectConfigurations != null)
194 {
195 foreach (ITaskItem configItem in this.ProjectConfigurations)
196 {
197 string configProject = configItem.ItemSpec;
198 if (configProject.Length > projectName.Length &&
199 configProject.StartsWith(projectName) &&
200 configProject[projectName.Length] == '=')
201 {
202 configuration = configProject.Substring(projectName.Length + 1);
203 break;
204 }
205 }
206 }
207
208 return configuration;
209 }
210
211 /// <summary>
212 /// Finds the common root between two paths
213 /// </summary>
214 /// <param name="path1"></param>
215 /// <param name="path2"></param>
216 /// <returns>common root on success, empty string on failure</returns>
217 private static string FindCommonRoot(string path1, string path2)
218 {
219 path1 = path1.TrimEnd(Path.DirectorySeparatorChar);
220 path2 = path2.TrimEnd(Path.DirectorySeparatorChar);
221
222 while (!String.IsNullOrEmpty(path1))
223 {
224 for (string searchPath = path2; !String.IsNullOrEmpty(searchPath); searchPath = Path.GetDirectoryName(searchPath))
225 {
226 if (path1.Equals(searchPath, StringComparison.OrdinalIgnoreCase))
227 {
228 return searchPath;
229 }
230 }
231
232 path1 = Path.GetDirectoryName(path1);
233 }
234
235 return path1;
236 }
237
238 /// <summary>
239 /// Finds the subfolder of a path, excluding a root and filename.
240 /// </summary>
241 /// <param name="path">Path to examine</param>
242 /// <param name="rootPath">Root that must be present </param>
243 /// <param name="fileName"></param>
244 /// <returns></returns>
245 private static string FindSubfolder(string path, string rootPath, string fileName)
246 {
247 if (Path.GetFileName(path).Equals(fileName, StringComparison.OrdinalIgnoreCase))
248 {
249 path = Path.GetDirectoryName(path);
250 }
251
252 if (path.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase))
253 {
254 // cut out the root and return the subpath
255 return path.Substring(rootPath.Length).Trim(Path.DirectorySeparatorChar);
256 }
257
258 return String.Empty;
259 }
260
261 private static string EnsureEndsWithBackslash(string dir)
262 {
263 if (dir[dir.Length - 1] != Path.DirectorySeparatorChar)
264 {
265 dir += Path.DirectorySeparatorChar;
266 }
267
268 return dir;
269 }
270 }
271}
diff --git a/src/WixToolset.BuildTasks/DoIt-Compile.cs b/src/WixToolset.BuildTasks/DoIt-Compile.cs
deleted file mode 100644
index f89078fe..00000000
--- a/src/WixToolset.BuildTasks/DoIt-Compile.cs
+++ /dev/null
@@ -1,192 +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
3#if false
4namespace WixToolset.BuildTasks
5{
6 using System;
7 using System.Collections.Generic;
8 using System.IO;
9 using Microsoft.Build.Framework;
10 using WixToolset.Data;
11
12 /// <summary>
13 /// An MSBuild task to run the WiX compiler.
14 /// </summary>
15 public sealed class Candle : TaskBase
16 {
17 public string[] DefineConstants { get; set; }
18
19 public ITaskItem[] Extensions { get; set; }
20
21 public string[] IncludeSearchPaths { get; set; }
22
23 public string InstallerPlatform { get; set; }
24
25 [Output]
26 [Required]
27 public ITaskItem OutputFile { get; set; }
28
29 public bool Pedantic { get; set; }
30
31 public string PreprocessToFile { get; set; }
32
33 public bool PreprocessToStdOut { get; set; }
34
35 [Required]
36 public ITaskItem IntermediateDirectory { get; set; }
37
38 [Required]
39 public ITaskItem[] SourceFiles { get; set; }
40
41 public string ExtensionDirectory { get; set; }
42
43 public string[] ReferencePaths { get; set; }
44
45 protected override void ExecuteCore()
46 {
47 Messaging.Instance.InitializeAppName("WIX", "wix.exe");
48
49 Messaging.Instance.Display += this.DisplayMessage;
50
51 var preprocessor = new Preprocessor();
52
53 var compiler = new Compiler();
54
55 var sourceFiles = this.GatherSourceFiles();
56
57 var preprocessorVariables = this.GatherPreprocessorVariables();
58
59 foreach (var sourceFile in sourceFiles)
60 {
61 var document = preprocessor.Process(sourceFile.SourcePath, preprocessorVariables);
62
63 var intermediate = compiler.Compile(document);
64
65 intermediate.Save(sourceFile.OutputPath);
66 }
67 }
68
69 private void DisplayMessage(object sender, DisplayEventArgs e)
70 {
71 this.Log.LogMessageFromText(e.Message, MessageImportance.Normal);
72 }
73
74 private IEnumerable<SourceFile> GatherSourceFiles()
75 {
76 var files = new List<SourceFile>();
77
78 foreach (var item in this.SourceFiles)
79 {
80 var sourcePath = item.ItemSpec;
81 var outputPath = item.GetMetadata("CandleOutput") ?? this.OutputFile?.ItemSpec;
82
83 if (String.IsNullOrEmpty(outputPath))
84 {
85 outputPath = Path.Combine(this.IntermediateDirectory.ItemSpec, Path.GetFileNameWithoutExtension(sourcePath) + ".wir");
86 }
87
88 files.Add(new SourceFile(sourcePath, outputPath));
89 }
90
91 return files;
92 }
93
94 private IDictionary<string, string> GatherPreprocessorVariables()
95 {
96 var variables = new Dictionary<string, string>();
97
98 foreach (var pair in this.DefineConstants)
99 {
100 string[] value = pair.Split(new[] { '=' }, 2);
101
102 if (variables.ContainsKey(value[0]))
103 {
104 //Messaging.Instance.OnMessage(WixErrors.DuplicateVariableDefinition(value[0], (1 == value.Length) ? String.Empty : value[1], this.PreprocessorVariables[value[0]]));
105 break;
106 }
107
108 if (1 == value.Length)
109 {
110 variables.Add(value[0], String.Empty);
111 }
112 else
113 {
114 variables.Add(value[0], value[1]);
115 }
116 }
117
118 return variables;
119 }
120
121 ///// <summary>
122 ///// Builds a command line from options in this task.
123 ///// </summary>
124 //protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
125 //{
126 // base.BuildCommandLine(commandLineBuilder);
127
128 // commandLineBuilder.AppendIfTrue("-p", this.PreprocessToStdOut);
129 // commandLineBuilder.AppendSwitchIfNotNull("-p", this.PreprocessToFile);
130 // commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
131 // commandLineBuilder.AppendArrayIfNotNull("-d", this.DefineConstants);
132 // commandLineBuilder.AppendArrayIfNotNull("-I", this.IncludeSearchPaths);
133 // commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
134 // commandLineBuilder.AppendSwitchIfNotNull("-arch ", this.InstallerPlatform);
135 // commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
136 // commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
137
138 // // Support per-source-file output by looking at the SourceFiles items to
139 // // see if there is any "CandleOutput" metadata. If there is, we do our own
140 // // appending, otherwise we fall back to the built-in "append file names" code.
141 // // Note also that the wix.targets "Compile" target does *not* automagically
142 // // fix the "@(CompileObjOutput)" list to include these new output names.
143 // // If you really want to use this, you're going to have to clone the target
144 // // in your own .targets file and create the output list yourself.
145 // bool usePerSourceOutput = false;
146 // if (this.SourceFiles != null)
147 // {
148 // foreach (ITaskItem item in this.SourceFiles)
149 // {
150 // if (!String.IsNullOrEmpty(item.GetMetadata("CandleOutput")))
151 // {
152 // usePerSourceOutput = true;
153 // break;
154 // }
155 // }
156 // }
157
158 // if (usePerSourceOutput)
159 // {
160 // string[] newSourceNames = new string[this.SourceFiles.Length];
161 // for (int iSource = 0; iSource < this.SourceFiles.Length; ++iSource)
162 // {
163 // ITaskItem item = this.SourceFiles[iSource];
164 // if (null == item)
165 // {
166 // newSourceNames[iSource] = null;
167 // }
168 // else
169 // {
170 // string output = item.GetMetadata("CandleOutput");
171
172 // if (!String.IsNullOrEmpty(output))
173 // {
174 // newSourceNames[iSource] = String.Concat(item.ItemSpec, ";", output);
175 // }
176 // else
177 // {
178 // newSourceNames[iSource] = item.ItemSpec;
179 // }
180 // }
181 // }
182
183 // commandLineBuilder.AppendFileNamesIfNotNull(newSourceNames, " ");
184 // }
185 // else
186 // {
187 // commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
188 // }
189 //}
190 }
191}
192#endif
diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs
deleted file mode 100644
index 02b33522..00000000
--- a/src/WixToolset.BuildTasks/DoIt.cs
+++ /dev/null
@@ -1,342 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Runtime.InteropServices;
8 using Microsoft.Build.Framework;
9 using Microsoft.Build.Utilities;
10 using WixToolset.Core;
11 using WixToolset.Data;
12 using WixToolset.Extensibility;
13 using WixToolset.Extensibility.Services;
14
15 /// <summary>
16 /// An MSBuild task to run the WiX compiler.
17 /// </summary>
18 public sealed class DoIt : Task
19 {
20 public string AdditionalOptions { get; set; }
21
22 public string[] Cultures { get; set; }
23
24 public string[] DefineConstants { get; set; }
25
26 public ITaskItem[] Extensions { get; set; }
27
28 public string ExtensionDirectory { get; set; }
29
30 public string[] IncludeSearchPaths { get; set; }
31
32 public string InstallerPlatform { get; set; }
33
34 [Required]
35 public ITaskItem IntermediateDirectory { get; set; }
36
37 public ITaskItem[] LocalizationFiles { get; set; }
38
39 public bool NoLogo { get; set; }
40
41 public ITaskItem[] LibraryFiles { get; set; }
42
43 [Output]
44 [Required]
45 public ITaskItem OutputFile { get; set; }
46
47 public string OutputType { get; set; }
48
49 public string PdbOutputFile { get; set; }
50
51 public bool Pedantic { get; set; }
52
53 [Required]
54 public ITaskItem[] SourceFiles { get; set; }
55
56 public string[] ReferencePaths { get; set; }
57
58
59 /// <summary>
60 /// Gets or sets whether all warnings should be suppressed.
61 /// </summary>
62 public bool SuppressAllWarnings { get; set; }
63
64 /// <summary>
65 /// Gets or sets a list of specific warnings to be suppressed.
66 /// </summary>
67 public string[] SuppressSpecificWarnings { get; set; }
68
69 /// <summary>
70 /// Gets or sets whether all warnings should be treated as errors.
71 /// </summary>
72 public bool TreatWarningsAsErrors { get; set; }
73
74 /// <summary>
75 /// Gets or sets a list of specific warnings to treat as errors.
76 /// </summary>
77 public string[] TreatSpecificWarningsAsErrors { get; set; }
78
79 /// <summary>
80 /// Gets or sets whether to display verbose output.
81 /// </summary>
82 public bool VerboseOutput { get; set; }
83
84
85 public ITaskItem[] BindInputPaths { get; set; }
86
87 public bool BindFiles { get; set; }
88
89 public ITaskItem BindContentsFile { get; set; }
90
91 public ITaskItem BindOutputsFile { get; set; }
92
93 public ITaskItem BindBuiltOutputsFile { get; set; }
94
95 public string CabinetCachePath { get; set; }
96 public int CabinetCreationThreadCount { get; set; }
97 public string DefaultCompressionLevel { get; set; }
98
99 [Output]
100 public ITaskItem UnreferencedSymbolsFile { get; set; }
101
102 public ITaskItem WixProjectFile { get; set; }
103 public string[] WixVariables { get; set; }
104
105 public bool SuppressValidation { get; set; }
106 public string[] SuppressIces { get; set; }
107 public string AdditionalCub { get; set; }
108
109 public override bool Execute()
110 {
111 try
112 {
113 this.ExecuteCore();
114 }
115 catch (Exception e)
116 {
117 this.Log.LogErrorFromException(e);
118
119 if (e is NullReferenceException || e is SEHException)
120 {
121 throw;
122 }
123 }
124
125 return !this.Log.HasLoggedErrors;
126 }
127
128 private void ExecuteCore()
129 {
130 var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode);
131
132 var commandLineBuilder = new WixCommandLineBuilder();
133
134 commandLineBuilder.AppendTextUnquoted("build");
135
136 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
137 commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType);
138 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
139 commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures);
140 commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants);
141 commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths);
142 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
143 commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation);
144 commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces);
145 commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile);
146 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
147 commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory);
148 commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile);
149 commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile);
150 commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile);
151
152 commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles);
153 commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings());
154 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
155 commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles);
156 commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions);
157 commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
158
159 var commandLineString = commandLineBuilder.ToString();
160
161 this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString);
162
163 var serviceProvider = new WixToolsetServiceProvider();
164
165 var messaging = serviceProvider.GetService<IMessaging>();
166 messaging.SetListener(listener);
167
168 var arguments = serviceProvider.GetService<ICommandLineArguments>();
169 arguments.Populate(commandLineString);
170
171 var context = serviceProvider.GetService<ICommandLineContext>();
172 context.Messaging = messaging;
173 context.ExtensionManager = this.CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
174 context.Arguments = arguments;
175
176 var commandLine = serviceProvider.GetService<ICommandLine>();
177 var command = commandLine.ParseStandardCommandLine(context);
178 command?.Execute();
179 }
180
181 private IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, string[] extensions)
182 {
183 var extensionManager = serviceProvider.GetService<IExtensionManager>();
184
185 foreach (var type in new[] { typeof(WixToolset.Core.Burn.WixToolsetStandardBackend), typeof(WixToolset.Core.WindowsInstaller.WixToolsetStandardBackend) })
186 {
187 extensionManager.Add(type.Assembly);
188 }
189
190 foreach (var extension in extensions)
191 {
192 extensionManager.Load(extension);
193 }
194
195 return extensionManager;
196 }
197
198 private void DisplayMessage(object sender, DisplayEventArgs e)
199 {
200 this.Log.LogMessageFromText(e.Message, MessageImportance.Normal);
201 }
202
203 private IEnumerable<string> CalculateBindPathStrings()
204 {
205 if (null != this.BindInputPaths)
206 {
207 foreach (var item in this.BindInputPaths)
208 {
209 var path = item.GetMetadata("FullPath");
210
211 var bindName = item.GetMetadata("BindName");
212 if (!String.IsNullOrEmpty(bindName))
213 {
214 yield return String.Concat(bindName, "=", path);
215 }
216 else
217 {
218 yield return path;
219 }
220 }
221 }
222 }
223
224 ///// <summary>
225 ///// Builds a command line from options in this task.
226 ///// </summary>
227 //protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
228 //{
229 // base.BuildCommandLine(commandLineBuilder);
230
231 // commandLineBuilder.AppendIfTrue("-p", this.PreprocessToStdOut);
232 // commandLineBuilder.AppendSwitchIfNotNull("-p", this.PreprocessToFile);
233 // commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
234 // commandLineBuilder.AppendArrayIfNotNull("-d", this.DefineConstants);
235 // commandLineBuilder.AppendArrayIfNotNull("-I", this.IncludeSearchPaths);
236 // commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
237 // commandLineBuilder.AppendSwitchIfNotNull("-arch ", this.InstallerPlatform);
238 // commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
239 // commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
240
241 // // Support per-source-file output by looking at the SourceFiles items to
242 // // see if there is any "CandleOutput" metadata. If there is, we do our own
243 // // appending, otherwise we fall back to the built-in "append file names" code.
244 // // Note also that the wix.targets "Compile" target does *not* automagically
245 // // fix the "@(CompileObjOutput)" list to include these new output names.
246 // // If you really want to use this, you're going to have to clone the target
247 // // in your own .targets file and create the output list yourself.
248 // bool usePerSourceOutput = false;
249 // if (this.SourceFiles != null)
250 // {
251 // foreach (ITaskItem item in this.SourceFiles)
252 // {
253 // if (!String.IsNullOrEmpty(item.GetMetadata("CandleOutput")))
254 // {
255 // usePerSourceOutput = true;
256 // break;
257 // }
258 // }
259 // }
260
261 // if (usePerSourceOutput)
262 // {
263 // string[] newSourceNames = new string[this.SourceFiles.Length];
264 // for (int iSource = 0; iSource < this.SourceFiles.Length; ++iSource)
265 // {
266 // ITaskItem item = this.SourceFiles[iSource];
267 // if (null == item)
268 // {
269 // newSourceNames[iSource] = null;
270 // }
271 // else
272 // {
273 // string output = item.GetMetadata("CandleOutput");
274
275 // if (!String.IsNullOrEmpty(output))
276 // {
277 // newSourceNames[iSource] = String.Concat(item.ItemSpec, ";", output);
278 // }
279 // else
280 // {
281 // newSourceNames[iSource] = item.ItemSpec;
282 // }
283 // }
284 // }
285
286 // commandLineBuilder.AppendFileNamesIfNotNull(newSourceNames, " ");
287 // }
288 // else
289 // {
290 // commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
291 // }
292 //}
293
294 private class MsbuildMessageListener : IMessageListener
295 {
296 public MsbuildMessageListener(TaskLoggingHelper logger, string shortName, string longName)
297 {
298 this.Logger = logger;
299 this.ShortAppName = shortName;
300 this.LongAppName = longName;
301 }
302
303 public string ShortAppName { get; }
304
305 public string LongAppName { get; }
306
307 private TaskLoggingHelper Logger { get; }
308
309 public void Write(Message message)
310 {
311 switch (message.Level)
312 {
313 case MessageLevel.Error:
314 this.Logger.LogError(null, this.ShortAppName + message.Id.ToString(), null, message.SourceLineNumbers?.FileName ?? this.LongAppName, message.SourceLineNumbers?.LineNumber ?? 0, 0, 0, 0, message.ResourceNameOrFormat, message.MessageArgs);
315 break;
316
317 case MessageLevel.Warning:
318 this.Logger.LogWarning(null, this.ShortAppName + message.Id.ToString(), null, message.SourceLineNumbers?.FileName ?? this.LongAppName, message.SourceLineNumbers?.LineNumber ?? 0, 0, 0, 0, message.ResourceNameOrFormat, message.MessageArgs);
319 break;
320
321 default:
322 // TODO: Revisit this because something is going horribly awry. The commented out LogMessage call is crashing saying that the "message" parameter is null. When you look at the call stack, the code
323 // is in the wrong LogMessage override and the "null" subcategory was passed in as the message. Not clear why it is picking the wrong overload.
324 //if (message.Id > 0)
325 //{
326 // this.Logger.LogMessage(null, code, null, message.SourceLineNumber?.FileName, message.SourceLineNumber?.LineNumber ?? 0, 0, 0, 0, MessageImportance.Normal, message.Format, message.FormatData);
327 //}
328 //else
329 //{
330 this.Logger.LogMessage(MessageImportance.Normal, message.ResourceNameOrFormat, message.MessageArgs);
331 //}
332 break;
333 }
334 }
335
336 public void Write(string message)
337 {
338 this.Logger.LogMessage(MessageImportance.Low, message);
339 }
340 }
341 }
342}
diff --git a/src/WixToolset.BuildTasks/FileSearchHelperMethods.cs b/src/WixToolset.BuildTasks/FileSearchHelperMethods.cs
deleted file mode 100644
index 6cc804eb..00000000
--- a/src/WixToolset.BuildTasks/FileSearchHelperMethods.cs
+++ /dev/null
@@ -1,60 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics.CodeAnalysis;
8 using System.IO;
9 using System.Text;
10 using Microsoft.Build.Framework;
11
12 /// <summary>
13 /// Contains helper methods on searching for files
14 /// </summary>
15 public static class FileSearchHelperMethods
16 {
17 /// <summary>
18 /// Searches for the existence of a file in multiple directories.
19 /// Search is satisfied if default file path is valid and exists. If not,
20 /// file name is extracted from default path and combined with each of the directories
21 /// looking to see if it exists. If not found, input default path is returned.
22 /// </summary>
23 /// <param name="directories">Array of directories to look in, without filenames in them</param>
24 /// <param name="defaultFullPath">Default path - to use if not found</param>
25 /// <returns>File path if file found. Empty string if not found</returns>
26 public static string SearchFilePaths(string[] directories, string defaultFullPath)
27 {
28 if (String.IsNullOrEmpty(defaultFullPath))
29 {
30 return String.Empty;
31 }
32
33 if (File.Exists(defaultFullPath))
34 {
35 return defaultFullPath;
36 }
37
38 if (directories == null)
39 {
40 return string.Empty;
41 }
42
43 string fileName = Path.GetFileName(defaultFullPath);
44 foreach (string currentPath in directories)
45 {
46 if (String.IsNullOrEmpty(currentPath) || String.IsNullOrEmpty(currentPath.Trim()))
47 {
48 continue;
49 }
50
51 if (File.Exists(Path.Combine(currentPath, fileName)))
52 {
53 return Path.Combine(currentPath, fileName);
54 }
55 }
56
57 return String.Empty;
58 }
59 }
60}
diff --git a/src/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs b/src/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs
deleted file mode 100644
index 06c8b98a..00000000
--- a/src/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs
+++ /dev/null
@@ -1,146 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics.CodeAnalysis;
8 using System.Globalization;
9 using System.IO;
10 using System.Security.Cryptography;
11 using System.Text;
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14
15 /// <summary>
16 /// This task generates metadata on the for compile output objects.
17 /// </summary>
18 public class GenerateCompileWithObjectPath : Task
19 {
20 /// <summary>
21 /// The list of files to generate outputs for.
22 /// </summary>
23 [Required]
24 public ITaskItem[] Compile
25 {
26 get;
27 set;
28 }
29
30 /// <summary>
31 /// The list of files with ObjectPath metadata.
32 /// </summary>
33 [Output]
34 public ITaskItem[] CompileWithObjectPath
35 {
36 get;
37 private set;
38 }
39
40 /// <summary>
41 /// The folder under which all ObjectPaths should reside.
42 /// </summary>
43 [Required]
44 public string IntermediateOutputPath
45 {
46 get;
47 set;
48 }
49
50 /// <summary>
51 /// Generate an identifier by hashing data from the row.
52 /// </summary>
53 /// <param name="prefix">Three letter or less prefix for generated row identifier.</param>
54 /// <param name="args">Information to hash.</param>
55 /// <returns>The generated identifier.</returns>
56 [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")]
57 public static string GenerateIdentifier(string prefix, params string[] args)
58 {
59 string stringData = String.Join("|", args);
60 byte[] data = Encoding.Unicode.GetBytes(stringData);
61
62 // hash the data
63 byte[] hash;
64
65 using (MD5 md5 = new MD5CryptoServiceProvider())
66 {
67 hash = md5.ComputeHash(data);
68 }
69
70 // build up the identifier
71 StringBuilder identifier = new StringBuilder(35, 35);
72 identifier.Append(prefix);
73
74 // hard coded to 16 as that is the most bytes that can be used to meet the length requirements. SHA1 is 20 bytes.
75 for (int i = 0; i < 16; i++)
76 {
77 identifier.Append(hash[i].ToString("X2", CultureInfo.InvariantCulture.NumberFormat));
78 }
79
80 return identifier.ToString();
81 }
82
83 /// <summary>
84 /// Gets the full path of the directory in which the file is found.
85 /// </summary>
86 /// <param name='file'>The file from which to extract the directory.</param>
87 /// <returns>The generated identifier.</returns>
88 private static string GetDirectory(ITaskItem file)
89 {
90 return file.GetMetadata("RootDir") + file.GetMetadata("Directory");
91 }
92
93 /// <summary>
94 /// Sets the object path to use for the file.
95 /// </summary>
96 /// <param name='file'>The file on which to set the ObjectPath metadata.</param>
97 /// <remarks>
98 /// For the same input path it will return the same ObjectPath. Case is not ignored, however that isn't a problem.
99 /// </remarks>
100 private void SetObjectPath(ITaskItem file)
101 {
102 // If the source file is in the project directory or in the intermediate directory, use the intermediate directory.
103 if (string.IsNullOrEmpty(file.GetMetadata("RelativeDir")) || string.Compare(file.GetMetadata("RelativeDir"), this.IntermediateOutputPath, StringComparison.OrdinalIgnoreCase) == 0)
104 {
105 file.SetMetadata("ObjectPath", this.IntermediateOutputPath);
106 }
107 // Otherwise use a subdirectory of the intermediate directory. The subfolder's name is based on the full path of the folder containing the source file.
108 else
109 {
110 file.SetMetadata("ObjectPath", Path.Combine(this.IntermediateOutputPath, GenerateIdentifier("pth", GetDirectory(file))) + Path.DirectorySeparatorChar);
111 }
112 }
113
114 /// <summary>
115 /// Gets a complete list of external cabs referenced by the given installer database file.
116 /// </summary>
117 /// <returns>True upon completion of the task execution.</returns>
118 public override bool Execute()
119 {
120 if (string.IsNullOrEmpty(this.IntermediateOutputPath))
121 {
122 this.Log.LogError("IntermediateOutputPath parameter is required and cannot be empty");
123 return false;
124 }
125
126 if (this.Compile == null || this.Compile.Length == 0)
127 {
128 return true;
129 }
130
131 this.CompileWithObjectPath = new ITaskItem[this.Compile.Length];
132 for (int i = 0; i < this.Compile.Length; ++i)
133 {
134 this.CompileWithObjectPath[i] = new TaskItem(this.Compile[i].ItemSpec, this.Compile[i].CloneCustomMetadata());
135
136 // Do not overwrite the ObjectPath metadata if it already was set.
137 if (string.IsNullOrEmpty(this.CompileWithObjectPath[i].GetMetadata("ObjectPath")))
138 {
139 SetObjectPath(this.CompileWithObjectPath[i]);
140 }
141 }
142
143 return true;
144 }
145 }
146}
diff --git a/src/WixToolset.BuildTasks/GetCabList.cs b/src/WixToolset.BuildTasks/GetCabList.cs
deleted file mode 100644
index e97538af..00000000
--- a/src/WixToolset.BuildTasks/GetCabList.cs
+++ /dev/null
@@ -1,87 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Collections.Generic;
8 using System.Diagnostics;
9 using System.IO;
10 using System.Reflection;
11 using System.Xml;
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14 using WixToolset.Dtf.WindowsInstaller;
15 using Microsoft.Win32;
16
17 /// <summary>
18 /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
19 /// WixLocalization element inside the file.
20 /// </summary>
21 public class GetCabList : Task
22 {
23 private ITaskItem database;
24 private ITaskItem[] cabList;
25
26 /// <summary>
27 /// The list of database files to find cabs in
28 /// </summary>
29 [Required]
30 public ITaskItem Database
31 {
32 get { return this.database; }
33 set { this.database = value; }
34 }
35
36 /// <summary>
37 /// The total list of cabs in this database
38 /// </summary>
39 [Output]
40 public ITaskItem[] CabList
41 {
42 get { return this.cabList; }
43 }
44
45 /// <summary>
46 /// Gets a complete list of external cabs referenced by the given installer database file.
47 /// </summary>
48 /// <returns>True upon completion of the task execution.</returns>
49 public override bool Execute()
50 {
51 string databaseFile = this.database.ItemSpec;
52 Object []args = { };
53 System.Collections.Generic.List<ITaskItem> cabNames = new System.Collections.Generic.List<ITaskItem>();
54
55 // If the file doesn't exist, no cabs to return, so exit now
56 if (!File.Exists(databaseFile))
57 {
58 return true;
59 }
60
61 using (Database database = new Database(databaseFile))
62 {
63 // If the media table doesn't exist, no cabs to return, so exit now
64 if (null == database.Tables["Media"])
65 {
66 return true;
67 }
68
69 System.Collections.IList records = database.ExecuteQuery("SELECT `Cabinet` FROM `Media`", args);
70
71 foreach (string cabName in records)
72 {
73 if (String.IsNullOrEmpty(cabName) || cabName.StartsWith("#", StringComparison.Ordinal))
74 {
75 continue;
76 }
77
78 cabNames.Add(new TaskItem(Path.Combine(Path.GetDirectoryName(databaseFile), cabName)));
79 }
80 }
81
82 this.cabList = cabNames.ToArray();
83
84 return true;
85 }
86 }
87}
diff --git a/src/WixToolset.BuildTasks/GetLooseFileList.cs b/src/WixToolset.BuildTasks/GetLooseFileList.cs
deleted file mode 100644
index bd403426..00000000
--- a/src/WixToolset.BuildTasks/GetLooseFileList.cs
+++ /dev/null
@@ -1,230 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Collections.Generic;
8 using System.Diagnostics;
9 using System.IO;
10 using System.Reflection;
11 using System.Xml;
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14 using WixToolset.Dtf.WindowsInstaller;
15 using Microsoft.Win32;
16
17 /// <summary>
18 /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
19 /// WixLocalization element inside the file.
20 /// </summary>
21 public class GetLooseFileList : Task
22 {
23 private ITaskItem database;
24 private ITaskItem[] looseFileList;
25
26 internal const int MsidbFileAttributesNoncompressed = 8192;
27 internal const int MsidbFileAttributesCompressed = 16384;
28
29 /// <summary>
30 /// The list of database files to find Loose Files in
31 /// </summary>
32 [Required]
33 public ITaskItem Database
34 {
35 get { return this.database; }
36 set { this.database = value; }
37 }
38
39 /// <summary>
40 /// The total list of Loose Files in this database
41 /// </summary>
42 [Output]
43 public ITaskItem[] LooseFileList
44 {
45 get { return this.looseFileList; }
46 }
47
48 /// <summary>
49 /// Takes the "defaultDir" column
50 /// </summary>
51 /// <returns>Returns the corresponding sourceDir.</returns>
52 public string SourceDirFromDefaultDir(string defaultDir)
53 {
54 string sourceDir;
55
56 string[] splitted = defaultDir.Split(':');
57
58 if (1 == splitted.Length)
59 {
60 sourceDir = splitted[0];
61 }
62 else
63 {
64 sourceDir = splitted[1];
65 }
66
67 splitted = sourceDir.Split('|');
68
69 if (1 == splitted.Length)
70 {
71 sourceDir = splitted[0];
72 }
73 else
74 {
75 sourceDir = splitted[1];
76 }
77
78 return sourceDir;
79 }
80
81 /// <summary>
82 /// Takes the "FileName" column
83 /// </summary>
84 /// <returns>Returns the corresponding source file name.</returns>
85 public string SourceFileFromFileName(string fileName)
86 {
87 string sourceFile;
88
89 string[] splitted = fileName.Split('|');
90
91 if (1 == splitted.Length)
92 {
93 sourceFile = splitted[0];
94 }
95 else
96 {
97 sourceFile = splitted[1];
98 }
99
100 return sourceFile;
101 }
102
103 /// <summary>
104 /// Gets a complete list of external Loose Files referenced by the given installer database file.
105 /// </summary>
106 /// <returns>True upon completion of the task execution.</returns>
107 public override bool Execute()
108 {
109 string databaseFile = this.database.ItemSpec;
110 Object []emptyArgs = { };
111 System.Collections.Generic.List<ITaskItem> looseFileNames = new System.Collections.Generic.List<ITaskItem>();
112 Dictionary<string, string> ComponentFullDirectory = new Dictionary<string, string>();
113 Dictionary<string, string> DirectoryIdDefaultDir = new Dictionary<string, string>();
114 Dictionary<string, string> DirectoryIdParent = new Dictionary<string, string>();
115 Dictionary<string, string> DirectoryIdFullSource = new Dictionary<string, string>();
116 int i;
117 string databaseDir = Path.GetDirectoryName(databaseFile);
118
119 // If the file doesn't exist, no Loose Files to return, so exit now
120 if (!File.Exists(databaseFile))
121 {
122 return true;
123 }
124
125 using (Database database = new Database(databaseFile))
126 {
127 bool compressed = false;
128 if (2 == (database.SummaryInfo.WordCount & 2))
129 {
130 compressed = true;
131 }
132
133 // If the media table doesn't exist, no Loose Files to return, so exit now
134 if (null == database.Tables["File"])
135 {
136 return true;
137 }
138
139 // Only setup all these helpful indexes if the database is marked as uncompressed. If it's marked as compressed, files are stored at the root,
140 // so none of these indexes will be used
141 if (!compressed)
142 {
143 if (null == database.Tables["Directory"] || null == database.Tables["Component"])
144 {
145 return true;
146 }
147
148 System.Collections.IList directoryRecords = database.ExecuteQuery("SELECT `Directory`,`Directory_Parent`,`DefaultDir` FROM `Directory`", emptyArgs);
149
150 // First setup a simple index from DirectoryId to DefaultDir
151 for (i = 0; i < directoryRecords.Count; i += 3)
152 {
153 string directoryId = (string)(directoryRecords[i]);
154 string directoryParent = (string)(directoryRecords[i + 1]);
155 string defaultDir = (string)(directoryRecords[i + 2]);
156
157 string sourceDir = SourceDirFromDefaultDir(defaultDir);
158
159 DirectoryIdDefaultDir[directoryId] = sourceDir;
160 DirectoryIdParent[directoryId] = directoryParent;
161 }
162
163 // Setup an index from directory Id to the full source path
164 for (i = 0; i < directoryRecords.Count; i += 3)
165 {
166 string directoryId = (string)(directoryRecords[i]);
167 string directoryParent = (string)(directoryRecords[i + 1]);
168 string defaultDir = (string)(directoryRecords[i + 2]);
169
170 string sourceDir = DirectoryIdDefaultDir[directoryId];
171
172 // The TARGETDIR case
173 if (String.IsNullOrEmpty(directoryParent))
174 {
175 DirectoryIdFullSource[directoryId] = databaseDir;
176 }
177 else
178 {
179 string tempDirectoryParent = directoryParent;
180
181 while (!String.IsNullOrEmpty(tempDirectoryParent) && !String.IsNullOrEmpty(DirectoryIdParent[tempDirectoryParent]))
182 {
183 sourceDir = Path.Combine(DirectoryIdDefaultDir[tempDirectoryParent], sourceDir);
184
185 tempDirectoryParent = DirectoryIdParent[tempDirectoryParent];
186 }
187
188 DirectoryIdFullSource[directoryId] = Path.Combine(databaseDir, sourceDir);
189 }
190 }
191
192 // Setup an index from component Id to full directory path
193 System.Collections.IList componentRecords = database.ExecuteQuery("SELECT `Component`,`Directory_` FROM `Component`", emptyArgs);
194
195 for (i = 0; i < componentRecords.Count; i += 2)
196 {
197 string componentId = (string)(componentRecords[i]);
198 string componentDir = (string)(componentRecords[i + 1]);
199
200 ComponentFullDirectory[componentId] = DirectoryIdFullSource[componentDir];
201 }
202 }
203
204 System.Collections.IList fileRecords = database.ExecuteQuery("SELECT `Component_`,`FileName`,`Attributes` FROM `File`", emptyArgs);
205
206 for (i = 0; i < fileRecords.Count; i += 3)
207 {
208 string componentId = (string)(fileRecords[i]);
209 string fileName = SourceFileFromFileName((string)(fileRecords[i + 1]));
210 int attributes = (int)(fileRecords[i + 2]);
211
212 // If the whole database is marked uncompressed, use the directory layout made above
213 if ((!compressed && MsidbFileAttributesCompressed != (attributes & MsidbFileAttributesCompressed)))
214 {
215 looseFileNames.Add(new TaskItem(Path.GetFullPath(Path.Combine(ComponentFullDirectory[componentId], fileName))));
216 }
217 // If the database is marked as compressed, put files at the root
218 else if (compressed && (MsidbFileAttributesNoncompressed == (attributes & MsidbFileAttributesNoncompressed)))
219 {
220 looseFileNames.Add(new TaskItem(Path.GetFullPath(Path.Combine(databaseDir, fileName))));
221 }
222 }
223 }
224
225 this.looseFileList = looseFileNames.ToArray();
226
227 return true;
228 }
229 }
230}
diff --git a/src/WixToolset.BuildTasks/GlobalSuppressions.cs b/src/WixToolset.BuildTasks/GlobalSuppressions.cs
deleted file mode 100644
index 65c34c13..00000000
--- a/src/WixToolset.BuildTasks/GlobalSuppressions.cs
+++ /dev/null
@@ -1,8 +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
3[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "WixToolset")]
4
5[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Msi", Scope = "namespace", Target = "WixToolset.BuildTasks")]
6[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "wix")]
7[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Wix")]
8[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "wix")]
diff --git a/src/WixToolset.BuildTasks/Insignia.cs b/src/WixToolset.BuildTasks/Insignia.cs
deleted file mode 100644
index ba30963a..00000000
--- a/src/WixToolset.BuildTasks/Insignia.cs
+++ /dev/null
@@ -1,118 +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.BuildTasks
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;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// An MSBuild task to run the WiX transform generator.
16 /// </summary>
17 public sealed class Insignia : WixToolTask
18 {
19 private const string InsigniaToolName = "insignia.exe";
20
21 /// <summary>
22 /// Gets or sets the path to the database to inscribe.
23 /// </summary>
24 public ITaskItem DatabaseFile { get; set; }
25
26 /// <summary>
27 /// Gets or sets the path to the bundle to inscribe.
28 /// </summary>
29 public ITaskItem BundleFile { get; set; }
30
31 /// <summary>
32 /// Gets or sets the path to the original bundle that contains the attached container.
33 /// </summary>
34 public ITaskItem OriginalBundleFile { get; set; }
35
36 /// <summary>
37 /// Gets or sets the path to output the inscribed result.
38 /// </summary>
39 [Required]
40 public ITaskItem OutputFile { get; set; }
41
42 /// <summary>
43 /// Gets or sets the output. Only set if insignia does work.
44 /// </summary>
45 [Output]
46 public ITaskItem Output { get; set; }
47
48 /// <summary>
49 /// Get the name of the executable.
50 /// </summary>
51 /// <remarks>The ToolName is used with the ToolPath to get the location of Insignia.exe.</remarks>
52 /// <value>The name of the executable.</value>
53 protected override string ToolName
54 {
55 get { return InsigniaToolName; }
56 }
57
58 /// <summary>
59 /// Get the path to the executable.
60 /// </summary>
61 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
62 /// <returns>The full path to the executable or simply Insignia.exe if it's expected to be in the system path.</returns>
63 protected override string GenerateFullPathToTool()
64 {
65 // If there's not a ToolPath specified, it has to be in the system path.
66 if (String.IsNullOrEmpty(this.ToolPath))
67 {
68 return InsigniaToolName;
69 }
70
71 return Path.Combine(Path.GetFullPath(this.ToolPath), InsigniaToolName);
72 }
73
74 /// <summary>
75 /// Builds a command line from options in this task.
76 /// </summary>
77 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
78 {
79 base.BuildCommandLine(commandLineBuilder);
80
81 commandLineBuilder.AppendSwitchIfNotNull("-im ", this.DatabaseFile);
82 if (null != this.OriginalBundleFile)
83 {
84 commandLineBuilder.AppendSwitchIfNotNull("-ab ", this.BundleFile);
85 commandLineBuilder.AppendFileNameIfNotNull(this.OriginalBundleFile);
86 }
87 else
88 {
89 commandLineBuilder.AppendSwitchIfNotNull("-ib ", this.BundleFile);
90 }
91
92 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
93 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
94 }
95
96 /// <summary>
97 /// Executes a tool in-process by loading the tool assembly and invoking its entrypoint.
98 /// </summary>
99 /// <param name="pathToTool">Path to the tool to be executed; must be a managed executable.</param>
100 /// <param name="responseFileCommands">Commands to be written to a response file.</param>
101 /// <param name="commandLineCommands">Commands to be passed directly on the command-line.</param>
102 /// <returns>The tool exit code.</returns>
103 protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
104 {
105 int returnCode = base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
106 if (0 == returnCode) // successfully did work.
107 {
108 this.Output = this.OutputFile;
109 }
110 else if (-1 == returnCode) // no work done.
111 {
112 returnCode = 0;
113 }
114
115 return returnCode;
116 }
117 }
118}
diff --git a/src/WixToolset.BuildTasks/Light.cs b/src/WixToolset.BuildTasks/Light.cs
deleted file mode 100644
index b7d0b4f7..00000000
--- a/src/WixToolset.BuildTasks/Light.cs
+++ /dev/null
@@ -1,488 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.Diagnostics.CodeAnalysis;
9 using System.Globalization;
10 using System.IO;
11 using System.Text;
12
13 using Microsoft.Build.Framework;
14 using Microsoft.Build.Utilities;
15
16 /// <summary>
17 /// An MSBuild task to run the WiX linker.
18 /// </summary>
19 public sealed class Light : WixToolTask
20 {
21 private const string LightToolName = "Light.exe";
22
23 private string additionalCub;
24 private bool allowIdenticalRows;
25 private bool allowUnresolvedReferences;
26 private string[] baseInputPaths;
27 private ITaskItem[] bindInputPaths;
28 private bool backwardsCompatibleGuidGeneration;
29 private bool bindFiles;
30 private ITaskItem builtOutputsFile;
31 private string cabinetCachePath;
32 private int cabinetCreationThreadCount = WixCommandLineBuilder.Unspecified;
33 private ITaskItem contentsFile;
34 private string cultures;
35 private string customBinder;
36 private string defaultCompressionLevel;
37 private ITaskItem[] extensions;
38 private string[] ices;
39 private bool leaveTemporaryFiles;
40 private ITaskItem[] localizationFiles;
41 private ITaskItem[] objectFiles;
42 private bool outputAsXml;
43 private ITaskItem outputsFile;
44 private ITaskItem outputFile;
45 private ITaskItem pdbOutputFile;
46 private ITaskItem wixProjectFile;
47 private bool pedantic;
48 private bool reuseCabinetCache;
49 private bool suppressAclReset;
50 private bool suppressAssemblies;
51 private bool suppressDefaultAdminSequenceActions;
52 private bool suppressDefaultAdvSequenceActions;
53 private bool suppressDefaultUISequenceActions;
54 private bool dropUnrealTables;
55 private bool exactAssemblyVersions;
56 private bool suppressFileHashAndInfo;
57 private bool suppressFiles;
58 private bool suppressIntermediateFileVersionMatching;
59 private string[] suppressIces;
60 private bool suppressLayout;
61 private bool suppressLocalization;
62 private bool suppressMsiAssemblyTableProcessing;
63 private bool suppressPdbOutput;
64 private bool suppressSchemaValidation;
65 private bool suppressValidation;
66 private bool suppressTagSectionIdAttributeOnTuples;
67 private ITaskItem unreferencedSymbolsFile;
68 private string[] wixVariables;
69 private string extensionDirectory;
70 private string[] referencePaths;
71
72 /// <summary>
73 /// Creates a new light task.
74 /// </summary>
75 /// <remarks>
76 /// Defaults to running the task as a separate process, instead of in-proc
77 /// which is the default for WixToolTasks. This allows the Win32 manifest file
78 /// embedded in light.exe to enable reg-free COM interop with mergemod.dll.
79 /// </remarks>
80 public Light()
81 {
82 }
83
84 public string AdditionalCub
85 {
86 get { return this.additionalCub; }
87 set { this.additionalCub = value; }
88 }
89
90 public bool AllowIdenticalRows
91 {
92 get { return this.allowIdenticalRows; }
93 set { this.allowIdenticalRows = value; }
94 }
95
96 public bool AllowUnresolvedReferences
97 {
98 get { return this.allowUnresolvedReferences; }
99 set { this.allowUnresolvedReferences = value; }
100 }
101
102 // TODO: remove this property entirely in v4.0
103 [Obsolete("Use BindInputPaths instead of BaseInputPaths.")]
104 public string[] BaseInputPaths
105 {
106 get { return this.baseInputPaths; }
107 set { this.baseInputPaths = value; }
108 }
109
110 public ITaskItem[] BindInputPaths
111 {
112 get { return this.bindInputPaths; }
113 set { this.bindInputPaths = value; }
114 }
115
116 public bool BackwardsCompatibleGuidGeneration
117 {
118 get { return this.backwardsCompatibleGuidGeneration; }
119 set { this.backwardsCompatibleGuidGeneration = value; }
120 }
121
122 public bool BindFiles
123 {
124 get { return this.bindFiles; }
125 set { this.bindFiles = value; }
126 }
127
128 public string CabinetCachePath
129 {
130 get { return this.cabinetCachePath; }
131 set { this.cabinetCachePath = value; }
132 }
133
134 public int CabinetCreationThreadCount
135 {
136 get { return this.cabinetCreationThreadCount; }
137 set { this.cabinetCreationThreadCount = value; }
138 }
139
140 public ITaskItem BindBuiltOutputsFile
141 {
142 get { return this.builtOutputsFile; }
143 set { this.builtOutputsFile = value; }
144 }
145
146 public ITaskItem BindContentsFile
147 {
148 get { return this.contentsFile; }
149 set { this.contentsFile = value; }
150 }
151
152 public ITaskItem BindOutputsFile
153 {
154 get { return this.outputsFile; }
155 set { this.outputsFile = value; }
156 }
157
158 public string Cultures
159 {
160 get { return this.cultures; }
161 set { this.cultures = value; }
162 }
163
164 public string CustomBinder
165 {
166 get { return this.customBinder; }
167 set { this.customBinder = value; }
168 }
169
170 public string DefaultCompressionLevel
171 {
172 get { return this.defaultCompressionLevel; }
173 set { this.defaultCompressionLevel = value; }
174 }
175
176 public bool DropUnrealTables
177 {
178 get { return this.dropUnrealTables; }
179 set { this.dropUnrealTables = value; }
180 }
181
182 public bool ExactAssemblyVersions
183 {
184 get { return this.exactAssemblyVersions; }
185 set { this.exactAssemblyVersions = value; }
186 }
187
188 public ITaskItem[] Extensions
189 {
190 get { return this.extensions; }
191 set { this.extensions = value; }
192 }
193
194 public string[] Ices
195 {
196 get { return this.ices; }
197 set { this.ices = value; }
198 }
199
200 public bool LeaveTemporaryFiles
201 {
202 get { return this.leaveTemporaryFiles; }
203 set { this.leaveTemporaryFiles = value; }
204 }
205
206 public ITaskItem[] LocalizationFiles
207 {
208 get { return this.localizationFiles; }
209 set { this.localizationFiles = value; }
210 }
211
212 [Required]
213 public ITaskItem[] ObjectFiles
214 {
215 get { return this.objectFiles; }
216 set { this.objectFiles = value; }
217 }
218
219 public bool OutputAsXml
220 {
221 get { return this.outputAsXml; }
222 set { this.outputAsXml = value; }
223 }
224
225 [Required]
226 [Output]
227 public ITaskItem OutputFile
228 {
229 get { return this.outputFile; }
230 set { this.outputFile = value; }
231 }
232
233 [Output]
234 public ITaskItem PdbOutputFile
235 {
236 get { return this.pdbOutputFile; }
237 set { this.pdbOutputFile = value; }
238 }
239
240 public bool Pedantic
241 {
242 get { return this.pedantic; }
243 set { this.pedantic = value; }
244 }
245
246 public bool ReuseCabinetCache
247 {
248 get { return this.reuseCabinetCache; }
249 set { this.reuseCabinetCache = value; }
250 }
251
252 public bool SuppressAclReset
253 {
254 get { return this.suppressAclReset; }
255 set { this.suppressAclReset = value; }
256 }
257
258 public bool SuppressAssemblies
259 {
260 get { return this.suppressAssemblies; }
261 set { this.suppressAssemblies = value; }
262 }
263
264 public bool SuppressDefaultAdminSequenceActions
265 {
266 get { return this.suppressDefaultAdminSequenceActions; }
267 set { this.suppressDefaultAdminSequenceActions = value; }
268 }
269
270 public bool SuppressDefaultAdvSequenceActions
271 {
272 get { return this.suppressDefaultAdvSequenceActions; }
273 set { this.suppressDefaultAdvSequenceActions = value; }
274 }
275
276 public bool SuppressDefaultUISequenceActions
277 {
278 get { return this.suppressDefaultUISequenceActions; }
279 set { this.suppressDefaultUISequenceActions = value; }
280 }
281
282 public bool SuppressFileHashAndInfo
283 {
284 get { return this.suppressFileHashAndInfo; }
285 set { this.suppressFileHashAndInfo = value; }
286 }
287
288 public bool SuppressFiles
289 {
290 get { return this.suppressFiles; }
291 set { this.suppressFiles = value; }
292 }
293
294 public bool SuppressIntermediateFileVersionMatching
295 {
296 get { return this.suppressIntermediateFileVersionMatching; }
297 set { this.suppressIntermediateFileVersionMatching = value; }
298 }
299
300 public string[] SuppressIces
301 {
302 get { return this.suppressIces; }
303 set { this.suppressIces = value; }
304 }
305
306 public bool SuppressLayout
307 {
308 get { return this.suppressLayout; }
309 set { this.suppressLayout = value; }
310 }
311
312 public bool SuppressLocalization
313 {
314 get { return this.suppressLocalization; }
315 set { this.suppressLocalization = value; }
316 }
317
318 [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
319 public bool SuppressMsiAssemblyTableProcessing
320 {
321 get { return this.suppressMsiAssemblyTableProcessing; }
322 set { this.suppressMsiAssemblyTableProcessing = value; }
323 }
324
325 public bool SuppressPdbOutput
326 {
327 get { return this.suppressPdbOutput; }
328 set { this.suppressPdbOutput = value; }
329 }
330
331 public bool SuppressSchemaValidation
332 {
333 get { return this.suppressSchemaValidation; }
334 set { this.suppressSchemaValidation = value; }
335 }
336
337 public bool SuppressValidation
338 {
339 get { return this.suppressValidation; }
340 set { this.suppressValidation = value; }
341 }
342
343 public bool SuppressTagSectionIdAttributeOnTuples
344 {
345 get { return this.suppressTagSectionIdAttributeOnTuples; }
346 set { this.suppressTagSectionIdAttributeOnTuples = value; }
347 }
348
349 [Output]
350 public ITaskItem UnreferencedSymbolsFile
351 {
352 get { return this.unreferencedSymbolsFile; }
353 set { this.unreferencedSymbolsFile = value; }
354 }
355
356 [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
357 public ITaskItem WixProjectFile
358 {
359 get { return this.wixProjectFile; }
360 set { this.wixProjectFile = value; }
361 }
362
363 [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
364 public string[] WixVariables
365 {
366 get { return this.wixVariables; }
367 set { this.wixVariables = value; }
368 }
369
370 public string ExtensionDirectory
371 {
372 get { return this.extensionDirectory; }
373 set { this.extensionDirectory = value; }
374 }
375
376 public string[] ReferencePaths
377 {
378 get { return this.referencePaths; }
379 set { this.referencePaths = value; }
380 }
381
382 /// <summary>
383 /// Get the name of the executable.
384 /// </summary>
385 /// <remarks>The ToolName is used with the ToolPath to get the location of light.exe.</remarks>
386 /// <value>The name of the executable.</value>
387 protected override string ToolName
388 {
389 get { return LightToolName; }
390 }
391
392 /// <summary>
393 /// Get the path to the executable.
394 /// </summary>
395 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
396 /// <returns>The full path to the executable or simply light.exe if it's expected to be in the system path.</returns>
397 protected override string GenerateFullPathToTool()
398 {
399 // If there's not a ToolPath specified, it has to be in the system path.
400 if (String.IsNullOrEmpty(this.ToolPath))
401 {
402 return LightToolName;
403 }
404
405 return Path.Combine(Path.GetFullPath(this.ToolPath), LightToolName);
406 }
407
408 /// <summary>
409 /// Builds a command line from options in this task.
410 /// </summary>
411 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
412 {
413 // Always put the output first so it is easy to find in the log.
414 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
415 commandLineBuilder.AppendSwitchIfNotNull("-pdbout ", this.PdbOutputFile);
416
417 base.BuildCommandLine(commandLineBuilder);
418
419 commandLineBuilder.AppendIfTrue("-ai", this.AllowIdenticalRows);
420 commandLineBuilder.AppendIfTrue("-au", this.AllowUnresolvedReferences);
421 commandLineBuilder.AppendArrayIfNotNull("-b ", this.baseInputPaths);
422
423 if (null != this.BindInputPaths)
424 {
425 Queue<String> formattedBindInputPaths = new Queue<String>();
426 foreach (ITaskItem item in this.BindInputPaths)
427 {
428 String formattedPath = string.Empty;
429 String bindName = item.GetMetadata("BindName");
430 if (!String.IsNullOrEmpty(bindName))
431 {
432 formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath"));
433 }
434 else
435 {
436 formattedPath = item.GetMetadata("FullPath");
437 }
438 formattedBindInputPaths.Enqueue(formattedPath);
439 }
440 commandLineBuilder.AppendArrayIfNotNull("-b ", formattedBindInputPaths.ToArray());
441 }
442
443 commandLineBuilder.AppendIfTrue("-bcgg", this.BackwardsCompatibleGuidGeneration);
444 commandLineBuilder.AppendIfTrue("-bf", this.BindFiles);
445 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
446 commandLineBuilder.AppendIfSpecified("-ct ", this.CabinetCreationThreadCount);
447 commandLineBuilder.AppendSwitchIfNotNull("-cub ", this.AdditionalCub);
448 commandLineBuilder.AppendSwitchIfNotNull("-cultures:", this.Cultures);
449 commandLineBuilder.AppendSwitchIfNotNull("-binder ", this.CustomBinder);
450 commandLineBuilder.AppendArrayIfNotNull("-d", this.WixVariables);
451 commandLineBuilder.AppendSwitchIfNotNull("-dcl:", this.DefaultCompressionLevel);
452 commandLineBuilder.AppendIfTrue("-dut", this.DropUnrealTables);
453 commandLineBuilder.AppendIfTrue("-eav", this.ExactAssemblyVersions);
454 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
455 commandLineBuilder.AppendArrayIfNotNull("-ice:", this.Ices);
456 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
457 commandLineBuilder.AppendIfTrue("-notidy", this.LeaveTemporaryFiles);
458 commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
459 commandLineBuilder.AppendIfTrue("-reusecab", this.ReuseCabinetCache);
460 commandLineBuilder.AppendIfTrue("-sa", this.SuppressAssemblies);
461 commandLineBuilder.AppendIfTrue("-sacl", this.SuppressAclReset);
462 commandLineBuilder.AppendIfTrue("-sadmin", this.SuppressDefaultAdminSequenceActions);
463 commandLineBuilder.AppendIfTrue("-sadv", this.SuppressDefaultAdvSequenceActions);
464 commandLineBuilder.AppendArrayIfNotNull("-sice:", this.SuppressIces);
465 commandLineBuilder.AppendIfTrue("-sma", this.SuppressMsiAssemblyTableProcessing);
466 commandLineBuilder.AppendIfTrue("-sf", this.SuppressFiles);
467 commandLineBuilder.AppendIfTrue("-sh", this.SuppressFileHashAndInfo);
468 commandLineBuilder.AppendIfTrue("-sl", this.SuppressLayout);
469 commandLineBuilder.AppendIfTrue("-sloc", this.SuppressLocalization);
470 commandLineBuilder.AppendIfTrue("-spdb", this.SuppressPdbOutput);
471 commandLineBuilder.AppendIfTrue("-ss", this.SuppressSchemaValidation);
472 commandLineBuilder.AppendIfTrue("-sts", this.SuppressTagSectionIdAttributeOnTuples);
473 commandLineBuilder.AppendIfTrue("-sui", this.SuppressDefaultUISequenceActions);
474 commandLineBuilder.AppendIfTrue("-sv", this.SuppressIntermediateFileVersionMatching);
475 commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation);
476 commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile);
477 commandLineBuilder.AppendIfTrue("-xo", this.OutputAsXml);
478 commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile);
479 commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile);
480 commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile);
481 commandLineBuilder.AppendSwitchIfNotNull("-wixprojectfile ", this.WixProjectFile);
482 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
483
484 List<string> objectFilePaths = AdjustFilePaths(this.objectFiles, this.ReferencePaths);
485 commandLineBuilder.AppendFileNamesIfNotNull(objectFilePaths.ToArray(), " ");
486 }
487 }
488}
diff --git a/src/WixToolset.BuildTasks/Lit.cs b/src/WixToolset.BuildTasks/Lit.cs
deleted file mode 100644
index 1df964ae..00000000
--- a/src/WixToolset.BuildTasks/Lit.cs
+++ /dev/null
@@ -1,178 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.Globalization;
9 using System.IO;
10 using System.Text;
11
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14
15 /// <summary>
16 /// An MSBuild task to run the WiX lib tool.
17 /// </summary>
18 public sealed class Lit : WixToolTask
19 {
20 private const string LitToolName = "lit.exe";
21
22 private string[] baseInputPaths;
23 private ITaskItem[] bindInputPaths;
24 private bool bindFiles;
25 private ITaskItem[] extensions;
26 private ITaskItem[] localizationFiles;
27 private ITaskItem[] objectFiles;
28 private ITaskItem outputFile;
29 private bool pedantic;
30 private bool suppressIntermediateFileVersionMatching;
31 private bool suppressSchemaValidation;
32 private string extensionDirectory;
33 private string[] referencePaths;
34
35 // TODO: remove this property entirely in v4.0
36 [Obsolete("Use BindInputPaths instead of BaseInputPaths.")]
37 public string[] BaseInputPaths
38 {
39 get { return this.baseInputPaths; }
40 set { this.baseInputPaths = value; }
41 }
42
43 public ITaskItem[] BindInputPaths
44 {
45 get { return this.bindInputPaths; }
46 set { this.bindInputPaths = value; }
47 }
48
49 public bool BindFiles
50 {
51 get { return this.bindFiles; }
52 set { this.bindFiles = value; }
53 }
54
55 public ITaskItem[] Extensions
56 {
57 get { return this.extensions; }
58 set { this.extensions = value; }
59 }
60
61 public ITaskItem[] LocalizationFiles
62 {
63 get { return this.localizationFiles; }
64 set { this.localizationFiles = value; }
65 }
66
67 [Required]
68 public ITaskItem[] ObjectFiles
69 {
70 get { return this.objectFiles; }
71 set { this.objectFiles = value; }
72 }
73
74 [Required]
75 [Output]
76 public ITaskItem OutputFile
77 {
78 get { return this.outputFile; }
79 set { this.outputFile = value; }
80 }
81
82 public bool Pedantic
83 {
84 get { return this.pedantic; }
85 set { this.pedantic = value; }
86 }
87
88 public bool SuppressIntermediateFileVersionMatching
89 {
90 get { return this.suppressIntermediateFileVersionMatching; }
91 set { this.suppressIntermediateFileVersionMatching = value; }
92 }
93
94 public bool SuppressSchemaValidation
95 {
96 get { return this.suppressSchemaValidation; }
97 set { this.suppressSchemaValidation = value; }
98 }
99
100 public string ExtensionDirectory
101 {
102 get { return this.extensionDirectory; }
103 set { this.extensionDirectory = value; }
104 }
105
106 public string[] ReferencePaths
107 {
108 get { return this.referencePaths; }
109 set { this.referencePaths = value; }
110 }
111
112 /// <summary>
113 /// Get the name of the executable.
114 /// </summary>
115 /// <remarks>The ToolName is used with the ToolPath to get the location of lit.exe</remarks>
116 /// <value>The name of the executable.</value>
117 protected override string ToolName
118 {
119 get { return LitToolName; }
120 }
121
122 /// <summary>
123 /// Get the path to the executable.
124 /// </summary>
125 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
126 /// <returns>The full path to the executable or simply lit.exe if it's expected to be in the system path.</returns>
127 protected override string GenerateFullPathToTool()
128 {
129 // If there's not a ToolPath specified, it has to be in the system path.
130 if (String.IsNullOrEmpty(this.ToolPath))
131 {
132 return LitToolName;
133 }
134
135 return Path.Combine(Path.GetFullPath(this.ToolPath), LitToolName);
136 }
137
138 /// <summary>
139 /// Builds a command line from options in this task.
140 /// </summary>
141 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
142 {
143 base.BuildCommandLine(commandLineBuilder);
144
145 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
146 commandLineBuilder.AppendArrayIfNotNull("-b ", this.baseInputPaths);
147 if (null != this.BindInputPaths)
148 {
149 Queue<String> formattedBindInputPaths = new Queue<String>();
150 foreach (ITaskItem item in this.BindInputPaths)
151 {
152 String formattedPath = string.Empty;
153 String bindName = item.GetMetadata("BindName");
154 if (!String.IsNullOrEmpty(item.GetMetadata("BindName")))
155 {
156 formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath"));
157 }
158 else
159 {
160 formattedPath = item.GetMetadata("FullPath");
161 }
162 formattedBindInputPaths.Enqueue(formattedPath);
163 }
164 commandLineBuilder.AppendArrayIfNotNull("-b ", formattedBindInputPaths.ToArray());
165 }
166 commandLineBuilder.AppendIfTrue("-bf", this.BindFiles);
167 commandLineBuilder.AppendExtensions(this.extensions, this.ExtensionDirectory, this.referencePaths);
168 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
169 commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
170 commandLineBuilder.AppendIfTrue("-ss", this.SuppressSchemaValidation);
171 commandLineBuilder.AppendIfTrue("-sv", this.SuppressIntermediateFileVersionMatching);
172 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
173
174 List<string> objectFilePaths = AdjustFilePaths(this.objectFiles, this.ReferencePaths);
175 commandLineBuilder.AppendFileNamesIfNotNull(objectFilePaths.ToArray(), " ");
176 }
177 }
178}
diff --git a/src/WixToolset.BuildTasks/Pyro.cs b/src/WixToolset.BuildTasks/Pyro.cs
deleted file mode 100644
index f6b069da..00000000
--- a/src/WixToolset.BuildTasks/Pyro.cs
+++ /dev/null
@@ -1,140 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using Microsoft.Build.Framework;
9
10 /// <summary>
11 /// An MSBuild task to run the WiX patch builder.
12 /// </summary>
13 public sealed class Pyro : WixToolTask
14 {
15 private const string PyroToolName = "pyro.exe";
16
17 public bool BinaryDeltaPatch { get; set; }
18 public string CabinetCachePath { get; set; }
19 public string ExtensionDirectory { get; set; }
20 public ITaskItem[] Extensions { get; set; }
21 public bool LeaveTemporaryFiles { get; set; }
22 public string[] ReferencePaths { get; set; }
23 public bool ReuseCabinetCache { get; set; }
24 public bool SuppressAssemblies { get; set; }
25 public bool SuppressFiles { get; set; }
26 public bool SuppressFileHashAndInfo { get; set; }
27 public bool SuppressPdbOutput { get; set; }
28
29 [Required]
30 public string DefaultBaselineId { get; set; }
31
32 public ITaskItem[] BindInputPathsForTarget { get; set; }
33 public ITaskItem[] BindInputPathsForUpdated { get; set; }
34
35 [Required]
36 public ITaskItem InputFile { get; set; }
37
38 [Required]
39 [Output]
40 public ITaskItem OutputFile { get; set; }
41
42 [Output]
43 public ITaskItem PdbOutputFile { get; set; }
44
45 [Required]
46 public ITaskItem[] Transforms { get; set; }
47
48 /// <summary>
49 /// Get the name of the executable.
50 /// </summary>
51 /// <remarks>The ToolName is used with the ToolPath to get the location of pyro.exe.</remarks>
52 /// <value>The name of the executable.</value>
53 protected override string ToolName
54 {
55 get { return PyroToolName; }
56 }
57
58 /// <summary>
59 /// Get the path to the executable.
60 /// </summary>
61 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
62 /// <returns>The full path to the executable or simply torch.exe if it's expected to be in the system path.</returns>
63 protected override string GenerateFullPathToTool()
64 {
65 // If there's not a ToolPath specified, it has to be in the system path.
66 if (String.IsNullOrEmpty(this.ToolPath))
67 {
68 return PyroToolName;
69 }
70
71 return Path.Combine(Path.GetFullPath(this.ToolPath), PyroToolName);
72 }
73
74 /// <summary>
75 /// Builds a command line for bind-input paths (-bt and -bu switches).
76 /// </summary>
77 private void AppendBindInputPaths(WixCommandLineBuilder commandLineBuilder, IEnumerable<ITaskItem> bindInputPaths, string switchName)
78 {
79 if (null != bindInputPaths)
80 {
81 Queue<String> formattedBindInputPaths = new Queue<String>();
82 foreach (ITaskItem item in bindInputPaths)
83 {
84 String formattedPath = string.Empty;
85 String bindName = item.GetMetadata("BindName");
86 if (!String.IsNullOrEmpty(bindName))
87 {
88 formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath"));
89 }
90 else
91 {
92 formattedPath = item.GetMetadata("FullPath");
93 }
94 formattedBindInputPaths.Enqueue(formattedPath);
95 }
96
97 commandLineBuilder.AppendArrayIfNotNull(switchName, formattedBindInputPaths.ToArray());
98 }
99 }
100
101 /// <summary>
102 /// Builds a command line from options in this task.
103 /// </summary>
104 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
105 {
106 // Always put the output first so it is easy to find in the log.
107 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
108 commandLineBuilder.AppendSwitchIfNotNull("-pdbout ", this.PdbOutputFile);
109
110 base.BuildCommandLine(commandLineBuilder);
111
112 this.AppendBindInputPaths(commandLineBuilder, this.BindInputPathsForTarget, "-bt ");
113 this.AppendBindInputPaths(commandLineBuilder, this.BindInputPathsForUpdated, "-bu ");
114
115 commandLineBuilder.AppendFileNameIfNotNull(this.InputFile);
116 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
117 commandLineBuilder.AppendIfTrue("-delta", this.BinaryDeltaPatch);
118 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
119 commandLineBuilder.AppendIfTrue("-notidy", this.LeaveTemporaryFiles);
120 commandLineBuilder.AppendIfTrue("-reusecab", this.ReuseCabinetCache);
121 commandLineBuilder.AppendIfTrue("-sa", this.SuppressAssemblies);
122 commandLineBuilder.AppendIfTrue("-sf", this.SuppressFiles);
123 commandLineBuilder.AppendIfTrue("-sh", this.SuppressFileHashAndInfo);
124 commandLineBuilder.AppendIfTrue("-spdb", this.SuppressPdbOutput);
125 foreach (ITaskItem transform in this.Transforms)
126 {
127 string transformPath = transform.ItemSpec;
128 string baselineId = transform.GetMetadata("OverrideBaselineId");
129 if (String.IsNullOrEmpty(baselineId))
130 {
131 baselineId = this.DefaultBaselineId;
132 }
133
134 commandLineBuilder.AppendTextIfNotNull(String.Format("-t {0} {1}", baselineId, transformPath));
135 }
136
137 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
138 }
139 }
140}
diff --git a/src/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs b/src/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs
deleted file mode 100644
index 5445e0cd..00000000
--- a/src/WixToolset.BuildTasks/RefreshBundleGeneratedFile.cs
+++ /dev/null
@@ -1,132 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Globalization;
8 using System.IO;
9 using System.Text.RegularExpressions;
10 using System.Xml;
11 using Microsoft.Build.Framework;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// This task refreshes the generated file for bundle projects.
16 /// </summary>
17 public class RefreshBundleGeneratedFile : Task
18 {
19 private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled);
20 private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters
21
22 private ITaskItem[] generatedFiles;
23 private ITaskItem[] projectReferencePaths;
24
25 /// <summary>
26 /// The list of files to generate.
27 /// </summary>
28 [Required]
29 public ITaskItem[] GeneratedFiles
30 {
31 get { return this.generatedFiles; }
32 set { this.generatedFiles = value; }
33 }
34
35 /// <summary>
36 /// All the project references in the project.
37 /// </summary>
38 [Required]
39 public ITaskItem[] ProjectReferencePaths
40 {
41 get { return this.projectReferencePaths; }
42 set { this.projectReferencePaths = value; }
43 }
44
45 /// <summary>
46 /// Gets a complete list of external cabs referenced by the given installer database file.
47 /// </summary>
48 /// <returns>True upon completion of the task execution.</returns>
49 public override bool Execute()
50 {
51 ArrayList payloadGroupRefs = new ArrayList();
52 ArrayList packageGroupRefs = new ArrayList();
53 for (int i = 0; i < this.ProjectReferencePaths.Length; i++)
54 {
55 ITaskItem item = this.ProjectReferencePaths[i];
56
57 if (!String.IsNullOrEmpty(item.GetMetadata(Common.DoNotHarvest)))
58 {
59 continue;
60 }
61
62 string projectPath = CreateProjectReferenceDefineConstants.GetProjectPath(this.ProjectReferencePaths, i);
63 string projectName = Path.GetFileNameWithoutExtension(projectPath);
64 string referenceName = Common.GetIdentifierFromName(CreateProjectReferenceDefineConstants.GetReferenceName(item, projectName));
65
66 string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';');
67 foreach (string pog in pogs)
68 {
69 if (!String.IsNullOrEmpty(pog))
70 {
71 // TODO: Add payload group references and package group references once heat is generating them
72 ////payloadGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
73 packageGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
74 }
75 }
76 }
77
78 XmlDocument doc = new XmlDocument();
79
80 XmlProcessingInstruction head = doc.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
81 doc.AppendChild(head);
82
83 XmlElement rootElement = doc.CreateElement("Wix");
84 rootElement.SetAttribute("xmlns", "http://wixtoolset.org/schemas/v4/wxs");
85 doc.AppendChild(rootElement);
86
87 XmlElement fragment = doc.CreateElement("Fragment");
88 rootElement.AppendChild(fragment);
89
90 XmlElement payloadGroup = doc.CreateElement("PayloadGroup");
91 payloadGroup.SetAttribute("Id", "Bundle.Generated.Payloads");
92 fragment.AppendChild(payloadGroup);
93
94 XmlElement packageGroup = doc.CreateElement("PackageGroup");
95 packageGroup.SetAttribute("Id", "Bundle.Generated.Packages");
96 fragment.AppendChild(packageGroup);
97
98 foreach (string payloadGroupRef in payloadGroupRefs)
99 {
100 XmlElement payloadGroupRefElement = doc.CreateElement("PayloadGroupRef");
101 payloadGroupRefElement.SetAttribute("Id", payloadGroupRef);
102 payloadGroup.AppendChild(payloadGroupRefElement);
103 }
104
105 foreach (string packageGroupRef in packageGroupRefs)
106 {
107 XmlElement packageGroupRefElement = doc.CreateElement("PackageGroupRef");
108 packageGroupRefElement.SetAttribute("Id", packageGroupRef);
109 packageGroup.AppendChild(packageGroupRefElement);
110 }
111
112 foreach (ITaskItem item in this.GeneratedFiles)
113 {
114 string fullPath = item.GetMetadata("FullPath");
115
116 payloadGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath) + ".Payloads");
117 packageGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath) + ".Packages");
118 try
119 {
120 doc.Save(fullPath);
121 }
122 catch (Exception e)
123 {
124 // e.Message will be something like: "Access to the path 'fullPath' is denied."
125 this.Log.LogMessage(MessageImportance.High, "Unable to save generated file to '{0}'. {1}", fullPath, e.Message);
126 }
127 }
128
129 return true;
130 }
131 }
132}
diff --git a/src/WixToolset.BuildTasks/RefreshGeneratedFile.cs b/src/WixToolset.BuildTasks/RefreshGeneratedFile.cs
deleted file mode 100644
index fdfc4774..00000000
--- a/src/WixToolset.BuildTasks/RefreshGeneratedFile.cs
+++ /dev/null
@@ -1,118 +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.BuildTasks
4{
5 using System;
6 using System.Collections;
7 using System.Globalization;
8 using System.IO;
9 using System.Text.RegularExpressions;
10 using System.Xml;
11 using Microsoft.Build.Framework;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// This task refreshes the generated file that contains ComponentGroupRefs
16 /// to harvested output.
17 /// </summary>
18 public class RefreshGeneratedFile : Task
19 {
20 private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled);
21 private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters
22
23 private ITaskItem[] generatedFiles;
24 private ITaskItem[] projectReferencePaths;
25
26 /// <summary>
27 /// The list of files to generate.
28 /// </summary>
29 [Required]
30 public ITaskItem[] GeneratedFiles
31 {
32 get { return this.generatedFiles; }
33 set { this.generatedFiles = value; }
34 }
35
36 /// <summary>
37 /// All the project references in the project.
38 /// </summary>
39 [Required]
40 public ITaskItem[] ProjectReferencePaths
41 {
42 get { return this.projectReferencePaths; }
43 set { this.projectReferencePaths = value; }
44 }
45
46 /// <summary>
47 /// Gets a complete list of external cabs referenced by the given installer database file.
48 /// </summary>
49 /// <returns>True upon completion of the task execution.</returns>
50 public override bool Execute()
51 {
52 ArrayList componentGroupRefs = new ArrayList();
53 for (int i = 0; i < this.ProjectReferencePaths.Length; i++)
54 {
55 ITaskItem item = this.ProjectReferencePaths[i];
56
57 if (!String.IsNullOrEmpty(item.GetMetadata(Common.DoNotHarvest)))
58 {
59 continue;
60 }
61
62 string projectPath = CreateProjectReferenceDefineConstants.GetProjectPath(this.ProjectReferencePaths, i);
63 string projectName = Path.GetFileNameWithoutExtension(projectPath);
64 string referenceName = Common.GetIdentifierFromName(CreateProjectReferenceDefineConstants.GetReferenceName(item, projectName));
65
66 string[] pogs = item.GetMetadata("RefProjectOutputGroups").Split(';');
67 foreach (string pog in pogs)
68 {
69 if (!String.IsNullOrEmpty(pog))
70 {
71 componentGroupRefs.Add(String.Format(CultureInfo.InvariantCulture, "{0}.{1}", referenceName, pog));
72 }
73 }
74 }
75
76 XmlDocument doc = new XmlDocument();
77
78 XmlProcessingInstruction head = doc.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
79 doc.AppendChild(head);
80
81 XmlElement rootElement = doc.CreateElement("Wix");
82 rootElement.SetAttribute("xmlns", "http://wixtoolset.org/schemas/v4/wxs");
83 doc.AppendChild(rootElement);
84
85 XmlElement fragment = doc.CreateElement("Fragment");
86 rootElement.AppendChild(fragment);
87
88 XmlElement componentGroup = doc.CreateElement("ComponentGroup");
89 componentGroup.SetAttribute("Id", "Product.Generated");
90 fragment.AppendChild(componentGroup);
91
92 foreach (string componentGroupRef in componentGroupRefs)
93 {
94 XmlElement componentGroupRefElement = doc.CreateElement("ComponentGroupRef");
95 componentGroupRefElement.SetAttribute("Id", componentGroupRef);
96 componentGroup.AppendChild(componentGroupRefElement);
97 }
98
99 foreach (ITaskItem item in this.GeneratedFiles)
100 {
101 string fullPath = item.GetMetadata("FullPath");
102
103 componentGroup.SetAttribute("Id", Path.GetFileNameWithoutExtension(fullPath));
104 try
105 {
106 doc.Save(fullPath);
107 }
108 catch (Exception e)
109 {
110 // e.Message will be something like: "Access to the path 'fullPath' is denied."
111 this.Log.LogMessage(MessageImportance.High, "Unable to save generated file to '{0}'. {1}", fullPath, e.Message);
112 }
113 }
114
115 return true;
116 }
117 }
118}
diff --git a/src/WixToolset.BuildTasks/ReplaceString.cs b/src/WixToolset.BuildTasks/ReplaceString.cs
deleted file mode 100644
index e5041923..00000000
--- a/src/WixToolset.BuildTasks/ReplaceString.cs
+++ /dev/null
@@ -1,54 +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.BuildTasks
4{
5 using System;
6 using Microsoft.Build.Framework;
7 using Microsoft.Build.Utilities;
8
9 /// <summary>
10 /// Replaces occurances of OldValues with NewValues in String.
11 /// </summary>
12 public class ReplaceString : Task
13 {
14 /// <summary>
15 /// Text to operate on.
16 /// </summary>
17 [Output]
18 [Required]
19 public string Text { get; set; }
20
21 /// <summary>
22 /// List of old values to replace.
23 /// </summary>
24 [Required]
25 public string OldValue { get; set; }
26
27 /// <summary>
28 /// List of new values to replace old values with. If not specified, occurances of OldValue will be removed.
29 /// </summary>
30 public string NewValue { get; set; }
31
32 /// <summary>
33 /// Does the string replacement.
34 /// </summary>
35 /// <returns></returns>
36 public override bool Execute()
37 {
38 if (String.IsNullOrEmpty(this.Text))
39 {
40 return true;
41 }
42
43 if (String.IsNullOrEmpty(this.OldValue))
44 {
45 Log.LogError("OldValue must be specified");
46 return false;
47 }
48
49 this.Text = this.Text.Replace(this.OldValue, this.NewValue);
50
51 return true;
52 }
53 }
54}
diff --git a/src/WixToolset.BuildTasks/ResolveWixReferences.cs b/src/WixToolset.BuildTasks/ResolveWixReferences.cs
deleted file mode 100644
index 9b8cfe6f..00000000
--- a/src/WixToolset.BuildTasks/ResolveWixReferences.cs
+++ /dev/null
@@ -1,212 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using Microsoft.Build.Utilities;
8 using Microsoft.Build.Framework;
9 using System.IO;
10
11 /// <summary>
12 /// This task searches for paths to references using the order specified in SearchPaths.
13 /// </summary>
14 public class ResolveWixReferences : Task
15 {
16 /// <summary>
17 /// Token value used in SearchPaths to indicate that the item's HintPath metadata should
18 /// be searched as a full file path to resolve the reference.
19 /// Must match wix.targets, case sensitive.
20 /// </summary>
21 private const string HintPathToken = "{HintPathFromItem}";
22
23 /// <summary>
24 /// Token value used in SearchPaths to indicate that the item's Identity should
25 /// be searched as a full file path to resolve the reference.
26 /// Must match wix.targets, case sensitive.
27 /// </summary>
28 private const string RawFileNameToken = "{RawFileName}";
29
30 /// <summary>
31 /// The list of references to resolve.
32 /// </summary>
33 [Required]
34 public ITaskItem[] WixReferences
35 {
36 get;
37 set;
38 }
39
40 /// <summary>
41 /// The directories or special locations that are searched to find the files
42 /// on disk that represent the references. The order in which the search paths are listed
43 /// is important. For each reference, the list of paths is searched from left to right.
44 /// When a file that represents the reference is found, that search stops and the search
45 /// for the next reference starts.
46 ///
47 /// This parameter accepts the following types of values:
48 /// A directory path.
49 /// {HintPathFromItem}: Specifies that the task will examine the HintPath metadata
50 /// of the base item.
51 /// TODO : {CandidateAssemblyFiles}: Specifies that the task will examine the files
52 /// passed in through the CandidateAssemblyFiles parameter.
53 /// TODO : {Registry:_AssemblyFoldersBase_, _RuntimeVersion_, _AssemblyFoldersSuffix_}:
54 /// TODO : {AssemblyFolders}: Specifies the task will use the Visual Studio.NET 2003
55 /// finding-assemblies-from-registry scheme.
56 /// TODO : {GAC}: Specifies the task will search in the GAC.
57 /// {RawFileName}: Specifies the task will consider the Include value of the item to be
58 /// an exact path and file name.
59 /// </summary>
60 public string[] SearchPaths
61 {
62 get;
63 set;
64 }
65
66 /// <summary>
67 /// The filename extension(s) to be checked when searching.
68 /// </summary>
69 public string[] SearchFilenameExtensions
70 {
71 get;
72 set;
73 }
74
75 /// <summary>
76 /// Output items that contain the same metadata as input references and have been resolved to full paths.
77 /// </summary>
78 [Output]
79 public ITaskItem[] ResolvedWixReferences
80 {
81 get;
82 private set;
83 }
84
85 /// <summary>
86 /// Resolves reference paths by searching for referenced items using the specified SearchPaths.
87 /// </summary>
88 /// <returns>True on success, or throws an exception on failure.</returns>
89 public override bool Execute()
90 {
91 List<ITaskItem> resolvedReferences = new List<ITaskItem>();
92
93 foreach (ITaskItem reference in this.WixReferences)
94 {
95 ITaskItem resolvedReference = ResolveWixReferences.ResolveReference(reference, this.SearchPaths, this.SearchFilenameExtensions, this.Log);
96
97 this.Log.LogMessage(MessageImportance.Low, "Resolved path {0}", resolvedReference.ItemSpec);
98 resolvedReferences.Add(resolvedReference);
99 }
100
101 this.ResolvedWixReferences = resolvedReferences.ToArray();
102 return true;
103 }
104
105 /// <summary>
106 /// Resolves a single reference item by searcheing for referenced items using the specified SearchPaths.
107 /// This method is made public so the resolution logic can be reused by other tasks.
108 /// </summary>
109 /// <param name="reference">The referenced item.</param>
110 /// <param name="searchPaths">The paths to search.</param>
111 /// <param name="searchFilenameExtensions">Filename extensions to check.</param>
112 /// <param name="log">Logging helper.</param>
113 /// <returns>The resolved reference item, or the original reference if it could not be resolved.</returns>
114 public static ITaskItem ResolveReference(ITaskItem reference, string[] searchPaths, string[] searchFilenameExtensions, TaskLoggingHelper log)
115 {
116 if (reference == null)
117 {
118 throw new ArgumentNullException("reference");
119 }
120
121 if (searchPaths == null)
122 {
123 // Nothing to search, so just return the original reference item.
124 return reference;
125 }
126
127 if (searchFilenameExtensions == null)
128 {
129 searchFilenameExtensions = new string[] { };
130 }
131
132 // Copy all the metadata from the source
133 TaskItem resolvedReference = new TaskItem(reference);
134 log.LogMessage(MessageImportance.Low, "WixReference: {0}", reference.ItemSpec);
135
136 // Now find the resolved path based on our order of precedence
137 foreach (string searchPath in searchPaths)
138 {
139 log.LogMessage(MessageImportance.Low, "Trying {0}", searchPath);
140 if (searchPath.Equals(HintPathToken, StringComparison.Ordinal))
141 {
142 string path = reference.GetMetadata("HintPath");
143 log.LogMessage(MessageImportance.Low, "Trying path {0}", path);
144 if (File.Exists(path))
145 {
146 resolvedReference.ItemSpec = path;
147 break;
148 }
149 }
150 else if (searchPath.Equals(RawFileNameToken, StringComparison.Ordinal))
151 {
152 log.LogMessage(MessageImportance.Low, "Trying path {0}", resolvedReference.ItemSpec);
153 if (File.Exists(resolvedReference.ItemSpec))
154 {
155 break;
156 }
157
158 if (ResolveWixReferences.ResolveFilenameExtensions(resolvedReference,
159 resolvedReference.ItemSpec, searchFilenameExtensions, log))
160 {
161 break;
162 }
163 }
164 else
165 {
166 string path = Path.Combine(searchPath, Path.GetFileName(reference.ItemSpec));
167 log.LogMessage(MessageImportance.Low, "Trying path {0}", path);
168 if (File.Exists(path))
169 {
170 resolvedReference.ItemSpec = path;
171 break;
172 }
173
174 if (ResolveWixReferences.ResolveFilenameExtensions(resolvedReference,
175 path, searchFilenameExtensions, log))
176 {
177 break;
178 }
179 }
180 }
181
182 // Normalize the item path
183 resolvedReference.ItemSpec = resolvedReference.GetMetadata("FullPath");
184
185 return resolvedReference;
186 }
187
188 /// <summary>
189 /// Helper method for checking filename extensions when resolving references.
190 /// </summary>
191 /// <param name="reference">The reference being resolved.</param>
192 /// <param name="basePath">Full filename path without extension.</param>
193 /// <param name="filenameExtensions">Filename extensions to check.</param>
194 /// <param name="log">Logging helper.</param>
195 /// <returns>True if the item was resolved, else false.</returns>
196 private static bool ResolveFilenameExtensions(ITaskItem reference, string basePath, string[] filenameExtensions, TaskLoggingHelper log)
197 {
198 foreach (string filenameExtension in filenameExtensions)
199 {
200 string path = basePath + filenameExtension;
201 log.LogMessage(MessageImportance.Low, "Trying path {0}", path);
202 if (File.Exists(path))
203 {
204 reference.ItemSpec = path;
205 return true;
206 }
207 }
208
209 return false;
210 }
211 }
212}
diff --git a/src/WixToolset.BuildTasks/TaskBase.cs b/src/WixToolset.BuildTasks/TaskBase.cs
deleted file mode 100644
index 3d58fc06..00000000
--- a/src/WixToolset.BuildTasks/TaskBase.cs
+++ /dev/null
@@ -1,65 +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.BuildTasks
4{
5 using Microsoft.Build.Utilities;
6
7 public abstract class TaskBase : Task
8 {
9 public string ToolPath { get; set; }
10
11 public string AdditionalOptions { get; set; }
12
13 public bool RunAsSeparateProcess { get; set; }
14
15 /// <summary>
16 /// Gets or sets whether all warnings should be suppressed.
17 /// </summary>
18 public bool SuppressAllWarnings { get; set; }
19
20 /// <summary>
21 /// Gets or sets a list of specific warnings to be suppressed.
22 /// </summary>
23 public string[] SuppressSpecificWarnings { get; set; }
24
25 /// <summary>
26 /// Gets or sets whether all warnings should be treated as errors.
27 /// </summary>
28 public bool TreatWarningsAsErrors { get; set; }
29
30 /// <summary>
31 /// Gets or sets a list of specific warnings to treat as errors.
32 /// </summary>
33 public string[] TreatSpecificWarningsAsErrors { get; set; }
34
35 /// <summary>
36 /// Gets or sets whether to display verbose output.
37 /// </summary>
38 public bool VerboseOutput { get; set; }
39
40 /// <summary>
41 /// Gets or sets whether to display the logo.
42 /// </summary>
43 public bool NoLogo { get; set; }
44
45 public override bool Execute()
46 {
47 try
48 {
49 this.ExecuteCore();
50 }
51 catch (BuildException e)
52 {
53 this.Log.LogErrorFromException(e);
54 }
55 catch (Data.WixException e)
56 {
57 this.Log.LogErrorFromException(e);
58 }
59
60 return !this.Log.HasLoggedErrors;
61 }
62
63 protected abstract void ExecuteCore();
64 }
65}
diff --git a/src/WixToolset.BuildTasks/Torch.cs b/src/WixToolset.BuildTasks/Torch.cs
deleted file mode 100644
index e18ed315..00000000
--- a/src/WixToolset.BuildTasks/Torch.cs
+++ /dev/null
@@ -1,159 +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.BuildTasks
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;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// An MSBuild task to run the WiX transform generator.
16 /// </summary>
17 public sealed class Torch : WixToolTask
18 {
19 private const string TorchToolName = "Torch.exe";
20
21 private bool adminImage;
22 private ITaskItem baselineFile;
23 private string binaryExtractionPath;
24 private bool inputIsXml;
25 private bool leaveTemporaryFiles;
26 private bool outputAsXml;
27 private ITaskItem outputFile;
28 private bool preserveUnmodifiedContent;
29 private string suppressTransformErrorFlags;
30 private string transformValidationFlags;
31 private string transformValidationType;
32 private ITaskItem updateFile;
33
34 public bool AdminImage
35 {
36 get { return this.adminImage; }
37 set { this.adminImage = value; }
38 }
39
40
41 [Required]
42 public ITaskItem BaselineFile
43 {
44 get { return this.baselineFile; }
45 set { this.baselineFile = value; }
46 }
47
48 public string BinaryExtractionPath
49 {
50 get { return this.binaryExtractionPath; }
51 set { this.binaryExtractionPath = value; }
52 }
53
54 public bool LeaveTemporaryFiles
55 {
56 get { return this.leaveTemporaryFiles; }
57 set { this.leaveTemporaryFiles = value; }
58 }
59
60 public bool InputIsXml
61 {
62 get { return this.inputIsXml; }
63 set { this.inputIsXml = value; }
64 }
65
66 public bool OutputAsXml
67 {
68 get { return this.outputAsXml; }
69 set { this.outputAsXml = value; }
70 }
71
72 public bool PreserveUnmodifiedContent
73 {
74 get { return this.preserveUnmodifiedContent; }
75 set { this.preserveUnmodifiedContent = value; }
76 }
77
78 [Required]
79 [Output]
80 public ITaskItem OutputFile
81 {
82 get { return this.outputFile; }
83 set { this.outputFile = value; }
84 }
85
86 public string SuppressTransformErrorFlags
87 {
88 get { return this.suppressTransformErrorFlags; }
89 set { this.suppressTransformErrorFlags = value; }
90 }
91
92 public string TransformValidationType
93 {
94 get { return this.transformValidationType; }
95 set { this.transformValidationType = value; }
96 }
97
98 public string TransformValidationFlags
99 {
100 get { return this.transformValidationFlags; }
101 set { this.transformValidationFlags = value; }
102 }
103
104 [Required]
105 public ITaskItem UpdateFile
106 {
107 get { return this.updateFile; }
108 set { this.updateFile = value; }
109 }
110
111 /// <summary>
112 /// Get the name of the executable.
113 /// </summary>
114 /// <remarks>The ToolName is used with the ToolPath to get the location of torch.exe.</remarks>
115 /// <value>The name of the executable.</value>
116 protected override string ToolName
117 {
118 get { return TorchToolName; }
119 }
120
121 /// <summary>
122 /// Get the path to the executable.
123 /// </summary>
124 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
125 /// <returns>The full path to the executable or simply torch.exe if it's expected to be in the system path.</returns>
126 protected override string GenerateFullPathToTool()
127 {
128 // If there's not a ToolPath specified, it has to be in the system path.
129 if (String.IsNullOrEmpty(this.ToolPath))
130 {
131 return TorchToolName;
132 }
133
134 return Path.Combine(Path.GetFullPath(this.ToolPath), TorchToolName);
135 }
136
137 /// <summary>
138 /// Builds a command line from options in this task.
139 /// </summary>
140 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
141 {
142 base.BuildCommandLine(commandLineBuilder);
143
144 commandLineBuilder.AppendIfTrue("-notidy", this.LeaveTemporaryFiles);
145 commandLineBuilder.AppendIfTrue("-xo", this.OutputAsXml);
146 commandLineBuilder.AppendIfTrue("-xi", this.InputIsXml);
147 commandLineBuilder.AppendIfTrue("-p", this.PreserveUnmodifiedContent);
148 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
149 commandLineBuilder.AppendFileNameIfNotNull(this.BaselineFile);
150 commandLineBuilder.AppendFileNameIfNotNull(this.UpdateFile);
151 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
152 commandLineBuilder.AppendIfTrue("-a", this.adminImage);
153 commandLineBuilder.AppendSwitchIfNotNull("-x ", this.BinaryExtractionPath);
154 commandLineBuilder.AppendSwitchIfNotNull("-serr ", this.SuppressTransformErrorFlags);
155 commandLineBuilder.AppendSwitchIfNotNull("-t ", this.TransformValidationType);
156 commandLineBuilder.AppendSwitchIfNotNull("-val ", this.TransformValidationFlags);
157 }
158 }
159}
diff --git a/src/WixToolset.BuildTasks/WixAssignCulture.cs b/src/WixToolset.BuildTasks/WixAssignCulture.cs
deleted file mode 100644
index a8baa62f..00000000
--- a/src/WixToolset.BuildTasks/WixAssignCulture.cs
+++ /dev/null
@@ -1,229 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.IO;
9 using System.Xml;
10 using Microsoft.Build.Framework;
11 using Microsoft.Build.Utilities;
12
13 /// <summary>
14 /// This task assigns Culture metadata to files based on the value of the Culture attribute on the
15 /// WixLocalization element inside the file.
16 /// </summary>
17 public class WixAssignCulture : Task
18 {
19 private const string CultureAttributeName = "Culture";
20 private const string OutputFolderMetadataName = "OutputFolder";
21 private const string InvariantCultureIdentifier = "neutral";
22 private const string NullCultureIdentifier = "null";
23
24 /// <summary>
25 /// The list of cultures to build. Cultures are specified in the following form:
26 /// primary culture,first fallback culture, second fallback culture;...
27 /// Culture groups are seperated by semi-colons
28 /// Culture precedence within a culture group is evaluated from left to right where fallback cultures are
29 /// separated with commas.
30 /// The first (primary) culture in a culture group will be used as the output sub-folder.
31 /// </summary>
32 public string Cultures { get; set; }
33
34 /// <summary>
35 /// The list of files to apply culture information to.
36 /// </summary>
37 [Required]
38 public ITaskItem[] Files
39 {
40 get;
41 set;
42 }
43
44 /// <summary>
45 /// The files that had culture information applied
46 /// </summary>
47 [Output]
48 public ITaskItem[] CultureGroups
49 {
50 get;
51 private set;
52 }
53
54 /// <summary>
55 /// Applies culture information to the files specified by the Files property.
56 /// This task intentionally does not validate that strings are valid Cultures so that we can support
57 /// psuedo-loc.
58 /// </summary>
59 /// <returns>True upon completion of the task execution.</returns>
60 public override bool Execute()
61 {
62 // First, process the culture group list the user specified in the cultures property
63 List<CultureGroup> cultureGroups = new List<CultureGroup>();
64
65 if (!String.IsNullOrEmpty(this.Cultures))
66 {
67 // Get rid of extra quotes
68 this.Cultures = this.Cultures.Trim('\"');
69
70 foreach (string cultureGroupString in this.Cultures.Split(';'))
71 {
72 if (0 == cultureGroupString.Length)
73 {
74 // MSBuild v2.0.50727 cannnot handle "" items
75 // for the invariant culture we require the neutral keyword
76 continue;
77 }
78 CultureGroup cultureGroup = new CultureGroup(cultureGroupString);
79 cultureGroups.Add(cultureGroup);
80 }
81 }
82 else
83 {
84 // Only process the EmbeddedResource items if cultures was unspecified
85 foreach (ITaskItem file in this.Files)
86 {
87 // Ignore non-wxls
88 if (!String.Equals(file.GetMetadata("Extension"), ".wxl", StringComparison.OrdinalIgnoreCase))
89 {
90 Log.LogError("Unable to retrieve the culture for EmbeddedResource {0}. The file type is not supported.", file.ItemSpec);
91 return false;
92 }
93 XmlDocument wxlFile = new XmlDocument();
94
95 try
96 {
97 wxlFile.Load(file.ItemSpec);
98 }
99 catch (FileNotFoundException)
100 {
101 Log.LogError("Unable to retrieve the culture for EmbeddedResource {0}. The file was not found.", file.ItemSpec);
102 return false;
103 }
104 catch (Exception e)
105 {
106 Log.LogError("Unable to retrieve the culture for EmbeddedResource {0}: {1}", file.ItemSpec, e.Message);
107 return false;
108 }
109
110 // Take the culture value and try using it to create a culture.
111 XmlAttribute cultureAttr = wxlFile.DocumentElement.Attributes[WixAssignCulture.CultureAttributeName];
112 string wxlCulture = null == cultureAttr ? String.Empty : cultureAttr.Value;
113 if (0 == wxlCulture.Length)
114 {
115 // We use a keyword for the invariant culture because MSBuild v2.0.50727 cannnot handle "" items
116 wxlCulture = InvariantCultureIdentifier;
117 }
118
119 // We found the culture for the WXL, we now need to determine if it maps to a culture group specified
120 // in the Cultures property or if we need to create a new one.
121 Log.LogMessage(MessageImportance.Low, "Culture \"{0}\" from EmbeddedResource {1}.", wxlCulture, file.ItemSpec);
122
123 bool cultureGroupExists = false;
124 foreach (CultureGroup cultureGroup in cultureGroups)
125 {
126 foreach (string culture in cultureGroup.Cultures)
127 {
128 if (String.Equals(wxlCulture, culture, StringComparison.OrdinalIgnoreCase))
129 {
130 cultureGroupExists = true;
131 break;
132 }
133 }
134 }
135
136 // The WXL didn't match a culture group we already have so create a new one.
137 if (!cultureGroupExists)
138 {
139 cultureGroups.Add(new CultureGroup(wxlCulture));
140 }
141 }
142 }
143
144 // If we didn't create any culture groups the culture was unspecificed and no WXLs were included
145 // Build an unlocalized target in the output folder
146 if (cultureGroups.Count == 0)
147 {
148 cultureGroups.Add(new CultureGroup());
149 }
150
151 List<TaskItem> cultureGroupItems = new List<TaskItem>();
152
153 if (1 == cultureGroups.Count && 0 == this.Files.Length)
154 {
155 // Maintain old behavior, if only one culturegroup is specified and no WXL, output to the default folder
156 TaskItem cultureGroupItem = new TaskItem(cultureGroups[0].ToString());
157 cultureGroupItem.SetMetadata(OutputFolderMetadataName, CultureGroup.DefaultFolder);
158 cultureGroupItems.Add(cultureGroupItem);
159 }
160 else
161 {
162 foreach (CultureGroup cultureGroup in cultureGroups)
163 {
164 TaskItem cultureGroupItem = new TaskItem(cultureGroup.ToString());
165 cultureGroupItem.SetMetadata(OutputFolderMetadataName, cultureGroup.OutputFolder);
166 cultureGroupItems.Add(cultureGroupItem);
167 Log.LogMessage("Culture: {0}", cultureGroup.ToString());
168 }
169 }
170
171 this.CultureGroups = cultureGroupItems.ToArray();
172 return true;
173 }
174
175 private class CultureGroup
176 {
177 /// <summary>
178 /// TargetPath already has a '\', do not double it!
179 /// </summary>
180 public const string DefaultFolder = "";
181
182 /// <summary>
183 /// Initialize a null culture group
184 /// </summary>
185 public CultureGroup()
186 {
187 }
188
189 public CultureGroup(string cultureGroupString)
190 {
191 Debug.Assert(!String.IsNullOrEmpty(cultureGroupString));
192 foreach (string cultureString in cultureGroupString.Split(','))
193 {
194 this.Cultures.Add(cultureString);
195 }
196 }
197
198 public List<string> Cultures { get; } = new List<string>();
199
200 public string OutputFolder
201 {
202 get
203 {
204 string result = DefaultFolder;
205 if (this.Cultures.Count > 0 &&
206 !this.Cultures[0].Equals(InvariantCultureIdentifier, StringComparison.OrdinalIgnoreCase))
207 {
208 result = this.Cultures[0] + "\\";
209 }
210
211 return result;
212 }
213 }
214
215 public override string ToString()
216 {
217 if (this.Cultures.Count > 0)
218 {
219 return String.Join(";", this.Cultures);
220 }
221
222 // We use a keyword for a null culture because MSBuild cannnot handle "" items
223 // Null is different from neutral. For neutral we still want to do WXL
224 // filtering in Light.
225 return NullCultureIdentifier;
226 }
227 }
228 }
229}
diff --git a/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs b/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs
deleted file mode 100644
index a979dbb0..00000000
--- a/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs
+++ /dev/null
@@ -1,177 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9
10 using Microsoft.Build.Framework;
11 using Microsoft.Build.Utilities;
12
13 /// <summary>
14 /// Helper class for appending the command line arguments.
15 /// </summary>
16 public class WixCommandLineBuilder : CommandLineBuilder
17 {
18 internal const int Unspecified = -1;
19
20 /// <summary>
21 /// Append a switch to the command line if the value has been specified.
22 /// </summary>
23 /// <param name="switchName">Switch to append.</param>
24 /// <param name="value">Value specified by the user.</param>
25 public void AppendIfSpecified(string switchName, int value)
26 {
27 if (value != Unspecified)
28 {
29 this.AppendSwitchIfNotNull(switchName, value.ToString(CultureInfo.InvariantCulture));
30 }
31 }
32
33 /// <summary>
34 /// Append a switch to the command line if the condition is true.
35 /// </summary>
36 /// <param name="switchName">Switch to append.</param>
37 /// <param name="condition">Condition specified by the user.</param>
38 public void AppendIfTrue(string switchName, bool condition)
39 {
40 if (condition)
41 {
42 this.AppendSwitch(switchName);
43 }
44 }
45
46 /// <summary>
47 /// Append a switch to the command line if any values in the array have been specified.
48 /// </summary>
49 /// <param name="switchName">Switch to append.</param>
50 /// <param name="values">Values specified by the user.</param>
51 public void AppendArrayIfNotNull(string switchName, IEnumerable<ITaskItem> values)
52 {
53 if (values != null)
54 {
55 foreach (ITaskItem value in values)
56 {
57 this.AppendSwitchIfNotNull(switchName, value);
58 }
59 }
60 }
61
62 /// <summary>
63 /// Append a switch to the command line if any values in the array have been specified.
64 /// </summary>
65 /// <param name="switchName">Switch to append.</param>
66 /// <param name="values">Values specified by the user.</param>
67 public void AppendArrayIfNotNull(string switchName, IEnumerable<string> values)
68 {
69 if (values != null)
70 {
71 foreach (string value in values)
72 {
73 this.AppendSwitchIfNotNull(switchName, value);
74 }
75 }
76 }
77
78 /// <summary>
79 /// Build the extensions argument. Each extension is searched in the current folder, user defined search
80 /// directories (ReferencePath), HintPath, and under Wix Extension Directory in that order.
81 /// The order of precedence is based off of that described in Microsoft.Common.Targets's SearchPaths
82 /// property for the ResolveAssemblyReferences task.
83 /// </summary>
84 /// <param name="extensions">The list of extensions to include.</param>
85 /// <param name="wixExtensionDirectory">Evaluated default folder for Wix Extensions</param>
86 /// <param name="referencePaths">User defined reference directories to search in</param>
87 public void AppendExtensions(ITaskItem[] extensions, string wixExtensionDirectory, string [] referencePaths)
88 {
89 if (extensions == null)
90 {
91 return;
92 }
93
94 foreach (ITaskItem extension in extensions)
95 {
96 string className = extension.GetMetadata("Class");
97
98 string fileName = Path.GetFileName(extension.ItemSpec);
99
100 if (String.IsNullOrEmpty(Path.GetExtension(fileName)))
101 {
102 fileName += ".dll";
103 }
104
105 // First try reference paths
106 var resolvedPath = FileSearchHelperMethods.SearchFilePaths(referencePaths, fileName);
107
108 if (String.IsNullOrEmpty(resolvedPath))
109 {
110 // Now try HintPath
111 resolvedPath = extension.GetMetadata("HintPath");
112
113 if (!File.Exists(resolvedPath))
114 {
115 // Now try the item itself
116 resolvedPath = extension.ItemSpec;
117
118 if (String.IsNullOrEmpty(Path.GetExtension(resolvedPath)))
119 {
120 resolvedPath += ".dll";
121 }
122
123 if (!File.Exists(resolvedPath))
124 {
125 if (!String.IsNullOrEmpty(wixExtensionDirectory))
126 {
127 // Now try the extension directory
128 resolvedPath = Path.Combine(wixExtensionDirectory, Path.GetFileName(resolvedPath));
129 }
130
131 if (!File.Exists(resolvedPath))
132 {
133 // Extension wasn't found, just set it to the extension name passed in
134 resolvedPath = extension.ItemSpec;
135 }
136 }
137 }
138 }
139
140 if (String.IsNullOrEmpty(className))
141 {
142 this.AppendSwitchIfNotNull("-ext ", resolvedPath);
143 }
144 else
145 {
146 this.AppendSwitchIfNotNull("-ext ", className + ", " + resolvedPath);
147 }
148 }
149 }
150
151 /// <summary>
152 /// Append arbitrary text to the command-line if specified.
153 /// </summary>
154 /// <param name="textToAppend">Text to append.</param>
155 public void AppendTextIfNotNull(string textToAppend)
156 {
157 if (!String.IsNullOrEmpty(textToAppend))
158 {
159 this.AppendSpaceIfNotEmpty();
160 this.AppendTextUnquoted(textToAppend);
161 }
162 }
163
164 /// <summary>
165 /// Append arbitrary text to the command-line if specified.
166 /// </summary>
167 /// <param name="textToAppend">Text to append.</param>
168 public void AppendTextIfNotWhitespace(string textToAppend)
169 {
170 if (!String.IsNullOrWhiteSpace(textToAppend))
171 {
172 this.AppendSpaceIfNotEmpty();
173 this.AppendTextUnquoted(textToAppend);
174 }
175 }
176 }
177}
diff --git a/src/WixToolset.BuildTasks/WixToolTask.cs b/src/WixToolset.BuildTasks/WixToolTask.cs
deleted file mode 100644
index 60305e00..00000000
--- a/src/WixToolset.BuildTasks/WixToolTask.cs
+++ /dev/null
@@ -1,403 +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.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics.CodeAnalysis;
8 using System.Globalization;
9 using System.IO;
10 using System.Reflection;
11 using System.Text;
12 using System.Threading;
13
14 using Microsoft.Build.Framework;
15 using Microsoft.Build.Utilities;
16 using WixToolset.Core.CommandLine;
17
18 /// <summary>
19 /// Base class for WiX tool tasks; executes tools in-process
20 /// so that repeated invocations are much faster.
21 /// </summary>
22 public abstract class WixToolTask : ToolTask, IDisposable
23 {
24 private string additionalOptions;
25 private bool disposed;
26 private bool noLogo;
27 private bool runAsSeparateProcess;
28 private bool suppressAllWarnings;
29 private string[] suppressSpecificWarnings;
30 private string[] treatSpecificWarningsAsErrors;
31 private bool treatWarningsAsErrors;
32 private bool verboseOutput;
33 private Queue<string> messageQueue;
34 private ManualResetEvent messagesAvailable;
35 private ManualResetEvent toolExited;
36 private int exitCode;
37
38 /// <summary>
39 /// Gets or sets additional options that are appended the the tool command-line.
40 /// </summary>
41 /// <remarks>
42 /// This allows the task to support extended options in the tool which are not
43 /// explicitly implemented as properties on the task.
44 /// </remarks>
45 public string AdditionalOptions
46 {
47 get { return this.additionalOptions; }
48 set { this.additionalOptions = value; }
49 }
50
51 /// <summary>
52 /// Gets or sets a flag indicating whether the task should be run as separate
53 /// process instead of in-proc with MSBuild which is the default.
54 /// </summary>
55 public bool RunAsSeparateProcess
56 {
57 get { return this.runAsSeparateProcess; }
58 set { this.runAsSeparateProcess = value; }
59 }
60
61#region Common Options
62 /// <summary>
63 /// Gets or sets whether all warnings should be suppressed.
64 /// </summary>
65 public bool SuppressAllWarnings
66 {
67 get { return this.suppressAllWarnings; }
68 set { this.suppressAllWarnings = value; }
69 }
70
71 /// <summary>
72 /// Gets or sets a list of specific warnings to be suppressed.
73 /// </summary>
74 public string[] SuppressSpecificWarnings
75 {
76 get { return this.suppressSpecificWarnings; }
77 set { this.suppressSpecificWarnings = value; }
78 }
79
80 /// <summary>
81 /// Gets or sets whether all warnings should be treated as errors.
82 /// </summary>
83 public bool TreatWarningsAsErrors
84 {
85 get { return this.treatWarningsAsErrors; }
86 set { this.treatWarningsAsErrors = value; }
87 }
88
89 /// <summary>
90 /// Gets or sets a list of specific warnings to treat as errors.
91 /// </summary>
92 public string[] TreatSpecificWarningsAsErrors
93 {
94 get { return this.treatSpecificWarningsAsErrors; }
95 set { this.treatSpecificWarningsAsErrors = value; }
96 }
97
98 /// <summary>
99 /// Gets or sets whether to display verbose output.
100 /// </summary>
101 public bool VerboseOutput
102 {
103 get { return this.verboseOutput; }
104 set { this.verboseOutput = value; }
105 }
106
107 /// <summary>
108 /// Gets or sets whether to display the logo.
109 /// </summary>
110 public bool NoLogo
111 {
112 get { return this.noLogo; }
113 set { this.noLogo = value; }
114 }
115#endregion
116
117 /// <summary>
118 /// Cleans up the ManualResetEvent members
119 /// </summary>
120 public void Dispose()
121 {
122 if (!this.disposed)
123 {
124 this.Dispose(true);
125 GC.SuppressFinalize(this);
126 disposed = true;
127 }
128 }
129
130 /// <summary>
131 /// Cleans up the ManualResetEvent members
132 /// </summary>
133 protected virtual void Dispose(bool disposing)
134 {
135 if (disposing)
136 {
137 messagesAvailable.Close();
138 toolExited.Close();
139 }
140 }
141
142 /// <summary>
143 /// Generate the command line arguments to write to the response file from the properties.
144 /// </summary>
145 /// <returns>Command line string.</returns>
146 protected override string GenerateResponseFileCommands()
147 {
148 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
149 this.BuildCommandLine(commandLineBuilder);
150 return commandLineBuilder.ToString();
151 }
152
153 /// <summary>
154 /// Builds a command line from options in this and derivative tasks.
155 /// </summary>
156 /// <remarks>
157 /// Derivative classes should call BuildCommandLine() on the base class to ensure that common command line options are added to the command.
158 /// </remarks>
159 protected virtual void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
160 {
161 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
162 commandLineBuilder.AppendArrayIfNotNull("-sw", this.SuppressSpecificWarnings);
163 commandLineBuilder.AppendIfTrue("-sw", this.SuppressAllWarnings);
164 commandLineBuilder.AppendIfTrue("-v", this.VerboseOutput);
165 commandLineBuilder.AppendArrayIfNotNull("-wx", this.TreatSpecificWarningsAsErrors);
166 commandLineBuilder.AppendIfTrue("-wx", this.TreatWarningsAsErrors);
167 }
168
169 /// <summary>
170 /// Executes a tool in-process by loading the tool assembly and invoking its entrypoint.
171 /// </summary>
172 /// <param name="pathToTool">Path to the tool to be executed; must be a managed executable.</param>
173 /// <param name="responseFileCommands">Commands to be written to a response file.</param>
174 /// <param name="commandLineCommands">Commands to be passed directly on the command-line.</param>
175 /// <returns>The tool exit code.</returns>
176 protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
177 {
178 if (this.RunAsSeparateProcess)
179 {
180 return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
181 }
182
183 this.messageQueue = new Queue<string>();
184 this.messagesAvailable = new ManualResetEvent(false);
185 this.toolExited = new ManualResetEvent(false);
186
187 WixToolTaskLogger logger = new WixToolTaskLogger(this.messageQueue, this.messagesAvailable);
188 TextWriter saveConsoleOut = Console.Out;
189 TextWriter saveConsoleError = Console.Error;
190 Console.SetOut(logger);
191 Console.SetError(logger);
192
193 string responseFile = null;
194 try
195 {
196 responseFile = this.GetTemporaryResponseFile(responseFileCommands, out var responseFileSwitch);
197 if (!String.IsNullOrEmpty(responseFileSwitch))
198 {
199 commandLineCommands = commandLineCommands + " " + responseFileSwitch;
200 }
201
202 string[] arguments = CommandLineResponseFile.ParseArgumentsToArray(commandLineCommands);
203
204 Thread toolThread = new Thread(new ParameterizedThreadStart(this.ExecuteToolThread));
205 toolThread.Start(new object[] { pathToTool, arguments });
206
207 this.HandleToolMessages();
208
209 if (this.exitCode == 0 && this.Log.HasLoggedErrors)
210 {
211 this.exitCode = -1;
212 }
213
214 return this.exitCode;
215 }
216 finally
217 {
218 if (responseFile != null)
219 {
220 File.Delete(responseFile);
221 }
222
223 Console.SetOut(saveConsoleOut);
224 Console.SetError(saveConsoleError);
225 }
226 }
227
228 /// <summary>
229 /// Called by a new thread to execute the tool in that thread.
230 /// </summary>
231 /// <param name="parameters">Tool path and arguments array.</param>
232 private void ExecuteToolThread(object parameters)
233 {
234 try
235 {
236 object[] pathAndArguments = (object[])parameters;
237 Assembly toolAssembly = Assembly.LoadFrom((string)pathAndArguments[0]);
238 this.exitCode = (int)toolAssembly.EntryPoint.Invoke(null, new object[] { pathAndArguments[1] });
239 }
240 catch (FileNotFoundException fnfe)
241 {
242 Log.LogError("Unable to load tool from path {0}. Consider setting the ToolPath parameter to $(WixToolPath).", fnfe.FileName);
243 this.exitCode = -1;
244 }
245 catch (Exception ex)
246 {
247 this.exitCode = -1;
248 this.LogEventsFromTextOutput(ex.Message, MessageImportance.High);
249 foreach (string stackTraceLine in ex.StackTrace.Split('\n'))
250 {
251 this.LogEventsFromTextOutput(stackTraceLine.TrimEnd(), MessageImportance.High);
252 }
253
254 throw;
255 }
256 finally
257 {
258 this.toolExited.Set();
259 }
260 }
261
262 /// <summary>
263 /// Waits for messages from the tool thread and sends them to the MSBuild logger on the original thread.
264 /// Returns when the tool thread exits.
265 /// </summary>
266 private void HandleToolMessages()
267 {
268 WaitHandle[] waitHandles = new WaitHandle[] { this.messagesAvailable, this.toolExited };
269 while (WaitHandle.WaitAny(waitHandles) == 0)
270 {
271 lock (this.messageQueue)
272 {
273 while (this.messageQueue.Count > 0)
274 {
275 this.LogEventsFromTextOutput(messageQueue.Dequeue(), MessageImportance.Normal);
276 }
277
278 this.messagesAvailable.Reset();
279 }
280 }
281 }
282
283 /// <summary>
284 /// Creates a temporary response file for tool execution.
285 /// </summary>
286 /// <returns>Path to the response file.</returns>
287 /// <remarks>
288 /// The temporary file should be deleted after the tool execution is finished.
289 /// </remarks>
290 private string GetTemporaryResponseFile(string responseFileCommands, out string responseFileSwitch)
291 {
292 string responseFile = null;
293 responseFileSwitch = null;
294
295 if (!String.IsNullOrEmpty(responseFileCommands))
296 {
297 responseFile = Path.GetTempFileName();
298 using (StreamWriter writer = new StreamWriter(responseFile, false, this.ResponseFileEncoding))
299 {
300 writer.Write(responseFileCommands);
301 }
302 responseFileSwitch = this.GetResponseFileSwitch(responseFile);
303 }
304 return responseFile;
305 }
306
307 /// <summary>
308 /// Cycles thru each task to find correct path of the file in question.
309 /// Looks at item spec, hintpath and then in user defined Reference Paths
310 /// </summary>
311 /// <param name="tasks">Input task array</param>
312 /// <param name="referencePaths">SemiColon delimited directories to search</param>
313 /// <returns>List of task item file paths</returns>
314 [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
315 protected static List<string> AdjustFilePaths(ITaskItem[] tasks, string[] referencePaths)
316 {
317 List<string> sourceFilePaths = new List<string>();
318
319 if (tasks == null)
320 {
321 return sourceFilePaths;
322 }
323
324 foreach (ITaskItem task in tasks)
325 {
326 string filePath = task.ItemSpec;
327 if (!File.Exists(filePath))
328 {
329 filePath = task.GetMetadata("HintPath");
330 if (!File.Exists(filePath))
331 {
332 string searchPath = FileSearchHelperMethods.SearchFilePaths(referencePaths, filePath);
333 if (!String.IsNullOrEmpty(searchPath))
334 {
335 filePath = searchPath;
336 }
337 }
338 }
339 sourceFilePaths.Add(filePath);
340 }
341
342 return sourceFilePaths;
343 }
344
345 /// <summary>
346 /// Used as a replacement for Console.Out to capture output from a tool
347 /// and redirect it to the MSBuild logging system.
348 /// </summary>
349 private class WixToolTaskLogger : TextWriter
350 {
351 private StringBuilder buffer;
352 private Queue<string> messageQueue;
353 private ManualResetEvent messagesAvailable;
354
355 /// <summary>
356 /// Creates a new logger that sends tool output to the tool task's log handler.
357 /// </summary>
358 public WixToolTaskLogger(Queue<string> messageQueue, ManualResetEvent messagesAvailable) : base(CultureInfo.CurrentCulture)
359 {
360 this.messageQueue = messageQueue;
361 this.messagesAvailable = messagesAvailable;
362 this.buffer = new StringBuilder();
363 }
364
365 /// <summary>
366 /// Gets the encoding of the logger.
367 /// </summary>
368 public override Encoding Encoding
369 {
370 get { return Encoding.Unicode; }
371 }
372
373 /// <summary>
374 /// Redirects output to a buffer; watches for newlines and sends each line to the
375 /// MSBuild logging system.
376 /// </summary>
377 /// <param name="value">Character being written.</param>
378 /// <remarks>All other Write() variants eventually call into this one.</remarks>
379 public override void Write(char value)
380 {
381 lock (this.messageQueue)
382 {
383 if (value == '\n')
384 {
385 if (this.buffer.Length > 0 && this.buffer[this.buffer.Length - 1] == '\r')
386 {
387 this.buffer.Length = this.buffer.Length - 1;
388 }
389
390 this.messageQueue.Enqueue(this.buffer.ToString());
391 this.messagesAvailable.Set();
392
393 this.buffer.Length = 0;
394 }
395 else
396 {
397 this.buffer.Append(value);
398 }
399 }
400 }
401 }
402 }
403}
diff --git a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj b/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
deleted file mode 100644
index 9f7c8ce6..00000000
--- a/src/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
+++ /dev/null
@@ -1,42 +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 <TargetFramework>net461</TargetFramework>
7 <Description></Description>
8 <Title>WiX Toolset MSBuild Tasks</Title>
9 <DebugType>embedded</DebugType>
10 <PublishRepositoryUrl>true</PublishRepositoryUrl>
11 </PropertyGroup>
12
13 <PropertyGroup>
14 <!-- <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> -->
15 </PropertyGroup>
16
17 <ItemGroup>
18 <Content Include="redirects\wix.targets" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="redirects\wix.ca.targets" CopyToOutputDirectory="PreserveNewest" />
20 <Content Include="wix.targets" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="wix.ca.targets" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="wix.harvest.targets" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="wix.signing.targets" CopyToOutputDirectory="PreserveNewest" />
24 </ItemGroup>
25
26 <ItemGroup>
27 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" />
28 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
29 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
30 </ItemGroup>
31
32 <ItemGroup>
33 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" />
34 </ItemGroup>
35
36 <ItemGroup>
37 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/>
38 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
39 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" PrivateAssets="all" Condition="'$(TargetFramework)'=='net461' " />
40 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.3.409" PrivateAssets="all" Condition="'$(TargetFramework)'=='netstandard2.0' " />
41 </ItemGroup>
42</Project>
diff --git a/src/WixToolset.BuildTasks/heatdirectory.cs b/src/WixToolset.BuildTasks/heatdirectory.cs
deleted file mode 100644
index 1d5f104a..00000000
--- a/src/WixToolset.BuildTasks/heatdirectory.cs
+++ /dev/null
@@ -1,103 +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.BuildTasks
4{
5 using Microsoft.Build.Framework;
6
7 public sealed class HeatDirectory : HeatTask
8 {
9 private string directory;
10 private bool keepEmptyDirectories;
11 private bool suppressCom;
12 private bool suppressRootDirectory;
13 private bool suppressRegistry;
14 private string template;
15 private string componentGroupName;
16 private string directoryRefId;
17 private string preprocessorVariable;
18
19 public string ComponentGroupName
20 {
21 get { return this.componentGroupName; }
22 set { this.componentGroupName = value; }
23 }
24
25 [Required]
26 public string Directory
27 {
28 get { return this.directory; }
29 set { this.directory = value; }
30 }
31
32 public string DirectoryRefId
33 {
34 get { return this.directoryRefId; }
35 set { this.directoryRefId = value; }
36 }
37
38 public bool KeepEmptyDirectories
39 {
40 get { return this.keepEmptyDirectories; }
41 set { this.keepEmptyDirectories = value; }
42 }
43
44 public string PreprocessorVariable
45 {
46 get { return this.preprocessorVariable; }
47 set { this.preprocessorVariable = value; }
48 }
49
50 public bool SuppressCom
51 {
52 get { return this.suppressCom; }
53 set { this.suppressCom = value; }
54 }
55
56 public bool SuppressRootDirectory
57 {
58 get { return this.suppressRootDirectory; }
59 set { this.suppressRootDirectory = value; }
60 }
61
62 public bool SuppressRegistry
63 {
64 get { return this.suppressRegistry; }
65 set { this.suppressRegistry = value; }
66 }
67
68 public string Template
69 {
70 get { return this.template; }
71 set { this.template = value; }
72 }
73
74 protected override string OperationName
75 {
76 get { return "dir"; }
77 }
78
79 /// <summary>
80 /// Generate the command line arguments to write to the response file from the properties.
81 /// </summary>
82 /// <returns>Command line string.</returns>
83 protected override string GenerateResponseFileCommands()
84 {
85 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
86
87 commandLineBuilder.AppendSwitch(this.OperationName);
88 commandLineBuilder.AppendFileNameIfNotNull(this.Directory);
89
90 commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.ComponentGroupName);
91 commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.DirectoryRefId);
92 commandLineBuilder.AppendIfTrue("-ke", this.KeepEmptyDirectories);
93 commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
94 commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);
95 commandLineBuilder.AppendIfTrue("-srd", this.SuppressRootDirectory);
96 commandLineBuilder.AppendSwitchIfNotNull("-template ", this.Template);
97 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
98
99 base.BuildCommandLine(commandLineBuilder);
100 return commandLineBuilder.ToString();
101 }
102 }
103}
diff --git a/src/WixToolset.BuildTasks/heatfile.cs b/src/WixToolset.BuildTasks/heatfile.cs
deleted file mode 100644
index 69e11b88..00000000
--- a/src/WixToolset.BuildTasks/heatfile.cs
+++ /dev/null
@@ -1,95 +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.BuildTasks
4{
5 using Microsoft.Build.Framework;
6
7 public sealed class HeatFile : HeatTask
8 {
9 private string file;
10 private bool suppressCom;
11 private bool suppressRegistry;
12 private bool suppressRootDirectory;
13 private string template;
14 private string componentGroupName;
15 private string directoryRefId;
16 private string preprocessorVariable;
17
18 public string ComponentGroupName
19 {
20 get { return this.componentGroupName; }
21 set { this.componentGroupName = value; }
22 }
23
24 public string DirectoryRefId
25 {
26 get { return this.directoryRefId; }
27 set { this.directoryRefId = value; }
28 }
29
30 [Required]
31 public string File
32 {
33 get { return this.file; }
34 set { this.file = value; }
35 }
36
37 public string PreprocessorVariable
38 {
39 get { return this.preprocessorVariable; }
40 set { this.preprocessorVariable = value; }
41 }
42
43 public bool SuppressCom
44 {
45 get { return this.suppressCom; }
46 set { this.suppressCom = value; }
47 }
48
49 public bool SuppressRegistry
50 {
51 get { return this.suppressRegistry; }
52 set { this.suppressRegistry = value; }
53 }
54
55 public bool SuppressRootDirectory
56 {
57 get { return this.suppressRootDirectory; }
58 set { this.suppressRootDirectory = value; }
59 }
60
61 public string Template
62 {
63 get { return this.template; }
64 set { this.template = value; }
65 }
66
67 protected override string OperationName
68 {
69 get { return "file"; }
70 }
71
72 /// <summary>
73 /// Generate the command line arguments to write to the response file from the properties.
74 /// </summary>
75 /// <returns>Command line string.</returns>
76 protected override string GenerateResponseFileCommands()
77 {
78 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
79
80 commandLineBuilder.AppendSwitch(this.OperationName);
81 commandLineBuilder.AppendFileNameIfNotNull(this.File);
82
83 commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.ComponentGroupName);
84 commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.DirectoryRefId);
85 commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
86 commandLineBuilder.AppendIfTrue("-srd", this.SuppressRootDirectory);
87 commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);
88 commandLineBuilder.AppendSwitchIfNotNull("-template ", this.Template);
89 commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);
90
91 base.BuildCommandLine(commandLineBuilder);
92 return commandLineBuilder.ToString();
93 }
94 }
95}
diff --git a/src/WixToolset.BuildTasks/heatproject.cs b/src/WixToolset.BuildTasks/heatproject.cs
deleted file mode 100644
index 8620ffa3..00000000
--- a/src/WixToolset.BuildTasks/heatproject.cs
+++ /dev/null
@@ -1,108 +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.BuildTasks
4{
5 using Microsoft.Build.Framework;
6
7 public sealed class HeatProject : HeatTask
8 {
9 private string configuration;
10 private string directoryIds;
11 private string generateType;
12 private bool generateWixVariables;
13 private string platform;
14 private string project;
15 private string projectName;
16 private string[] projectOutputGroups;
17
18 public string Configuration
19 {
20 get { return this.configuration; }
21 set { this.configuration = value; }
22 }
23
24 public string DirectoryIds
25 {
26 get { return this.directoryIds; }
27 set { this.directoryIds = value; }
28 }
29
30 public bool GenerateWixVariables
31 {
32 get { return this.generateWixVariables; }
33 set { this.generateWixVariables = value; }
34 }
35
36 public string GenerateType
37 {
38 get { return this.generateType; }
39 set { this.generateType = value; }
40 }
41
42 public string Platform
43 {
44 get { return this.platform; }
45 set { this.platform = value; }
46 }
47
48 [Required]
49 public string Project
50 {
51 get { return this.project; }
52 set { this.project = value; }
53 }
54
55 public string ProjectName
56 {
57 get { return this.projectName; }
58 set { this.projectName = value; }
59 }
60
61 public string[] ProjectOutputGroups
62 {
63 get
64 {
65 return this.projectOutputGroups;
66 }
67 set
68 {
69 this.projectOutputGroups = value;
70
71 // If it's just one string and it contains semicolons, let's
72 // split it into separate items.
73 if (this.projectOutputGroups.Length == 1)
74 {
75 this.projectOutputGroups = this.projectOutputGroups[0].Split(new char[] { ';' });
76 }
77 }
78 }
79
80 protected override string OperationName
81 {
82 get { return "project"; }
83 }
84
85 /// <summary>
86 /// Generate the command line arguments to write to the response file from the properties.
87 /// </summary>
88 /// <returns>Command line string.</returns>
89 protected override string GenerateResponseFileCommands()
90 {
91 WixCommandLineBuilder commandLineBuilder = new WixCommandLineBuilder();
92
93 commandLineBuilder.AppendSwitch(this.OperationName);
94 commandLineBuilder.AppendFileNameIfNotNull(this.Project);
95
96 commandLineBuilder.AppendSwitchIfNotNull("-configuration ", this.Configuration);
97 commandLineBuilder.AppendSwitchIfNotNull("-directoryid ", this.DirectoryIds);
98 commandLineBuilder.AppendSwitchIfNotNull("-generate ", this.GenerateType);
99 commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.Platform);
100 commandLineBuilder.AppendArrayIfNotNull("-pog ", this.ProjectOutputGroups);
101 commandLineBuilder.AppendSwitchIfNotNull("-projectname ", this.ProjectName);
102 commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables);
103
104 base.BuildCommandLine(commandLineBuilder);
105 return commandLineBuilder.ToString();
106 }
107 }
108}
diff --git a/src/WixToolset.BuildTasks/heattask.cs b/src/WixToolset.BuildTasks/heattask.cs
deleted file mode 100644
index bf0a2ad3..00000000
--- a/src/WixToolset.BuildTasks/heattask.cs
+++ /dev/null
@@ -1,121 +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.BuildTasks
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;
12 using Microsoft.Build.Utilities;
13
14 /// <summary>
15 /// A base MSBuild task to run the WiX harvester.
16 /// Specific harvester tasks should extend this class.
17 /// </summary>
18 public abstract class HeatTask : WixToolTask
19 {
20 private const string HeatToolName = "Heat.exe";
21
22 private bool autogenerageGuids;
23 private bool generateGuidsNow;
24 private ITaskItem outputFile;
25 private bool suppressFragments;
26 private bool suppressUniqueIds;
27 private string[] transforms;
28
29 public bool AutogenerateGuids
30 {
31 get { return this.autogenerageGuids; }
32 set { this.autogenerageGuids = value; }
33 }
34
35 public bool GenerateGuidsNow
36 {
37 get { return this.generateGuidsNow; }
38 set { this.generateGuidsNow = value; }
39 }
40
41 [Required]
42 [Output]
43 public ITaskItem OutputFile
44 {
45 get { return this.outputFile; }
46 set { this.outputFile = value; }
47 }
48
49 public bool SuppressFragments
50 {
51 get { return this.suppressFragments; }
52 set { this.suppressFragments = value; }
53 }
54
55 public bool SuppressUniqueIds
56 {
57 get { return this.suppressUniqueIds; }
58 set { this.suppressUniqueIds = value; }
59 }
60
61 public string[] Transforms
62 {
63 get { return this.transforms; }
64 set { this.transforms = value; }
65 }
66
67 /// <summary>
68 /// Get the name of the executable.
69 /// </summary>
70 /// <remarks>The ToolName is used with the ToolPath to get the location of heat.exe.</remarks>
71 /// <value>The name of the executable.</value>
72 protected override string ToolName
73 {
74 get { return HeatToolName; }
75 }
76
77 /// <summary>
78 /// Gets the name of the heat operation performed by the task.
79 /// </summary>
80 /// <remarks>This is the first parameter passed on the heat.exe command-line.</remarks>
81 /// <value>The name of the heat operation performed by the task.</value>
82 protected abstract string OperationName
83 {
84 get;
85 }
86
87 /// <summary>
88 /// Get the path to the executable.
89 /// </summary>
90 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
91 /// <returns>The full path to the executable or simply heat.exe if it's expected to be in the system path.</returns>
92 protected override string GenerateFullPathToTool()
93 {
94 // If there's not a ToolPath specified, it has to be in the system path.
95 if (String.IsNullOrEmpty(this.ToolPath))
96 {
97 return HeatToolName;
98 }
99
100 return Path.Combine(Path.GetFullPath(this.ToolPath), HeatToolName);
101 }
102
103 /// <summary>
104 /// Builds a command line from options in this task.
105 /// </summary>
106 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
107 {
108 base.BuildCommandLine(commandLineBuilder);
109
110 commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids);
111 commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow);
112 commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
113 commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments);
114 commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds);
115 commandLineBuilder.AppendArrayIfNotNull("-sw", this.SuppressSpecificWarnings);
116 commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms);
117 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
118 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
119 }
120 }
121}
diff --git a/src/WixToolset.BuildTasks/redirects/wix.ca.targets b/src/WixToolset.BuildTasks/redirects/wix.ca.targets
deleted file mode 100644
index ecb6e09f..00000000
--- a/src/WixToolset.BuildTasks/redirects/wix.ca.targets
+++ /dev/null
@@ -1,10 +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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
5 <PropertyGroup>
6 <WixInstallFolder>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\WiX Toolset\v4', 'InstallFolder', null, RegistryView.Registry32))</WixInstallFolder>
7 </PropertyGroup>
8
9 <Import Project="$(WixInstallFolder)sdk\wix.ca.targets" />
10</Project>
diff --git a/src/WixToolset.BuildTasks/redirects/wix.targets b/src/WixToolset.BuildTasks/redirects/wix.targets
deleted file mode 100644
index ba354b65..00000000
--- a/src/WixToolset.BuildTasks/redirects/wix.targets
+++ /dev/null
@@ -1,10 +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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
5 <PropertyGroup>
6 <WixInstallFolder>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\WiX Toolset\v4', 'InstallFolder', null, RegistryView.Registry32))</WixInstallFolder>
7 </PropertyGroup>
8
9 <Import Project="$(WixInstallFolder)bin\wix.targets" />
10</Project>
diff --git a/src/WixToolset.BuildTasks/wix.ca.targets b/src/WixToolset.BuildTasks/wix.ca.targets
deleted file mode 100644
index 4578c2d8..00000000
--- a/src/WixToolset.BuildTasks/wix.ca.targets
+++ /dev/null
@@ -1,123 +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" ToolsVersion="4.0">
6
7 <Import Project="$(CustomBeforeWixCATargets)" Condition=" '$(CustomBeforeWixCATargets)' != '' and Exists('$(CustomBeforeWixCATargets)')" />
8
9 <PropertyGroup>
10 <WixCATargetsImported>true</WixCATargetsImported>
11
12 <TargetCAFileName Condition=" '$(TargetCAFileName)' == '' ">$(TargetName).CA$(TargetExt)</TargetCAFileName>
13
14 <WixSdkPath Condition=" '$(WixSdkPath)' == '' ">$(MSBuildThisFileDirectory)</WixSdkPath>
15 <WixSdkX86Path Condition=" '$(WixSdkX86Path)' == '' ">$(WixSdkPath)x86\</WixSdkX86Path>
16 <WixSdkX64Path Condition=" '$(WixSdkX64Path)' == '' ">$(WixSdkPath)x64\</WixSdkX64Path>
17
18 <MakeSfxCA Condition=" '$(MakeSfxCA)' == '' ">$(WixSdkPath)MakeSfxCA.exe</MakeSfxCA>
19 <SfxCADll Condition=" '$(SfxCADll)' == '' and '$(Platform)' == 'x64' ">$(WixSdkX64Path)SfxCA.dll</SfxCADll>
20 <SfxCADll Condition=" '$(SfxCADll)' == '' ">$(WixSdkX86Path)SfxCA.dll</SfxCADll>
21 </PropertyGroup>
22
23 <!--
24 ==================================================================================================
25 PackCustomAction
26
27 Creates an MSI managed custom action package that includes the custom action assembly,
28 local assembly dependencies, and project content files.
29
30 [IN]
31 @(IntermediateAssembly) - Managed custom action assembly.
32 @(Content) - Project items of type Content will be included in the package.
33 $(CustomActionContents) - Optional space-delimited list of additional files to include.
34
35 [OUT]
36 $(IntermediateOutputPath)$(TargetCAFileName) - Managed custom action package with unmanaged stub.
37 ==================================================================================================
38 -->
39 <Target Name="PackCustomAction"
40 Inputs="@(IntermediateAssembly);@(Content);$(CustomActionContents)"
41 Outputs="$(IntermediateOutputPath)$(TargetCAFileName)">
42
43 <!-- Find all referenced items marked CopyLocal, but exclude non-binary files. -->
44 <ItemGroup>
45 <CustomActionReferenceContents Include="@(ReferenceCopyLocalPaths)"
46 Condition=" '%(Extension)' == '.dll' or '%(Extension)' == '.exe' " />
47 <CustomActionReferenceContents Include="@(ReferenceComWrappersToCopyLocal)"
48 Condition=" '%(Extension)' == '.dll' or '%(Extension)' == '.exe' " />
49
50 <!-- include PDBs for Debug only -->
51 <CustomActionReferenceContents Include="@(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).pdb')"
52 Condition=" Exists('%(RootDir)%(Directory)%(Filename).pdb') and '$(Configuration)' == 'Debug' " />
53 <CustomActionReferenceContents Include="@(ReferenceCopyLocalPaths)"
54 Condition=" '%(Extension)' == '.pdb' and '$(Configuration)' == 'Debug' " />
55 <CustomActionReferenceContents Include="@(ReferenceComWrappersToCopyLocal)"
56 Condition=" '%(Extension)' == '.pdb' and '$(Configuration)' == 'Debug' " />
57 </ItemGroup>
58
59 <!--
60 Items to include in the CA package:
61 - Reference assemblies marked CopyLocal
62 - Project items of type Content
63 - Additional items in the CustomActionContents property
64 -->
65 <PropertyGroup>
66 <CustomActionContents>@(CustomActionReferenceContents);@(Content->'%(FullPath)');$(CustomActionContents)</CustomActionContents>
67 </PropertyGroup>
68
69 <ItemGroup>
70 <IntermediateCAAssembly Include="@(IntermediateAssembly->'%(FullPath)')" />
71 <IntermediateCAPackage Include="@(IntermediateAssembly->'%(RootDir)%(Directory)$(TargetCAFileName)')" />
72 </ItemGroup>
73
74 <!-- Run the MakeSfxCA.exe CA packaging tool. -->
75 <Exec Command='"$(MakeSfxCA)" "@(IntermediateCAPackage)" "$(SfxCADll)" "@(IntermediateCAAssembly)" "$(CustomActionContents)"'
76 WorkingDirectory="$(ProjectDir)" />
77
78 <!-- Add modules to be copied to output dir. -->
79 <ItemGroup>
80 <AddModules Include="@(IntermediateCAPackage)" />
81 </ItemGroup>
82 </Target>
83
84 <!--
85 ==================================================================================================
86 CleanCustomAction
87
88 Cleans the .CA.dll binary created by the PackCustomAction target.
89
90 ==================================================================================================
91 -->
92 <Target Name="CleanCustomAction">
93 <Delete Files="$(IntermediateOutputPath)$(TargetCAFileName)"
94 TreatErrorsAsWarnings="true" />
95 </Target>
96
97 <!--
98 ==================================================================================================
99 AfterCompile (redefinition)
100
101 Calls the PackCustomAction target after compiling.
102 Overrides the empty AfterCompile target from Microsoft.Common.targets.
103
104 ==================================================================================================
105 -->
106 <Target Name="AfterCompile"
107 DependsOnTargets="PackCustomAction" />
108
109 <!--
110 ==================================================================================================
111 BeforeClean (redefinition)
112
113 Calls the CleanCustomAction target before cleaning.
114 Overrides the empty AfterCompile target from Microsoft.Common.targets.
115
116 ==================================================================================================
117 -->
118 <Target Name="BeforeClean"
119 DependsOnTargets="CleanCustomAction" />
120
121 <Import Project="$(CustomAfterWixCATargets)" Condition=" '$(CustomAfterWixCATargets)' != '' and Exists('$(CustomAfterWixCATargets)')" />
122
123</Project>
diff --git a/src/WixToolset.BuildTasks/wix.harvest.targets b/src/WixToolset.BuildTasks/wix.harvest.targets
deleted file mode 100644
index e94dfcea..00000000
--- a/src/WixToolset.BuildTasks/wix.harvest.targets
+++ /dev/null
@@ -1,511 +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
7 <!-- These properties can be overridden to support non-default installations. -->
8 <PropertyGroup>
9 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileFullPath)</WixTargetsPath>
10 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixTargetsPath)WixTasks.dll</WixTasksPath>
11 </PropertyGroup>
12
13 <!-- These tasks are extensions for harvesting WiX source code from other sources. -->
14 <UsingTask TaskName="HeatFile" AssemblyFile="$(WixTasksPath)" />
15 <UsingTask TaskName="HeatDirectory" AssemblyFile="$(WixTasksPath)" />
16 <UsingTask TaskName="HeatProject" AssemblyFile="$(WixTasksPath)" />
17
18 <UsingTask TaskName="RefreshGeneratedFile" AssemblyFile="$(WixTasksPath)"/>
19 <UsingTask TaskName="RefreshBundleGeneratedFile" AssemblyFile="$(WixTasksPath)"/>
20
21 <!-- Default Harvester properties-->
22 <PropertyGroup>
23 <HarvestNoLogo Condition=" '$(HarvestNoLogo)' == '' ">$(NoLogo)</HarvestNoLogo>
24 <HarvestSuppressAllWarnings Condition=" '$(HarvestSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</HarvestSuppressAllWarnings>
25 <HarvestSuppressSpecificWarnings Condition=" '$(HarvestSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</HarvestSuppressSpecificWarnings>
26 <HarvestTreatWarningsAsErrors Condition=" '$(HarvestTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</HarvestTreatWarningsAsErrors>
27 <HarvestTreatSpecificWarningsAsErrors Condition=" '$(HarvestTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</HarvestTreatSpecificWarningsAsErrors>
28 <HarvestVerboseOutput Condition=" '$(HarvestVerboseOutput)' == '' ">$(VerboseOutput)</HarvestVerboseOutput>
29 <HarvestAutogenerateGuids Condition=" '$(HarvestAutogenerateGuids)' == '' ">true</HarvestAutogenerateGuids>
30 <HarvestGenerateGuidsNow Condition=" '$(HarvestGenerateGuidsNow)' == '' ">false</HarvestGenerateGuidsNow>
31 <HarvestSuppressFragments Condition=" '$(HarvestSuppressFragments)' == '' ">true</HarvestSuppressFragments>
32 <HarvestSuppressUniqueIds Condition=" '$(HarvestSuppressUniqueIds)' == '' ">false</HarvestSuppressUniqueIds>
33 </PropertyGroup>
34
35 <!-- Default HarvestProjects properties -->
36 <PropertyGroup>
37 <!-- Project harvesting is defaulted to off until it works more consistently. -->
38 <EnableProjectHarvesting Condition=" '$(EnableProjectHarvesting)'=='' ">false</EnableProjectHarvesting>
39
40 <HarvestProjectsNoLogo Condition=" '$(HarvestProjectsNoLogo)' == '' ">$(HarvestNoLogo)</HarvestProjectsNoLogo>
41 <HarvestProjectsSuppressAllWarnings Condition=" '$(HarvestProjectsSuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestProjectsSuppressAllWarnings>
42 <HarvestProjectsSuppressSpecificWarnings Condition=" '$(HarvestProjectsSuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestProjectsSuppressSpecificWarnings>
43 <HarvestProjectsTreatWarningsAsErrors Condition=" '$(HarvestProjectsTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestProjectsTreatWarningsAsErrors>
44 <HarvestProjectsTreatSpecificWarningsAsErrors Condition=" '$(HarvestProjectsTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestProjectsTreatSpecificWarningsAsErrors>
45 <HarvestProjectsVerboseOutput Condition=" '$(HarvestProjectsVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestProjectsVerboseOutput>
46 <HarvestProjectsAutogenerateGuids Condition=" '$(HarvestProjectsAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestProjectsAutogenerateGuids>
47 <HarvestProjectsGenerateGuidsNow Condition=" '$(HarvestProjectsGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestProjectsGenerateGuidsNow>
48 <HarvestProjectsSuppressFragments Condition=" '$(HarvestProjectsSuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestProjectsSuppressFragments>
49 <HarvestProjectsSuppressUniqueIds Condition=" '$(HarvestProjectsSuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestProjectsSuppressUniqueIds>
50 <HarvestProjectsTransforms Condition=" '$(HarvestProjectsTransforms)' == '' ">$(HarvestTransforms)</HarvestProjectsTransforms>
51 <HarvestProjectsGeneratedFile Condition=" '$(HarvestProjectsGeneratedFile)' == '' and '$(OutputType)' != 'Bundle' ">$(IntermediateOutputPath)Product.Generated.wxs</HarvestProjectsGeneratedFile>
52 <HarvestProjectsGeneratedFile Condition=" '$(HarvestProjectsGeneratedFile)' == '' and '$(OutputType)' == 'Bundle' ">$(IntermediateOutputPath)Bundle.Generated.wxs</HarvestProjectsGeneratedFile>
53 </PropertyGroup>
54
55 <!-- Default HarvestDirectory properties -->
56 <PropertyGroup>
57 <HarvestDirectoryNoLogo Condition=" '$(HarvestDirectoryNoLogo)' == '' ">$(HarvestNoLogo)</HarvestDirectoryNoLogo>
58 <HarvestDirectorySuppressAllWarnings Condition=" '$(HarvestDirectorySuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestDirectorySuppressAllWarnings>
59 <HarvestDirectorySuppressSpecificWarnings Condition=" '$(HarvestDirectorySuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestDirectorySuppressSpecificWarnings>
60 <HarvestDirectoryTreatWarningsAsErrors Condition=" '$(HarvestDirectoryTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestDirectoryTreatWarningsAsErrors>
61 <HarvestDirectoryTreatSpecificWarningsAsErrors Condition=" '$(HarvestDirectoryTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestDirectoryTreatSpecificWarningsAsErrors>
62 <HarvestDirectoryVerboseOutput Condition=" '$(HarvestDirectoryVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestDirectoryVerboseOutput>
63 <HarvestDirectoryAutogenerateGuids Condition=" '$(HarvestDirectoryAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestDirectoryAutogenerateGuids>
64 <HarvestDirectoryGenerateGuidsNow Condition=" '$(HarvestDirectoryGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestDirectoryGenerateGuidsNow>
65 <HarvestDirectorySuppressFragments Condition=" '$(HarvestDirectorySuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestDirectorySuppressFragments>
66 <HarvestDirectorySuppressUniqueIds Condition=" '$(HarvestDirectorySuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestDirectorySuppressUniqueIds>
67 <HarvestDirectoryTransforms Condition=" '$(HarvestDirectoryTransforms)' == '' ">$(HarvestTransforms)</HarvestDirectoryTransforms>
68 </PropertyGroup>
69
70 <!-- Default HarvestFile properties -->
71 <PropertyGroup>
72 <HarvestFileNoLogo Condition=" '$(HarvestFileNoLogo)' == '' ">$(HarvestNoLogo)</HarvestFileNoLogo>
73 <HarvestFileSuppressAllWarnings Condition=" '$(HarvestFileSuppressAllWarnings)' == '' ">$(HarvestSuppressAllWarnings)</HarvestFileSuppressAllWarnings>
74 <HarvestFileSuppressSpecificWarnings Condition=" '$(HarvestFileSuppressSpecificWarnings)' == '' ">$(HarvestSuppressSpecificWarnings)</HarvestFileSuppressSpecificWarnings>
75 <HarvestFileTreatWarningsAsErrors Condition=" '$(HarvestFileTreatWarningsAsErrors)' == '' ">$(HarvestTreatWarningsAsErrors)</HarvestFileTreatWarningsAsErrors>
76 <HarvestFileTreatSpecificWarningsAsErrors Condition=" '$(HarvestFileTreatSpecificWarningsAsErrors)' == '' ">$(HarvestTreatSpecificWarningsAsErrors)</HarvestFileTreatSpecificWarningsAsErrors>
77 <HarvestFileVerboseOutput Condition=" '$(HarvestFileVerboseOutput)' == '' ">$(HarvestVerboseOutput)</HarvestFileVerboseOutput>
78 <HarvestFileAutogenerateGuids Condition=" '$(HarvestFileAutogenerateGuids)' == '' ">$(HarvestAutogenerateGuids)</HarvestFileAutogenerateGuids>
79 <HarvestFileGenerateGuidsNow Condition=" '$(HarvestFileGenerateGuidsNow)' == '' ">$(HarvestGenerateGuidsNow)</HarvestFileGenerateGuidsNow>
80 <HarvestFileSuppressFragments Condition=" '$(HarvestFileSuppressFragments)' == '' ">$(HarvestSuppressFragments)</HarvestFileSuppressFragments>
81 <HarvestFileSuppressUniqueIds Condition=" '$(HarvestFileSuppressUniqueIds)' == '' ">$(HarvestSuppressUniqueIds)</HarvestFileSuppressUniqueIds>
82 <HarvestFileTransforms Condition=" '$(HarvestFileTransforms)' == '' ">$(HarvestTransforms)</HarvestFileTransforms>
83 </PropertyGroup>
84
85 <!--
86 ==================================================================================================
87 Harvest
88 ==================================================================================================
89 -->
90 <PropertyGroup>
91 <HarvestDependsOn>
92 ConvertReferences;
93 ConvertBundleReferences;
94 HarvestProjects;
95 HarvestDirectory;
96 HarvestFile;
97 GenerateCode;
98 </HarvestDependsOn>
99 </PropertyGroup>
100 <Target
101 Name="Harvest"
102 DependsOnTargets="$(HarvestDependsOn)" />
103
104 <!--
105 ==================================================================================================
106 GenerateCode
107 ==================================================================================================
108 -->
109 <PropertyGroup>
110 <GenerateCodeDependsOn>
111 RefreshGeneratedFile;
112 RefreshBundleGeneratedFile
113 </GenerateCodeDependsOn>
114 </PropertyGroup>
115 <Target
116 Name="GenerateCode"
117 DependsOnTargets="$(GenerateCodeDependsOn)" />
118
119 <!--
120 ================================================================================================
121 ConvertReferences
122
123 Converts project references to HeatProject items to auto generate authoring.
124 ================================================================================================
125 -->
126 <Target
127 Name="ConvertReferences"
128 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module') ">
129
130 <ItemGroup>
131 <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' ">
132 <DirectoryIds>%(_MSBuildProjectReferenceExistent.RefTargetDir)</DirectoryIds>
133 <ProjectOutputGroups>Binaries;Symbols;Sources;Content;Satellites;Documents</ProjectOutputGroups>
134 <ProjectName>%(_MSBuildProjectReferenceExistent.Name)</ProjectName>
135 <HeatOutput>$(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs</HeatOutput>
136 </_HeatProjectReference>
137 <HeatProject Include="@(_HeatProjectReference)" />
138 </ItemGroup>
139
140 <Error
141 Text="The following files are deprecated and should be removed from your project(s): @(Compile->'%(Identity)', ', ')"
142 Condition=" '%(Compile.GenerateComponentGroups)' != '' " />
143
144 <ItemGroup>
145 <!-- Unconditionally generate Compile items so they are always linked in. -->
146 <Compile Include="$(HarvestProjectsGeneratedFile)" />
147 <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" />
148 </ItemGroup>
149
150 </Target>
151
152 <!--
153 ================================================================================================
154 ConvertBundleReferences
155
156 Converts project references in Bundle projects to HeatProject items to auto generate authoring.
157 ================================================================================================
158 -->
159 <Target
160 Name="ConvertBundleReferences"
161 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Bundle') ">
162
163 <ItemGroup>
164 <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' ">
165 <ProjectOutputGroups>Binaries;Symbols;Sources;Content;Satellites;Documents</ProjectOutputGroups>
166 <GenerateType>payloadgroup</GenerateType>
167 <HeatOutput>$(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs</HeatOutput>
168 </_HeatProjectReference>
169 <HeatProject Include="@(_HeatProjectReference)" />
170 </ItemGroup>
171
172 <Error
173 Text="The following files are deprecated and should be removed from your project(s): @(Compile->'%(Identity)', ', ')"
174 Condition=" '%(Compile.GenerateComponentGroups)' != '' " />
175
176 <ItemGroup>
177 <!-- Unconditionally generate Compile items so they are always linked in. -->
178 <Compile Include="$(HarvestProjectsGeneratedFile)" />
179 <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" />
180 </ItemGroup>
181
182 </Target>
183
184 <!--
185 ================================================================================================
186 CombineHarvestProjects
187
188 Combines HeatProject and HarvestProject items together and ensures each has HeatOutput metadata.
189 ================================================================================================
190 -->
191 <Target
192 Name="CombineHarvestProjects"
193 Condition=" '@(HeatProject)' != '' or '@(HarvestProject)' != '' ">
194
195 <!-- Add default HeatOutputs for those without one specified -->
196 <CreateItem Include="@(HeatProject)" Condition= " '%(HeatProject.HeatOutput)' == '' "
197 AdditionalMetadata="HeatOutput=$(IntermediateOutputPath)_%(HeatProject.Filename).wxs">
198 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
199 </CreateItem>
200 <CreateItem Include="@(HarvestProject)" Condition= " '%(HarvestProject.HeatOutput)' == '' "
201 AdditionalMetadata="HeatOutput=$(IntermediateOutputPath)_%(HarvestProject.Filename).wxs">
202 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
203 </CreateItem>
204
205
206 <CreateItem Include="@(HeatProject)" Condition= " '%(HeatProject.HeatOutput)' != '' ">
207 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
208 </CreateItem>
209 <CreateItem Include="@(HarvestProject)" Condition= " '%(HarvestProject.HeatOutput)' != '' ">
210 <Output TaskParameter="Include" ItemName="_AllHeatProjects" />
211 </CreateItem>
212
213 </Target>
214
215 <!--
216 ================================================================================================
217 HarvestProjects
218
219 Harvests outputs of other MSBuild projects files using the VS project extension to heat.exe.
220
221 [IN]
222 @(HarvestProject)
223 @(HeatProject)
224 - The list of projects to harvest. HeatProject is provided for backward compatibility.
225 You should use HarvestProject instead.
226
227 %(HarvestProject.Transforms)
228 %(HeatProject.Transforms)
229 - XSL transforms to apply to the harvested WiX.
230
231 %(HarvestProject.ProjectOutputGroups)
232 %(HeatProjects.ProjectOutputGroups)
233 - The project output groups to harvest
234
235 [OUT]
236 %(HeatOutput)
237 - The generated .wxs files which are added to the @(Compile) item list.
238 ================================================================================================
239 -->
240 <ItemDefinitionGroup>
241 <HeatProject>
242 <Transforms>$(HarvestProjectsTransforms)</Transforms>
243 <ProjectOutputGroups>$(HarvestProjectsProjectOutputGroups)</ProjectOutputGroups>
244 <DirectoryIds>$(HarvestProjectsDirectoryIds)</DirectoryIds>
245 </HeatProject>
246 <HarvestProject>
247 <Transforms>$(HarvestProjectsTransforms)</Transforms>
248 <ProjectOutputGroups>$(HarvestProjectsProjectOutputGroups)</ProjectOutputGroups>
249 <DirectoryIds>$(HarvestProjectsDirectoryIds)</DirectoryIds>
250 </HarvestProject>
251 </ItemDefinitionGroup>
252
253 <PropertyGroup>
254 <HarvestProjectsDependsOn>CombineHarvestProjects</HarvestProjectsDependsOn>
255 </PropertyGroup>
256 <Target Name="HarvestProjects"
257 DependsOnTargets="$(HarvestProjectsDependsOn)"
258 Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(MSBuildAllProjects);$(ProjectPath)"
259 Outputs="@(_AllHeatProjects -> '%(HeatOutput)')"
260 Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') ">
261
262 <HeatProject
263 NoLogo="$(HarvestProjectsNoLogo)"
264 SuppressAllWarnings="$(HarvestProjectsSuppressAllWarnings)"
265 SuppressSpecificWarnings="$(HarvestProjectsSuppressSpecificWarnings)"
266 ToolPath="$(WixToolPath)"
267 TreatWarningsAsErrors="$(HarvestProjectsTreatWarningsAsErrors)"
268 TreatSpecificWarningsAsErrors="$(HarvestProjectsTreatSpecificWarningsAsErrors)"
269 VerboseOutput="$(HarvestProjectsVerboseOutput)"
270 AutogenerateGuids="$(HarvestProjectsAutogenerateGuids)"
271 GenerateGuidsNow="$(HarvestProjectsGenerateGuidsNow)"
272 OutputFile="%(_AllHeatProjects.HeatOutput)"
273 SuppressFragments="$(HarvestProjectsSuppressFragments)"
274 SuppressUniqueIds="$(HarvestProjectsSuppressUniqueIds)"
275 Transforms="%(_AllHeatProjects.Transforms)"
276 Project="%(_AllHeatProjects.FullPath)"
277 ProjectOutputGroups="%(_AllHeatProjects.ProjectOutputGroups)"
278 GenerateType="%(_AllHeatProjects.GenerateType)"
279 DirectoryIds="%(_AllHeatProjects.DirectoryIds)"
280 ProjectName="%(_AllHeatProjects.ProjectName)"
281 Configuration="%(_AllHeatProjects.Configuration)"
282 Platform="%(_AllHeatProjects.Platform)"
283 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
284 GenerateWixVariables="$(HarvestProjectsGenerateWixVariables)"
285 AdditionalOptions="$(HarvestProjectsAdditionalOptions)">
286
287 <Output TaskParameter="OutputFile" ItemName="Compile" />
288 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
289
290 </HeatProject>
291
292 </Target>
293
294 <!--
295 ================================================================================================
296 HarvestDirectory
297
298 Harvests directories using heat.exe.
299
300 [IN]
301 @(HarvestDirectory) - The list of directories to harvest.
302 %(HarvestDirectory.Transforms) - XSL transforms to apply to the harvested WiX.
303 %(HarvestDirectory.ComponentGroupName) - The name of the ComponentGroup to create.
304 %(HarvestDirectory.DirectoryRefId) - The ID of the directory to reference instead of TARGETDIR.
305 %(HarvestDirectory.KeepEmptyDirectories) - Whether to create Directory entries for empty directories.
306 %(HarvestDirectory.PreprocessorVariable) - Substitute SourceDir for another variable name (ex: var.Dir).
307 %(HarvestDirectory.SuppressCom) - Suppress COM elements.
308 %(HarvestDirectory.SuppressRootDirectory) - Suppress a Directory element for the root directory.
309 $(HarvestDirectory.SuppressRegistry) - Suppress registry harvesting.
310
311 [OUT]
312 $(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs
313 - The generated .wxs files which are added to the @(Compile) item list.
314 ================================================================================================
315 -->
316
317 <ItemDefinitionGroup>
318 <HarvestDirectory>
319 <Transforms>$(HarvestDirectoryTransforms)</Transforms>
320 <ComponentGroupName>$(HarvestDirectoryComponentGroupName)</ComponentGroupName>
321 <DirectoryRefId>$(HarvestDirectoryDirectoryRefId)</DirectoryRefId>
322 <KeepEmptyDirectories>$(HarvestDirectoryKeepEmptyDirectories)</KeepEmptyDirectories>
323 <PreprocessorVariable>$(HarvestDirectoryPreprocessorVariable)</PreprocessorVariable>
324 <SuppressCom>$(HarvestDirectorySuppressCom)</SuppressCom>
325 <SuppressRootDirectory>$(HarvestDirectorySuppressRootDirectory)</SuppressRootDirectory>
326 <SuppressRegistry>$(HarvestDirectorySuppressRegistry)</SuppressRegistry>
327 </HarvestDirectory>
328 </ItemDefinitionGroup>
329
330 <PropertyGroup>
331 <HarvestDirectoryDependsOn>
332 GetHarvestDirectoryContent
333 </HarvestDirectoryDependsOn>
334 </PropertyGroup>
335
336 <!-- Creates items to include content since wildcards will not work in Target/@Inputs. -->
337 <Target Name="GetHarvestDirectoryContent">
338 <CreateItem Include="@(HarvestDirectory->'%(FullPath)\**\*')">
339 <Output TaskParameter="Include" ItemName="_HarvestDirectoryContent" />
340 </CreateItem>
341 </Target>
342
343 <Target Name="HarvestDirectory"
344 DependsOnTargets="$(HarvestDirectoryDependsOn)"
345 Inputs="@(_HarvestDirectoryContent);%(HarvestDirectory.Transforms)"
346 Outputs="$(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs"
347 Condition=" '@(HarvestDirectory)' != '' ">
348
349 <HeatDirectory
350 NoLogo="$(HarvestDirectoryNoLogo)"
351 SuppressAllWarnings="$(HarvestDirectorySuppressAllWarnings)"
352 SuppressSpecificWarnings="$(HarvestDirectorySuppressSpecificWarnings)"
353 ToolPath="$(WixToolPath)"
354 TreatWarningsAsErrors="$(HarvestDirectoryTreatWarningsAsErrors)"
355 TreatSpecificWarningsAsErrors="$(HarvestDirectoryTreatSpecificWarningsAsErrors)"
356 VerboseOutput="$(HarvestDirectoryVerboseOutput)"
357 AutogenerateGuids="$(HarvestDirectoryAutogenerateGuids)"
358 GenerateGuidsNow="$(HarvestDirectoryGenerateGuidsNow)"
359 OutputFile="$(IntermediateOutputPath)_%(HarvestDirectory.ComponentGroupName)_dir.wxs"
360 SuppressFragments="$(HarvestDirectorySuppressFragments)"
361 SuppressUniqueIds="$(HarvestDirectorySuppressUniqueIds)"
362 Transforms="%(HarvestDirectory.Transforms)"
363 Directory="@(HarvestDirectory)"
364 ComponentGroupName="%(HarvestDirectory.ComponentGroupName)"
365 DirectoryRefId="%(HarvestDirectory.DirectoryRefId)"
366 KeepEmptyDirectories="%(HarvestDirectory.KeepEmptyDirectories)"
367 PreprocessorVariable="%(HarvestDirectory.PreprocessorVariable)"
368 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
369 SuppressCom="%(HarvestDirectory.SuppressCom)"
370 SuppressRootDirectory="%(HarvestDirectory.SuppressRootDirectory)"
371 SuppressRegistry="%(HarvestDirectory.SuppressRegistry)"
372 AdditionalOptions="$(HarvestDirectoryAdditionalOptions)">
373
374 <Output TaskParameter="OutputFile" ItemName="Compile" />
375 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
376
377 </HeatDirectory>
378
379 </Target>
380
381 <!--
382 ================================================================================================
383 HarvestFile
384
385 Harvests files of different types using heat.exe. This can harvest registry from
386 self-registering files, files with typelibs, and more.
387
388 [IN]
389 @(HarvestFile) - The list of files to harvest.
390 %(HarvestFile.Transforms) - XSL transforms to apply to the harvested WiX.
391 %(HarvestFile.ComponentGroupName) - The name of the ComponentGroup to create.
392 %(HarvestFile.DirectoryRefId) - The ID of the directory to reference instead of TARGETDIR.
393 %(HarvestFile.PreprocessorVariable) - Substitute SourceDir for another variable name (ex: var.Dir).
394 %(HarvestFile.SuppressCom) - Suppress COM elements.
395 %(HarvestFile.SuppressRootDirectory) - Suppress a Directory element for the root directory.
396 $(HarvestFile.SuppressRegistry) - Suppress registry harvesting.
397
398 [OUT]
399 $(IntermediateOutputPath)_%(HarvestFile.Filename)_file.wxs
400 - The generated .wxs files which are added to the @(Compile) item list.
401 ================================================================================================
402 -->
403
404 <ItemDefinitionGroup>
405 <HarvestFile>
406 <Transforms>$(HarvestFileTransforms)</Transforms>
407 <ComponentGroupName>$(HarvestFileComponentGroupName)</ComponentGroupName>
408 <DirectoryRefId>$(HarvestFileDirectoryRefId)</DirectoryRefId>
409 <PreprocessorVariable>$(HarvestFilePreprocessorVariable)</PreprocessorVariable>
410 <SuppressCom>$(HarvestFileSuppressCom)</SuppressCom>
411 <SuppressRegistry>$(HarvestFileSuppressRegistry)</SuppressRegistry>
412 <SuppressRootDirectory>$(HarvestFileSuppressRootDirectory)</SuppressRootDirectory>
413 </HarvestFile>
414 </ItemDefinitionGroup>
415
416 <PropertyGroup>
417 <HarvestFileDependsOn></HarvestFileDependsOn>
418 </PropertyGroup>
419 <Target Name="HarvestFile"
420 DependsOnTargets="$(HarvestFileDependsOn)"
421 Inputs="@(HarvestFile);%(HarvestFile.Transforms)"
422 Outputs="$(IntermediateOutputPath)_%(HarvestFile.Filename)_file.wxs"
423 Condition=" '@(HarvestFile)' != '' ">
424
425 <HeatFile
426 NoLogo="$(HarvestFileNoLogo)"
427 SuppressAllWarnings="$(HarvestFileSuppressAllWarnings)"
428 SuppressSpecificWarnings="$(HarvestFileSuppressSpecificWarnings)"
429 ToolPath="$(WixToolPath)"
430 TreatWarningsAsErrors="$(HarvestFileTreatWarningsAsErrors)"
431 TreatSpecificWarningsAsErrors="$(HarvestFileTreatSpecificWarningsAsErrors)"
432 VerboseOutput="$(HarvestFileVerboseOutput)"
433 AutogenerateGuids="$(HarvestFileAutogenerateGuids)"
434 GenerateGuidsNow="$(HarvestFileGenerateGuidsNow)"
435 OutputFile="$(IntermediateOutputPath)_%(HarvestFile.Filename)_file.wxs"
436 SuppressFragments="$(HarvestFileSuppressFragments)"
437 SuppressUniqueIds="$(HarvestFileSuppressUniqueIds)"
438 Transforms="%(HarvestFile.Transforms)"
439 File="@(HarvestFile)"
440 ComponentGroupName="%(HarvestFile.ComponentGroupName)"
441 DirectoryRefId="%(HarvestFile.DirectoryRefId)"
442 PreprocessorVariable="%(HarvestFile.PreprocessorVariable)"
443 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
444 SuppressCom="%(HarvestFile.SuppressCom)"
445 SuppressRegistry="%(HarvestFile.SuppressRegistry)"
446 SuppressRootDirectory="%(HarvestFile.SuppressRootDirectory)"
447 AdditionalOptions="$(HarvestFileAdditionalOptions)">
448
449 <Output TaskParameter="OutputFile" ItemName="Compile" />
450 <Output TaskParameter="OutputFile" ItemName="FileWrites" />
451
452 </HeatFile>
453
454 </Target>
455
456 <!--
457 ================================================================================================
458 RefreshGeneratedFile
459
460 Generates code based on metadata defined in project references.
461
462 [IN]
463 @(_MSBuildResolvedProjectReferencePaths) - The list of MSBuildable project references.
464
465 [OUT]
466 @(_GeneratedFiles) - The generated source file.
467 ================================================================================================
468 -->
469 <PropertyGroup>
470 <RefreshGeneratedFileDependsOn></RefreshGeneratedFileDependsOn>
471 </PropertyGroup>
472 <Target Name="RefreshGeneratedFile"
473 DependsOnTargets="$(RefreshGeneratedFileDependsOn)"
474 Inputs="@(_MSBuildResolvedProjectReferencePaths);@(Compile);$(ProjectPath)"
475 Outputs="@(_GeneratedFiles)"
476 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module') and '@(_GeneratedFiles)' != '' ">
477
478 <RefreshGeneratedFile
479 GeneratedFiles="@(_GeneratedFiles)"
480 ProjectReferencePaths="@(_MSBuildResolvedProjectReferencePaths)" />
481
482 </Target>
483
484 <!--
485 ================================================================================================
486 RefreshBundleGeneratedFile
487
488 Generates code for bundle projects based on metadata defined in project references.
489
490 [IN]
491 @(_MSBuildResolvedProjectReferencePaths) - The list of MSBuildable project references.
492
493 [OUT]
494 @(_GeneratedFiles) - The generated source file.
495 ================================================================================================
496 -->
497 <PropertyGroup>
498 <RefreshBundleGeneratedFileDependsOn></RefreshBundleGeneratedFileDependsOn>
499 </PropertyGroup>
500 <Target Name="RefreshBundleGeneratedFile"
501 DependsOnTargets="$(RefreshBundleGeneratedFileDependsOn)"
502 Inputs="@(_MSBuildResolvedProjectReferencePaths);@(Compile);$(ProjectPath)"
503 Outputs="@(_GeneratedFiles)"
504 Condition=" $(EnableProjectHarvesting) and ('$(OutputType)' == 'Bundle' and '@(_GeneratedFiles)' != '') ">
505
506 <RefreshBundleGeneratedFile
507 GeneratedFiles="@(_GeneratedFiles)"
508 ProjectReferencePaths="@(_MSBuildResolvedProjectReferencePaths)" />
509 </Target>
510
511</Project>
diff --git a/src/WixToolset.BuildTasks/wix.signing.targets b/src/WixToolset.BuildTasks/wix.signing.targets
deleted file mode 100644
index 6351cc8b..00000000
--- a/src/WixToolset.BuildTasks/wix.signing.targets
+++ /dev/null
@@ -1,378 +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
7 <!-- These properties can be overridden to support non-default installations. -->
8 <PropertyGroup>
9 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileFullPath)</WixTargetsPath>
10 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixTargetsPath)WixTasks.dll</WixTasksPath>
11
12 <SignedFile Condition=" '$(SignedFile)' == '' ">$(MSBuildProjectFile).Signed.txt</SignedFile>
13 </PropertyGroup>
14
15 <UsingTask TaskName="Insignia" AssemblyFile="$(WixTasksPath)" />
16
17 <!-- Default Inscribe properties. -->
18 <PropertyGroup>
19 <InscribeNoLogo Condition=" '$(InscribeNoLogo)' == '' ">$(NoLogo)</InscribeNoLogo>
20 <InscribeSuppressAllWarnings Condition=" '$(InscribeSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</InscribeSuppressAllWarnings>
21 <InscribeSuppressSpecificWarnings Condition=" '$(InscribeSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</InscribeSuppressSpecificWarnings>
22 <InscribeTreatWarningsAsErrors Condition=" '$(InscribeTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</InscribeTreatWarningsAsErrors>
23 <InscribeTreatSpecificWarningsAsErrors Condition=" '$(InscribeTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</InscribeTreatSpecificWarningsAsErrors>
24 <InscribeVerboseOutput Condition=" '$(InscribeVerboseOutput)' == '' ">$(VerboseOutput)</InscribeVerboseOutput>
25 </PropertyGroup>
26
27 <!--
28 ==================================================================================================
29 Signing
30 ==================================================================================================
31 -->
32 <PropertyGroup>
33 <InternalSignDependsOn Condition=" '$(OutputType)' == 'Module' ">
34 GetMsmsToSign;
35 InternalSignMsm;
36 </InternalSignDependsOn>
37 <InternalSignDependsOn Condition=" '$(OutputType)' == 'Package' ">
38 GetCabsToSign;
39 GetMsiToSign;
40 InternalSignCabs;
41 InscribeMsi;
42 InternalSignMsi;
43 </InternalSignDependsOn>
44 <InternalSignDependsOn Condition=" '$(OutputType)' == 'Bundle' ">
45 GetContainersToSign;
46 InternalSignContainers;
47 InscribeBundleEngine;
48 InternalSignBundleEngine;
49 InscribeBundle;
50 InternalSignBundle;
51 </InternalSignDependsOn>
52
53 <SigningDependsOn>
54 CompileAndLink;
55 BeforeSigning;
56 $(InternalSignDependsOn);
57 AfterSigning
58 </SigningDependsOn>
59 </PropertyGroup>
60 <Target
61 Name="Signing"
62 DependsOnTargets="$(SigningDependsOn)"
63 Inputs="@(SignTargetPath)"
64 Outputs="$(IntermediateOutputPath)$(SignedFile)"
65 Condition=" '@(SignTargetPath)' != '' ">
66
67 <CreateItem Include="$(IntermediateOutputPath)$(SignedFile)">
68 <Output TaskParameter="Include" ItemName="FileWrites" />
69 </CreateItem>
70
71 <WriteLinesToFile
72 File="$(IntermediateOutputPath)$(SignedFile)"
73 Lines="^$(MSBuildProjectFullPath);@(SignMsm);@(SignCabs);@(SignMsi);@(SignContainers);@(SignBundleEngine);@(SignBundle)"
74 Overwrite="true" />
75 </Target>
76
77 <!-- Internal targets so correct signing targets are called. -->
78 <Target
79 Name="GetMsmsToSign"
80 Inputs="@(SignTargetPath)"
81 Outputs="$(IntermediateOutputPath)$(SignedFile)">
82 <CreateItem Include="@(SignTargetPath)">
83 <Output TaskParameter="Include" ItemName="SignMsm" />
84 <Output TaskParameter="Include" ItemName="FileWrites" />
85 </CreateItem>
86 </Target>
87
88 <Target
89 Name="InternalSignMsm"
90 DependsOnTargets="SignMsm"
91 Condition=" '@(SignMsm)' != '' " />
92
93 <Target
94 Name="GetCabsToSign"
95 Inputs="@(SignTargetPath)"
96 Outputs="$(IntermediateOutputPath)$(SignedFile)">
97 <GetCabList Database="%(SignTargetPath.FullPath)">
98 <Output TaskParameter="CabList" ItemName="SignCabs" />
99 <Output TaskParameter="CabList" ItemName="FileWrites" />
100 </GetCabList>
101 </Target>
102
103 <Target
104 Name="InternalSignCabs"
105 DependsOnTargets="SignCabs"
106 Condition=" '@(SignCabs)' != '' " />
107
108 <Target
109 Name="GetMsiToSign"
110 Inputs="@(SignTargetPath)"
111 Outputs="$(IntermediateOutputPath)$(SignedFile)">
112 <CreateItemAvoidingInference InputProperties="@(SignTargetPath)">
113 <Output TaskParameter="OuputItems" ItemName="SignMsi" />
114 <Output TaskParameter="OuputItems" ItemName="FileWrites" />
115 </CreateItemAvoidingInference>
116 </Target>
117
118 <Target
119 Name="InternalSignMsi"
120 DependsOnTargets="SignMsi"
121 Inputs="@(SignTargetPath)"
122 Outputs="$(IntermediateOutputPath)$(SignedFile)"
123 Condition=" '@(SignMsi)' != '' " />
124
125 <Target
126 Name="GetContainersToSign"
127 Inputs="@(SignTargetPath)"
128 Outputs="$(IntermediateOutputPath)$(SignedFile)">
129 <!-- TODO: implement signing detached containers -->
130 </Target>
131
132 <Target
133 Name="InternalSignContainers"
134 DependsOnTargets="SignContainers"
135 Condition=" '@(SignContainers)' != '' " />
136
137 <Target
138 Name="InternalSignBundleEngine"
139 DependsOnTargets="SignBundleEngine"
140 Condition=" '@(SignBundleEngine)' != '' " />
141
142 <Target
143 Name="InternalSignBundle"
144 DependsOnTargets="SignBundle"
145 Condition=" '@(SignBundle)' != '' " />
146
147 <!--
148 ================================================================================================
149 InscribeMsi
150
151 To be called after signing an MSI's cabs - inscribes an MSI with the digital signature of its
152 external cabs.
153
154 [IN/OUT]
155 @(SignTargetPath) - The database file to inscribe - database file will be modified in-place.
156
157 [OUT]
158 @(SignMsi) - The database file to sign.
159 ================================================================================================
160 -->
161 <PropertyGroup>
162 <InscribeMsiDependsOn>
163 PrepareForBuild;
164 ResolveWixExtensionReferences;
165 CompileAndLink;
166 InternalSignCabs
167 </InscribeMsiDependsOn>
168 </PropertyGroup>
169 <Target
170 Name="InscribeMsi"
171 DependsOnTargets="$(InscribeMsiDependsOn)"
172 Inputs="@(SignTargetPath)"
173 Outputs="$(IntermediateOutputPath)$(SignedFile)"
174 Condition=" '@(SignCabs)' != '' ">
175
176 <Insignia
177 DatabaseFile="%(SignTargetPath.FullPath)"
178 OutputFile="%(SignTargetPath.FullPath)"
179 ToolPath="$(WixToolPath)"
180 NoLogo="$(InscribeNoLogo)"
181 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
182 SuppressAllWarnings="$(InscribeSuppressAllWarnings)"
183 SuppressSpecificWarnings="$(InscribeSuppressSpecificWarnings)"
184 TreatWarningsAsErrors="$(InscribeTreatWarningsAsErrors)"
185 TreatSpecificWarningsAsErrors="$(InscribeTreatSpecificWarningsAsErrors)"
186 VerboseOutput="$(InscribeVerboseOutput)"
187 AdditionalOptions="$(InscribeAdditionalOptions)" />
188 </Target>
189
190 <!--
191 ================================================================================================
192 InscribeBundleEngine
193
194 To be called after signing a bundle's detached containers. Also removes attached container
195 so engine can be signed without attached container.
196
197 [IN]
198 @(SignTargetPath) - The bundle to inscribe.
199
200 [OUT]
201 @(SignBundleEngine) - The bundle engine file to be signed.
202 ================================================================================================
203 -->
204 <PropertyGroup>
205 <InscribeBundleEngineDependsOn>
206 PrepareForBuild;
207 ResolveWixExtensionReferences;
208 CompileAndLink;
209 InternalSignContainers
210 </InscribeBundleEngineDependsOn>
211 </PropertyGroup>
212 <Target
213 Name="InscribeBundleEngine"
214 DependsOnTargets="$(InscribeBundleEngineDependsOn)"
215 Inputs="@(SignTargetPath)"
216 Outputs="$(IntermediateOutputPath)$(SignedFile)">
217
218 <Insignia
219 BundleFile="@(SignTargetPath)"
220 OutputFile="$(IntermediateOutputPath)%(SignTargetPath.Filename)%(SignTargetPath.Extension)"
221 ToolPath="$(WixToolPath)"
222 NoLogo="$(InscribeNoLogo)"
223 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
224 SuppressAllWarnings="$(InscribeSuppressAllWarnings)"
225 SuppressSpecificWarnings="$(InscribeSuppressSpecificWarnings)"
226 TreatWarningsAsErrors="$(InscribeTreatWarningsAsErrors)"
227 TreatSpecificWarningsAsErrors="$(InscribeTreatSpecificWarningsAsErrors)"
228 VerboseOutput="$(InscribeVerboseOutput)"
229 AdditionalOptions="$(InscribeAdditionalOptions)">
230 <Output TaskParameter="Output" ItemName="SignBundleEngine" />
231 </Insignia>
232
233 <!-- Explicitly add output to FileWrites to ensure even when the target is up to date. -->
234 <CreateItem Include="$(IntermediateOutputPath)%(SignTargetPath.Filename)%(SignTargetPath.Extension)">
235 <Output TaskParameter="Include" ItemName="FileWrites" />
236 </CreateItem>
237
238 </Target>
239
240 <!--
241 ================================================================================================
242 InscribeBundle
243
244 To be called after signing the bundle engine to reattach the attached container.
245
246 [IN]
247 @(Inscribe) - The bundle to inscribe.
248
249 [OUT]
250 @(SignBundle) - The bundle engine file to be signed.
251 ================================================================================================
252 -->
253 <PropertyGroup>
254 <InscribeBundleDependsOn>
255 PrepareForBuild;
256 ResolveWixExtensionReferences;
257 CompileAndLink;
258 InternalSignBundleEngine
259 </InscribeBundleDependsOn>
260 </PropertyGroup>
261 <Target
262 Name="InscribeBundle"
263 DependsOnTargets="$(InscribeBundleDependsOn)"
264 Inputs="@(SignTargetPath)"
265 Outputs="$(IntermediateOutputPath)$(SignedFile)">
266
267 <Insignia
268 BundleFile="@(SignBundleEngine)"
269 OriginalBundleFile="@(SignTargetPath)"
270 OutputFile="@(SignTargetPath)"
271 ToolPath="$(WixToolPath)"
272 NoLogo="$(InscribeNoLogo)"
273 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
274 SuppressAllWarnings="$(InscribeSuppressAllWarnings)"
275 SuppressSpecificWarnings="$(InscribeSuppressSpecificWarnings)"
276 TreatWarningsAsErrors="$(InscribeTreatWarningsAsErrors)"
277 TreatSpecificWarningsAsErrors="$(InscribeTreatSpecificWarningsAsErrors)"
278 VerboseOutput="$(InscribeVerboseOutput)"
279 AdditionalOptions="$(InscribeAdditionalOptions)">
280 <Output TaskParameter="Output" ItemName="SignBundle" />
281 <Output TaskParameter="Output" ItemName="FileWrites" />
282 </Insignia>
283 </Target>
284
285 <!--
286 ==================================================================================================
287 BeforeSigning
288
289 Redefine this target in your project in order to run tasks just before all signing tasks.
290 ==================================================================================================
291 -->
292 <Target Name="BeforeSigning" />
293
294 <!--
295 ==================================================================================================
296 SignMsm
297
298 Redefine this target in your project in order to sign merge modules.
299
300 [IN]
301 @(SignMsm) - merge module files to sign.
302 ==================================================================================================
303 -->
304 <Target Name="SignMsm" />
305
306 <!--
307 ==================================================================================================
308 SignCabs
309
310 Redefine this target in your project in order to sign the cabs of your database.
311
312 [IN]
313 @(SignCabs) - cabinet files to sign.
314 ==================================================================================================
315 -->
316 <Target Name="SignCabs" />
317
318 <!--
319 ==================================================================================================
320 SignMsi
321
322 Redefine this target in your project in order to sign your database, after it has been inscribed
323 with the signatures of your signed cabs.
324
325 [IN]
326 @(SignMsi) - database files to sign.
327 ==================================================================================================
328 -->
329 <Target Name="SignMsi" />
330
331 <!--
332 ==================================================================================================
333 SignContainers
334
335 Redefine this target in your project in order to sign your bundle's detached containers.
336
337 [IN]
338 @(SignContainers) - detached container files to sign.
339 ==================================================================================================
340 -->
341 <Target Name="SignContainers" />
342
343 <!--
344 ==================================================================================================
345 SignBundleEngine
346
347 Redefine this target in your project in order to sign your bundle, after it has been inscribed
348 with the signatures of your signed containers.
349
350 [IN]
351 @(SignBundleEngine) - bundle engine file to sign.
352 ==================================================================================================
353 -->
354 <Target Name="SignBundleEngine" />
355
356 <!--
357 ==================================================================================================
358 SignBundle
359
360 Redefine this target in your project in order to sign your bundle, after the attached container
361 is reattached.
362
363 [IN]
364 @(SignBundle) - bundle file to sign.
365 ==================================================================================================
366 -->
367 <Target Name="SignBundle" />
368
369 <!--
370 ==================================================================================================
371 AfterSigning
372
373 Redefine this target in your project in order to run tasks just after all signing tasks.
374 ==================================================================================================
375 -->
376 <Target Name="AfterSigning" />
377
378</Project>
diff --git a/src/WixToolset.BuildTasks/wix.targets b/src/WixToolset.BuildTasks/wix.targets
deleted file mode 100644
index c9704094..00000000
--- a/src/WixToolset.BuildTasks/wix.targets
+++ /dev/null
@@ -1,1356 +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" InitialTargets="_CheckRequiredProperties" DefaultTargets="Build">
6 <PropertyGroup>
7 <WixTargetsImported>true</WixTargetsImported>
8 </PropertyGroup>
9
10 <!--
11 //////////////////////////////////////////////////////////////////////////////////////////////////
12 //////////////////////////////////////////////////////////////////////////////////////////////////
13 Extension Points
14 //////////////////////////////////////////////////////////////////////////////////////////////////
15 //////////////////////////////////////////////////////////////////////////////////////////////////
16 -->
17
18 <!-- Allow a user-customized targets files to be used as part of the build. -->
19 <Import Project="$(CustomBeforeWixTargets)" Condition=" '$(CustomBeforeWixTargets)' != '' and Exists('$(CustomBeforeWixTargets)')" />
20
21 <!-- These properties can be overridden to support non-default installations. -->
22 <PropertyGroup>
23 <WixBinDir Condition=" '$(WixBinDir)' == ''">$(MSBuildThisFileDirectory)</WixBinDir>
24 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixBinDir)WixToolset.BuildTasks.dll</WixTasksPath>
25 <WixHarvestTargetsPath Condition=" '$(WixHarvestTargetsPath)' == '' ">$(WixBinDir)wix.harvest.targets</WixHarvestTargetsPath>
26 <WixSigningTargetsPath Condition=" '$(WixSigningTargetsPath)' == '' ">$(WixBinDir)wix.signing.targets</WixSigningTargetsPath>
27 <LuxTargetsPath Condition=" '$(LuxTargetsPath)' == '' ">$(WixBinDir)lux.targets</LuxTargetsPath>
28 <LuxTasksPath Condition=" '$(LuxTasksPath)' == '' ">$(WixBinDir)LuxTasks.dll</LuxTasksPath>
29 </PropertyGroup>
30
31 <!-- This makes the project files a dependency of all targets so that things rebuild if they change -->
32 <PropertyGroup>
33 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
34 <MSBuildAllProjects Condition="Exists('$(WixHarvestTargetsPath)')">$(MSBuildAllProjects);$(WixHarvestTargetsPath)</MSBuildAllProjects>
35 <MSBuildAllProjects Condition="Exists('$(WixSigningTargetsPath)')">$(MSBuildAllProjects);$(WixSigningTargetsPath)</MSBuildAllProjects>
36 <MSBuildAllProjects Condition="Exists('$(LuxTargetsPath)')">$(MSBuildAllProjects);$(LuxTargetsPath)</MSBuildAllProjects>
37 <MSBuildAllProjects Condition="Exists('$(CustomBeforeWixTargets)')">$(MSBuildAllProjects);$(CustomBeforeWixTargets)</MSBuildAllProjects>
38 <MSBuildAllProjects Condition="Exists('$(CustomAfterWixTargets)')">$(MSBuildAllProjects);$(CustomAfterWixTargets)</MSBuildAllProjects>
39 </PropertyGroup>
40
41 <!--
42 //////////////////////////////////////////////////////////////////////////////////////////////////
43 //////////////////////////////////////////////////////////////////////////////////////////////////
44 Declarations for Microsoft.Common.targets
45 //////////////////////////////////////////////////////////////////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////////////////////////////
47 -->
48
49 <PropertyGroup>
50 <DefaultLanguageSourceExtension>.wxs</DefaultLanguageSourceExtension>
51 <Language>wix</Language>
52 <TargetRuntime>Managed</TargetRuntime>
53
54 <!-- Use OutputName to set the AssemblyName for Microsoft.Common.targets -->
55 <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName>
56 <AssemblyName>$(OutputName)</AssemblyName>
57
58 <!-- Default the OutputType to a known WiX toolset TYPE. -->
59 <_OriginalOutputType>$(OutputType)</_OriginalOutputType>
60 <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
61 </PropertyGroup>
62
63 <!--
64 IDE Macros available from both integrated builds and from command line builds.
65 The following properties are 'macros' that are available via IDE for pre and post build steps.
66 All of them should be added to WixBuildMacroCollection to ensure that they are shown in the UI.
67 -->
68 <PropertyGroup>
69 <TargetExt Condition=" '$(OutputType)' == 'Package' ">.msi</TargetExt>
70 <TargetExt Condition=" '$(OutputType)' == 'Module' ">.msm</TargetExt>
71 <TargetExt Condition=" '$(OutputType)' == 'PatchCreation' ">.pcp</TargetExt>
72 <TargetExt Condition=" '$(OutputType)' == 'Library' ">.wixlib</TargetExt>
73 <TargetExt Condition=" '$(OutputType)' == 'Bundle' ">.exe</TargetExt>
74 </PropertyGroup>
75
76 <!-- Provide the correct output name for the .wixpdb -->
77 <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true'">
78 <_DebugSymbolsIntermediatePath Include="$(PdbOutputDir)$(TargetPdbName)" Condition=" '@(_DebugSymbolsIntermediatePath)' == '' " />
79 </ItemGroup>
80
81 <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
82
83 <PropertyGroup>
84 <!-- Default pdb output path to the intermediate output directory -->
85 <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(IntermediateOutputPath)</PdbOutputDir>
86 <PdbOutputDir Condition=" '$(PdbOutputDir)' != '' and !HasTrailingSlash('$(PdbOutputDir)') ">$(PdbOutputDir)\</PdbOutputDir>
87
88 <!-- Example, C:\MyProjects\MyProject\bin\debug\ -->
89 <TargetPdbDir Condition=" '$(PdbOutputDir)'!='' ">$([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`))</TargetPdbDir>
90
91 <!-- Example, MySetup.wixpdb" -->
92 <TargetPdbName Condition=" '$(TargetPdbName)' == '' ">$(TargetName).wixpdb</TargetPdbName>
93
94 <!-- Example, C:\MyProjects\MyProject\bin\debug\MyPackage.wixpdb -->
95 <TargetPdbPath Condition=" '$(TargetPdbPath)' == '' ">$(TargetPdbDir)$(TargetPdbName)</TargetPdbPath>
96 </PropertyGroup>
97
98 <!--
99 //////////////////////////////////////////////////////////////////////////////////////////////////
100 //////////////////////////////////////////////////////////////////////////////////////////////////
101 Property Declarations
102 //////////////////////////////////////////////////////////////////////////////////////////////////
103 //////////////////////////////////////////////////////////////////////////////////////////////////
104 -->
105
106 <!-- These tasks can be used as general-purpose build tasks. -->
107 <UsingTask TaskName="Candle" AssemblyFile="$(WixTasksPath)" />
108 <UsingTask TaskName="DoIt" AssemblyFile="$(WixTasksPath)" />
109 <UsingTask TaskName="Lit" AssemblyFile="$(WixTasksPath)" />
110 <UsingTask TaskName="Light" AssemblyFile="$(WixTasksPath)" />
111 <UsingTask TaskName="Torch" AssemblyFile="$(WixTasksPath)" />
112
113 <!-- These tasks are specific to the build process defined in this file, and are not considered general-purpose build tasks. -->
114 <UsingTask TaskName="CreateItemAvoidingInference" AssemblyFile="$(WixTasksPath)" />
115 <UsingTask TaskName="CreateProjectReferenceDefineConstants" AssemblyFile="$(WixTasksPath)" />
116 <UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" />
117 <UsingTask TaskName="ResolveWixReferences" AssemblyFile="$(WixTasksPath)"/>
118 <UsingTask TaskName="ReplaceString" AssemblyFile="$(WixTasksPath)"/>
119 <UsingTask TaskName="GetCabList" AssemblyFile="$(WixTasksPath)" />
120 <UsingTask TaskName="GetLooseFileList" AssemblyFile="$(WixTasksPath)" />
121 <UsingTask TaskName="GenerateCompileWithObjectPath" AssemblyFile="$(WixTasksPath)"/>
122
123 <!-- WiX tools are 32bit EXEs, so run them out-of-proc when MSBuild is not 32bit. -->
124 <PropertyGroup>
125 <RunWixToolsOutOfProc Condition=" '$(PROCESSOR_ARCHITECTURE)'!='x86' ">true</RunWixToolsOutOfProc>
126 </PropertyGroup>
127
128 <PropertyGroup>
129 <BindContentsFile Condition=" '$(BindContentsFile)' == '' ">$(MSBuildProjectFile).BindContentsFileList.txt</BindContentsFile>
130 <BindOutputsFile Condition=" '$(BindOutputsFile)' == '' ">$(MSBuildProjectFile).BindOutputsFileList.txt</BindOutputsFile>
131 <BindBuiltOutputsFile Condition=" '$(BindBuiltOutputsFile)' == '' ">$(MSBuildProjectFile).BindBuiltOutputsFileList.txt</BindBuiltOutputsFile>
132 </PropertyGroup>
133
134 <PropertyGroup>
135 <CabinetCachePath Condition=" '$(CabinetCachePath)'=='' and '$(ReuseCabinetCache)'=='true' ">$(IntermediateOutputPath)cabcache\</CabinetCachePath>
136 </PropertyGroup>
137
138 <PropertyGroup>
139 <WixToolDir Condition=" '$(WixToolDir)' == ''">$(WixBinDir)</WixToolDir>
140 <WixExtDir Condition=" '$(WixExtDir)' == ''">$(WixToolDir)</WixExtDir>
141 </PropertyGroup>
142
143 <!--
144 Set the SignTargetPath item directly when output is a Bundle. The AssignCultures target
145 sets SignTargetPath item for other output types based on the cultures provided.
146 -->
147 <ItemGroup>
148 <SignTargetPath Include="$(TargetPath)" Condition=" '$(OutputType)' == 'Bundle' AND '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' " />
149 </ItemGroup>
150
151 <!--
152 //////////////////////////////////////////////////////////////////////////////////////////////////
153 //////////////////////////////////////////////////////////////////////////////////////////////////
154 Default Compiler, Linker, and Librarian Property Declarations
155 //////////////////////////////////////////////////////////////////////////////////////////////////
156 //////////////////////////////////////////////////////////////////////////////////////////////////
157 -->
158
159 <!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup -->
160 <ItemGroup>
161 <WixExtension Include="$(WixExtension)" Condition=" '$(WixExtension)' != '' " />
162 </ItemGroup>
163
164 <!-- Defaut Compiler properties. -->
165 <PropertyGroup>
166 <CompilerNoLogo Condition=" '$(CompilerNoLogo)' == '' ">$(NoLogo)</CompilerNoLogo>
167 <CompilerSuppressAllWarnings Condition=" '$(CompilerSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</CompilerSuppressAllWarnings>
168 <CompilerSuppressSpecificWarnings Condition=" '$(CompilerSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</CompilerSuppressSpecificWarnings>
169 <CompilerTreatWarningsAsErrors Condition=" '$(CompilerTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</CompilerTreatWarningsAsErrors>
170 <CompilerTreatSpecificWarningsAsErrors Condition=" '$(CompilerTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</CompilerTreatSpecificWarningsAsErrors>
171 <CompilerVerboseOutput Condition=" '$(CompilerVerboseOutput)' == '' ">$(VerboseOutput)</CompilerVerboseOutput>
172 <!-- TODO: This probably doesn't work any longer since Platform won't be defined until Microsoft.Common.targets is included -->
173 <InstallerPlatform Condition=" '$(InstallerPlatform)' == '' and '$(Platform)' != 'AnyCPU' and '$(Platform)' != 'Any CPU' ">$(Platform)</InstallerPlatform>
174 </PropertyGroup>
175
176 <!-- Default Lib properties. -->
177 <PropertyGroup>
178 <LibNoLogo Condition=" '$(LibNoLogo)' == '' ">$(NoLogo)</LibNoLogo>
179 <LibBindFiles Condition=" '$(LibBindFiles)' == '' ">$(BindFiles)</LibBindFiles>
180 <LibPedantic Condition=" '$(LibPedantic)' == '' ">$(Pedantic)</LibPedantic>
181 <LibSuppressAllWarnings Condition=" '$(LibSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</LibSuppressAllWarnings>
182 <LibSuppressSpecificWarnings Condition=" '$(LibSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</LibSuppressSpecificWarnings>
183 <LibSuppressSchemaValidation Condition=" '$(LibSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LibSuppressSchemaValidation>
184 <LibSuppressIntermediateFileVersionMatching Condition=" '$(LibSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LibSuppressIntermediateFileVersionMatching>
185 <LibTreatWarningsAsErrors Condition=" '$(LibTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LibTreatWarningsAsErrors>
186 <LibTreatSpecificWarningsAsErrors Condition=" '$(LibTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</LibTreatSpecificWarningsAsErrors>
187 <LibVerboseOutput Condition=" '$(LibVerboseOutput)' == '' ">$(VerboseOutput)</LibVerboseOutput>
188 </PropertyGroup>
189
190 <!-- Default Linker properties. -->
191 <PropertyGroup>
192 <LinkerNoLogo Condition=" '$(LinkerNoLogo)' == '' ">$(NoLogo)</LinkerNoLogo>
193 <LinkerBindFiles Condition=" '$(LinkerBindFiles)' == '' ">$(BindFiles)</LinkerBindFiles>
194 <LinkerPedantic Condition=" '$(LinkerPedantic)' == '' ">$(Pedantic)</LinkerPedantic>
195 <LinkerSuppressAllWarnings Condition=" '$(LinkerSuppressAllWarnings)' == '' ">$(SuppressAllWarnings)</LinkerSuppressAllWarnings>
196 <LinkerSuppressSpecificWarnings Condition=" '$(LinkerSuppressSpecificWarnings)' == '' ">$(SuppressSpecificWarnings)</LinkerSuppressSpecificWarnings>
197 <LinkerSuppressSchemaValidation Condition=" '$(LinkerSuppressSchemaValidation)' == '' ">$(SuppressSchemaValidation)</LinkerSuppressSchemaValidation>
198 <LinkerSuppressIntermediateFileVersionMatching Condition=" '$(LinkerSuppressIntermediateFileVersionMatching)' == '' ">$(SuppressIntermediateFileVersionMatching)</LinkerSuppressIntermediateFileVersionMatching>
199 <LinkerTreatWarningsAsErrors Condition=" '$(LinkerTreatWarningsAsErrors)' == '' ">$(TreatWarningsAsErrors)</LinkerTreatWarningsAsErrors>
200 <LinkerTreatSpecificWarningsAsErrors Condition=" '$(LinkerTreatSpecificWarningsAsErrors)' == '' ">$(TreatSpecificWarningsAsErrors)</LinkerTreatSpecificWarningsAsErrors>
201 <LinkerVerboseOutput Condition=" '$(LinkerVerboseOutput)' == '' ">$(VerboseOutput)</LinkerVerboseOutput>
202 </PropertyGroup>
203
204 <!-- If BindInputPaths (or LinkerBindInputPaths) was passed in via the command line, then convert it to an ItemGroup -->
205 <ItemGroup>
206 <BindInputPaths Include="$(BindInputPaths)" Condition=" '$(BindInputPaths)' != '' " />
207 <LinkerBindInputPaths Include="$(LinkerBindInputPaths)" Condition=" '$(LinkerBindInputPaths)' != '' " />
208 </ItemGroup>
209
210 <!-- Default Lit and Light "properties" -->
211 <ItemGroup>
212 <LinkerBindInputPaths Condition=" '@(LinkerBindInputPaths)' == '' " Include="@(BindInputPaths)" />
213 </ItemGroup>
214
215 <!--
216 //////////////////////////////////////////////////////////////////////////////////////////////////
217 //////////////////////////////////////////////////////////////////////////////////////////////////
218 Initial Targets
219 //////////////////////////////////////////////////////////////////////////////////////////////////
220 //////////////////////////////////////////////////////////////////////////////////////////////////
221 -->
222
223 <!--
224 ==================================================================================================
225 _CheckRequiredProperties
226
227 Checks properties that must be set in the main project file or on the command line before
228 using this .TARGETS file.
229
230 [IN]
231 $(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension)
232 $(OutputType) - Possible values are 'package', 'PatchCreation', 'module', 'library', 'bundle'
233 ==================================================================================================
234 -->
235 <PropertyGroup>
236 <_PleaseSetThisInProjectFile>Please set this in the project file before the &lt;Import&gt; of the wix.targets file.</_PleaseSetThisInProjectFile>
237 <_OutputTypeDescription>The OutputType defines whether a Windows Installer package (.msi), PatchCreation (.pcp), merge module (.msm), wix library (.wixlib), or self-extracting executable (.exe) is being built. $(_PleaseSetThisInProjectFile) Possible values are 'Package', 'Module', 'Library', and 'Bundle'.</_OutputTypeDescription>
238 </PropertyGroup>
239 <Target Name="_CheckRequiredProperties">
240
241 <Error
242 Code="WIXTARGETS100"
243 Condition=" '$(OutputName)' == '' "
244 Text="The OutputName property is not set in project &quot;$(MSBuildProjectFile)&quot;. The OutputName defines the name of the output without a file extension. $(_PleaseSetThisInProjectFile)" />
245
246 <Warning
247 Code="WIXTARGETS101"
248 Condition=" '$(_OriginalOutputType)' == '' "
249 Text="The OutputType property is not set in project &quot;$(MSBuildProjectFile)&quot;. Defaulting to '$(OutputType)'. $(_OutputTypeDescription)" />
250
251 <Error
252 Code="WIXTARGETS102"
253 Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'PatchCreation' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' and '$(OutputType)' != 'Bundle' "
254 Text="The OutputType property '$(OutputType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. $(_OutputTypeDescription)" />
255
256 <Error
257 Code="WIXTARGETS103"
258 Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' &lt; '4.0' "
259 Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project &quot;$(MSBuildProjectFile)&quot;. You must use MSBuild v4.0 or later." />
260
261 </Target>
262
263 <!--
264 //////////////////////////////////////////////////////////////////////////////////////////////////
265 //////////////////////////////////////////////////////////////////////////////////////////////////
266 Build Targets
267 //////////////////////////////////////////////////////////////////////////////////////////////////
268 //////////////////////////////////////////////////////////////////////////////////////////////////
269 -->
270
271 <!--
272 ==================================================================================================
273 CoreBuild - OVERRIDE DependsOn
274
275 The core build step calls each of the build targets.
276
277 This is where we insert our targets into the build process.
278 ==================================================================================================
279 -->
280 <PropertyGroup>
281 <CoreBuildDependsOn>
282 BuildOnlySettings;
283 PrepareForBuild;
284 PreBuildEvent;
285 ResolveReferences;
286
287 <!--CompileAndLink;-->
288 DoIt;
289 Signing;
290
291 GetTargetPath;
292 PrepareForRun;
293 IncrementalClean;
294 PostBuildEvent
295 </CoreBuildDependsOn>
296 </PropertyGroup>
297
298
299 <!--
300 //////////////////////////////////////////////////////////////////////////////////////////////////
301 //////////////////////////////////////////////////////////////////////////////////////////////////
302 Resolve References Targets
303 //////////////////////////////////////////////////////////////////////////////////////////////////
304 //////////////////////////////////////////////////////////////////////////////////////////////////
305 -->
306
307 <!--
308 ==================================================================================================
309 ResolveReferences - OVERRIDE DependsOn
310
311 ==================================================================================================
312 -->
313 <PropertyGroup>
314 <ResolveReferencesDependsOn>
315 BeforeResolveReferences;
316 AssignProjectConfiguration;
317 ResolveProjectReferences;
318 ResolveWixLibraryReferences;
319 ResolveWixExtensionReferences;
320 AfterResolveReferences
321 </ResolveReferencesDependsOn>
322 </PropertyGroup>
323
324 <!--
325 ================================================================================================
326 ResolveProjectReferences
327
328 Builds all of the referenced projects to get their outputs.
329
330 [IN]
331 @(NonVCProjectReference) - The list of non-VC project references.
332
333 [OUT]
334 @(ProjectReferenceWithConfiguration) - The list of non-VC project references.
335 @(WixLibProjects) - Paths to any .wixlibs that were built by referenced projects.
336 ================================================================================================
337 -->
338 <Target
339 Name="ResolveProjectReferences"
340 DependsOnTargets="AssignProjectConfiguration;_SplitProjectReferencesByFileExistence"
341 Condition=" '@(ProjectReferenceWithConfiguration)' != '' ">
342
343 <!-- Issue a warning for each non-existent project. -->
344 <Warning
345 Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
346 Condition=" '@(_MSBuildProjectReferenceNonexistent)' != '' " />
347
348 <!--
349 When building this project from the IDE or when building a .sln from the command line or
350 when only building .wixlib project references, gather the referenced build outputs. The
351 code that builds the .sln will already have built the project, so there's no need to do
352 it again here and when building only .wixlib project references we'll use the results to
353 determine which projects to build.
354
355 The ContinueOnError setting is here so that, during project load, as much information as
356 possible will be passed to the compilers.
357 -->
358 <MSBuild
359 Projects="@(_MSBuildProjectReferenceExistent)"
360 Targets="%(_MSBuildProjectReferenceExistent.Targets);GetTargetPath"
361 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
362 Condition="('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '@(_MSBuildProjectReferenceExistent)' != '' "
363 ContinueOnError="!$(BuildingProject)">
364
365 <Output TaskParameter="TargetOutputs" ItemName="_GatheredProjectReferencePaths" />
366 </MSBuild>
367
368 <!--
369 Determine which project references should be built. Note: we will not build any project references
370 if building in the IDE because it builds project references directly.
371
372 If BuildProjectReferences is 'true' (the default) then take all MSBuild project references that exist
373 on disk and add them to the list of things to build. This is the easy case.
374 -->
375 <CreateItem
376 Include="@(_MSBuildProjectReferenceExistent)"
377 Condition=" '$(BuildProjectReferences)' == 'true' and '$(BuildingInsideVisualStudio)' != 'true' ">
378
379 <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
380 </CreateItem>
381
382 <!--
383 If BuildProjectReferences is 'wixlib' then build only the MSBuild project references that exist and
384 create a .wixlib file. That requires us to first filter the gathered project references down to only
385 those that build .wixlibs.
386 -->
387 <CreateItem
388 Include="@(_GatheredProjectReferencePaths)"
389 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '%(Extension)' == '.wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
390
391 <Output TaskParameter="Include" ItemName="_ReferencedWixLibPaths" />
392 </CreateItem>
393
394 <!--
395 The second step when building only 'wixlib' project references is to create the list of existing MSBuild
396 project references that do *not* build a .wixlib. These are the projects that will be skipped.
397 -->
398 <CreateItem
399 Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
400 Exclude="@(_ReferencedWixLibPaths->'%(MSBuildSourceProjectFile)')"
401 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
402
403 <Output TaskParameter="Include" ItemName="_ProjectReferencesToSkip" />
404 </CreateItem>
405
406 <!--
407 Finally, when building only 'wixlib' project references, the list of projects to build are naturally the
408 list of projects *not* being skipped.
409 -->
410 <CreateItem
411 Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
412 Exclude="@(_ProjectReferencesToSkip)"
413 Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
414
415 <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
416 </CreateItem>
417
418 <!-- Display a warning for all projects being skipped. -->
419 <Warning
420 Text="BuildProjectReferences set to '$(BuildProjectReferences)'. Skipping the non-Library project: %(_ProjectReferencesToSkip.Identity)"
421 Condition=" '@(_ProjectReferencesToSkip)' != '' " />
422
423 <Message
424 Importance="low"
425 Text="Project reference to build: %(_ProjectReferencesToBuild.Identity), properties: %(_ProjectReferencesToBuild.Properties)"
426 Condition=" '@(_ProjectReferencesToBuild)' != '' " />
427
428 <!--
429 Build referenced projects when building from the command line.
430
431 The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default target
432 is used during a P2P reference. However if a custom build process requires that the referenced
433 project has a different target to build it can be specified.
434 -->
435 <MSBuild
436 Projects="@(_ProjectReferencesToBuild)"
437 Targets="$(ProjectReferenceBuildTargets)"
438 Properties="%(_ProjectReferencesToBuild.SetConfiguration);%(_ProjectReferencesToBuild.SetPlatform)"
439 Condition=" '@(_ProjectReferencesToBuild)' != '' ">
440
441 <Output TaskParameter="TargetOutputs" ItemName="_BuiltProjectReferencePaths" />
442 </MSBuild>
443
444 <!--
445 VC project references must build GetNativeTargetPath because neither GetTargetPath nor the return of the default build
446 target return the output for a native .vcxproj.
447 -->
448 <MSBuild
449 Projects="@(_MSBuildProjectReferenceExistent)"
450 Targets="GetNativeTargetPath"
451 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
452 Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' ">
453
454 <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" />
455 <Output TaskParameter="TargetOutputs" ItemName="_MSBuildResolvedProjectReferencePaths" />
456 </MSBuild>
457
458 <!-- Assign the unique gathered and built project references to the resolved project
459 reference paths. -->
460 <RemoveDuplicates Inputs="@(_GatheredProjectReferencePaths);@(_BuiltProjectReferencePaths)">
461 <Output TaskParameter="Filtered" ItemName="_ResolvedProjectReferencePaths" />
462 <Output TaskParameter="Filtered" ItemName="_MSBuildResolvedProjectReferencePaths" />
463 </RemoveDuplicates>
464
465 <!-- Create list of all .wixlib project references. -->
466 <CreateItem
467 Include="@(_ResolvedProjectReferencePaths)"
468 Condition=" '%(Extension)' == '.wixlib' ">
469
470 <Output TaskParameter="Include" ItemName="WixLibProjects" />
471 </CreateItem>
472
473 <Message
474 Importance="low"
475 Text="Library from referenced projects: %(WixLibProjects.Identity)"
476 Condition=" '@(WixLibProjects)' != '' " />
477
478 </Target>
479
480 <!--
481 ================================================================================================
482 ResolveWixLibraryReferences
483
484 Resolve the library references to full paths.
485
486 [IN]
487 @(WixLibrary) - The list of .wixlib files.
488
489 [OUT]
490 @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries
491 ================================================================================================
492 -->
493 <PropertyGroup>
494 <ResolveWixLibraryReferencesDependsOn></ResolveWixLibraryReferencesDependsOn>
495 </PropertyGroup>
496 <Target
497 Name="ResolveWixLibraryReferences"
498 DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)"
499 Condition=" '@(WixLibrary)' != ''">
500
501 <!--
502 The WixLibrarySearchPaths property is set to find assemblies in the following order:
503
504 (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
505 (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
506 (3) Treat the reference's Include as if it were a real file name.
507 (4) Path specified by the WixExtDir property.
508 -->
509 <CreateProperty Condition=" '$(WixLibrarySearchPaths)' == '' " Value="
510 $(ReferencePaths);
511 {HintPathFromItem};
512 {RawFileName};
513 $(WixExtDir)
514 ">
515 <Output TaskParameter="Value" PropertyName="WixLibrarySearchPaths" />
516 </CreateProperty>
517
518 <ResolveWixReferences
519 WixReferences="@(WixLibrary)"
520 SearchPaths="$(WixLibrarySearchPaths)"
521 SearchFilenameExtensions=".wixlib">
522 <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixLibraryPaths" />
523 </ResolveWixReferences>
524
525 <!-- Remove duplicate library items that would cause build errors -->
526 <RemoveDuplicates Inputs="@(_AllResolvedWixLibraryPaths)">
527 <Output TaskParameter="Filtered" ItemName="_ResolvedWixLibraryPaths" />
528 </RemoveDuplicates>
529
530 </Target>
531
532 <!--
533 ==================================================================================================
534 ResolveWixExtensionReferences
535
536 Resolves WiX extension references to full paths. Any properties you use
537 to resolve paths to extensions must be defined before importing this
538 file or the extensions will be automatically resolved to $(WixExtDir).
539
540 [IN]
541 @(WixExtension) - WixExtension item group
542
543 [OUT]
544 @(_ResolvedWixExtensionPaths) - Item group with full paths to extensions
545 ==================================================================================================
546 -->
547 <PropertyGroup>
548 <ResolveWixExtensionReferencesDependsOn></ResolveWixExtensionReferencesDependsOn>
549 </PropertyGroup>
550 <Target
551 Name="ResolveWixExtensionReferences"
552 DependsOnTargets="$(ResolveWixExtensionReferencesDependsOn)"
553 Condition=" '@(WixExtension)' != ''">
554
555 <!--
556 The WixExtensionSearchPaths property is set to find assemblies in the following order:
557
558 (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
559 (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
560 (3) Treat the reference's Include as if it were a real file name.
561 (4) Path specified by the WixExtDir property.
562 -->
563 <CreateProperty Condition=" '$(WixExtensionSearchPaths)' == '' " Value="
564 $(ReferencePaths);
565 {HintPathFromItem};
566 {RawFileName};
567 $(WixExtDir)
568 ">
569 <Output TaskParameter="Value" PropertyName="WixExtensionSearchPaths" />
570 </CreateProperty>
571
572 <ResolveWixReferences
573 WixReferences="@(WixExtension)"
574 SearchPaths="$(WixExtensionSearchPaths)"
575 SearchFilenameExtensions=".dll">
576 <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixExtensionPaths" />
577 </ResolveWixReferences>
578
579 <!-- Remove duplicate extension items that would cause build errors -->
580 <RemoveDuplicates Inputs="@(_AllResolvedWixExtensionPaths)">
581 <Output TaskParameter="Filtered" ItemName="_ResolvedWixExtensionPaths" />
582 </RemoveDuplicates>
583 </Target>
584
585 <!--
586 ================================================================================================
587 GetTargetPath - OVERRIDE DependsOn
588
589 This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be
590 produced if we built this project.
591 ================================================================================================
592 -->
593 <PropertyGroup>
594 <GetTargetPathDependsOn>AssignCultures</GetTargetPathDependsOn>
595 </PropertyGroup>
596
597
598 <!--
599 //////////////////////////////////////////////////////////////////////////////////////////////////
600 //////////////////////////////////////////////////////////////////////////////////////////////////
601 DoIt Targets
602 //////////////////////////////////////////////////////////////////////////////////////////////////
603 //////////////////////////////////////////////////////////////////////////////////////////////////
604 -->
605
606 <!--
607 ==================================================================================================
608 DoIt
609 ==================================================================================================
610 -->
611 <PropertyGroup>
612 <DoItDependsOn>
613 PrepareForBuild;
614 ResolveReferences;
615 BeforeCompile;
616 _TimeStampBeforeCompile;
617 Harvest;
618
619 CalculateDefineConstants;
620 GenerateCompileWithObjectPath;
621
622 AssignCultures;
623 ReadPreviousBindInputsAndBuiltOutputs;
624
625 ActuallyDoIt;
626
627 UpdateLinkFileWrites;
628 _TimeStampAfterCompile;
629 AfterCompile
630 </DoItDependsOn>
631 </PropertyGroup>
632 <Target
633 Name="DoIt"
634 DependsOnTargets="$(DoItDependsOn)" />
635
636 <Target
637 Name="ActuallyDoIt"
638
639 Inputs="@(Compile);
640 @(Content);
641 @(EmbeddedResource);
642 @(WixObject);
643 @(_ResolvedProjectReferencePaths);
644 @(_ResolvedWixLibraryPaths);
645 @(_ResolvedWixExtensionPaths);
646 @(_BindInputs);
647 $(MSBuildAllProjects)"
648 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
649 Condition=" '@(Compile)' != '' ">
650
651 <PropertyGroup>
652 <OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)))</OutputFile>
653 <PdbOutputFile>$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)</PdbOutputFile>
654 </PropertyGroup>
655
656 <DoIt
657 SourceFiles="@(_CompileWithObjectPath)"
658 LibraryFiles="@(WixLibProjects);@(_ResolvedWixLibraryPaths)"
659 LocalizationFiles="@(EmbeddedResource)"
660
661 Cultures="%(CultureGroup.Identity)"
662
663 ExtensionDirectory="$(WixExtDir)"
664 Extensions="@(_ResolvedWixExtensionPaths)"
665
666 IntermediateDirectory="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)"
667
668 OutputFile="$(OutputFile)"
669 OutputType="$(OutputType)"
670 PdbOutputFile="$(PdbOutputFile)"
671
672 AdditionalOptions="$(CompilerAdditionalOptions) $(LinkerAdditionalOptions)"
673 DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)"
674 IncludeSearchPaths="$(IncludeSearchPaths)"
675 InstallerPlatform="$(InstallerPlatform)"
676 NoLogo="true"
677 Pedantic="$(Pedantic)"
678 ReferencePaths="$(ReferencePaths)"
679
680 SuppressSpecificWarnings="$(CompilerSuppressSpecificWarnings);$(LinkerSuppressSpecificWarnings)"
681 TreatSpecificWarningsAsErrors="$(CompilerTreatSpecificWarningsAsErrors)"
682
683 BindInputPaths="@(LinkerBindInputPaths)"
684 BindFiles="$(LinkerBindFiles)"
685 BindContentsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)"
686 BindOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"
687 BindBuiltOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"
688
689 CabinetCachePath="$(CabinetCachePath)"
690 CabinetCreationThreadCount="$(CabinetCreationThreadCount)"
691 DefaultCompressionLevel="$(DefaultCompressionLevel)"
692
693 UnreferencedSymbolsFile="$(UnreferencedSymbolsFile)"
694 WixProjectFile="$(ProjectPath)"
695 WixVariables="$(WixVariables)"
696
697 SuppressValidation="$(SuppressValidation)"
698 SuppressIces="$(SuppressIces)"
699 AdditionalCub="$(AdditionalCub)" />
700
701 <!--
702 SuppressAllWarnings="$(CompilerSuppressAllWarnings);$(LinkerSuppressAllWarnings)"
703 TreatWarningsAsErrors="$(CompilerTreatWarningsAsErrors);$(LinkerTreatWarningsAsErrors)"
704 VerboseOutput="$(CompilerVerboseOutput);$(LinkerVerboseOutput)"
705 -->
706
707</Target>
708
709
710 <!--
711 //////////////////////////////////////////////////////////////////////////////////////////////////
712 //////////////////////////////////////////////////////////////////////////////////////////////////
713 CompileAndLink Targets
714 //////////////////////////////////////////////////////////////////////////////////////////////////
715 //////////////////////////////////////////////////////////////////////////////////////////////////
716 -->
717
718 <!--
719 ==================================================================================================
720 CompileAndLink
721 ==================================================================================================
722 -->
723 <PropertyGroup>
724 <CompileAndLinkDependsOn>
725 ResolveReferences;
726 BeforeCompile;
727 _TimeStampBeforeCompile;
728 Harvest;
729 Compile;
730 Lib;
731 Link;
732 UpdateLinkFileWrites;
733 _TimeStampAfterCompile;
734 AfterCompile
735 </CompileAndLinkDependsOn>
736 </PropertyGroup>
737 <Target
738 Name="CompileAndLink"
739 DependsOnTargets="$(CompileAndLinkDependsOn)" />
740
741 <!--
742 ==================================================================================================
743 CalculateDefineConstants
744
745 Adds project references to the constants passed into the compiler.
746
747 [IN]
748 @(_ResolvedProjectReferencePaths) - paths to projects' outputs
749 $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE
750
751 [OUT]
752 $(ProjectReferenceDefineConstants) - the list of referenced project variables to be passed into the compiler
753 ==================================================================================================
754 -->
755 <PropertyGroup>
756 <CalculateDefineConstantsDependsOn>ResolveReferences</CalculateDefineConstantsDependsOn>
757 </PropertyGroup>
758 <Target
759 Name="CalculateDefineConstants"
760 DependsOnTargets="$(CalculateDefineConstantsDependsOn)"
761 Condition=" '@(_ResolvedProjectReferencePaths)' != '' ">
762
763 <PropertyGroup>
764 <ProjectDefineConstants>
765 Configuration=$(ConfigurationName);
766 OutDir=$(OutDir);
767 Platform=$(PlatformName);
768 ProjectDir=$(ProjectDir);
769 ProjectExt=$(ProjectExt);
770 ProjectFileName=$(ProjectFileName);
771 ProjectName=$(ProjectName);
772 ProjectPath=$(ProjectPath);
773 TargetDir=$(TargetDir);
774 TargetExt=$(TargetExt);
775 TargetFileName=$(TargetFileName);
776 TargetName=$(TargetName);
777 TargetPath=$(TargetPath);
778 </ProjectDefineConstants>
779 </PropertyGroup>
780
781 <PropertyGroup>
782 <SolutionDefineConstants Condition=" '$(DevEnvDir)'!='*Undefined*' ">$(SolutionDefineConstants);DevEnvDir=$(DevEnvDir)</SolutionDefineConstants>
783 <SolutionDefineConstants Condition=" '$(SolutionDir)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionDir=$(SolutionDir)</SolutionDefineConstants>
784 <SolutionDefineConstants Condition=" '$(SolutionExt)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionExt=$(SolutionExt)</SolutionDefineConstants>
785 <SolutionDefineConstants Condition=" '$(SolutionFileName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionFileName=$(SolutionFileName)</SolutionDefineConstants>
786 <SolutionDefineConstants Condition=" '$(SolutionName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionName=$(SolutionName)</SolutionDefineConstants>
787 <SolutionDefineConstants Condition=" '$(SolutionPath)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionPath=$(SolutionPath)</SolutionDefineConstants>
788 </PropertyGroup>
789
790 <CreateProjectReferenceDefineConstants
791 ProjectReferencePaths="@(_ResolvedProjectReferencePaths)"
792 ProjectConfigurations="$(VSProjectConfigurations)">
793
794 <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" />
795 </CreateProjectReferenceDefineConstants>
796
797 <ItemGroup>
798 <LinkerBindInputPaths Include="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)" />
799 </ItemGroup>
800 </Target>
801
802 <!--
803 ================================================================================================
804 GenerateCompileWithObjectPath
805
806 Generates metadata on the for compile output objects.
807
808 ================================================================================================
809 -->
810 <PropertyGroup>
811 <GenerateCompileWithObjectPathDependsOn></GenerateCompileWithObjectPathDependsOn>
812 </PropertyGroup>
813 <Target
814 Name="GenerateCompileWithObjectPath"
815 Condition=" '@(Compile)' != '' ">
816
817 <GenerateCompileWithObjectPath
818 Compile="@(Compile)"
819 IntermediateOutputPath="$(IntermediateOutputPath)">
820 <Output TaskParameter="CompileWithObjectPath" ItemName="_CompileWithObjectPath" />
821 </GenerateCompileWithObjectPath>
822
823 </Target>
824
825 <!--
826 ================================================================================================
827 Compile
828
829 Compiles the wxs files into wixobj files using candle.exe.
830
831 [IN]
832 @(Compile) - The list of wxs files to compile.
833 @(Content) - Files that the project uses in the installer.
834 @(WixExtension) - The list of wixlib or wix dll extensions.
835
836 [OUT]
837 @(CompileObjOutput) - The compiled .wixobj files.
838 ================================================================================================
839 -->
840 <PropertyGroup>
841 <CompileDependsOn>
842 PrepareForBuild;
843 ResolveReferences;
844 CalculateDefineConstants;
845 GenerateCompileWithObjectPath
846 </CompileDependsOn>
847 </PropertyGroup>
848 <Target
849 Name="Compile"
850 Inputs="@(Compile);
851 @(Content);
852 @(_ResolvedWixExtensionPaths);
853 @(_ResolvedProjectReferencePaths);
854 $(MSBuildAllProjects)"
855 Outputs="@(_CompileWithObjectPath -> '%(ObjectPath)%(Filename).wixobj')"
856 DependsOnTargets="$(CompileDependsOn)"
857 Condition=" '@(Compile)' != '' ">
858
859 <Candle
860 SourceFiles="@(_CompileWithObjectPath)"
861 AdditionalOptions="$(CompilerAdditionalOptions)"
862 DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)"
863 ExtensionDirectory="$(WixExtDir)"
864 Extensions="@(_ResolvedWixExtensionPaths)"
865 PreprocessToStdOut="$(PreprocessToStdOut)"
866 PreprocessToFile="$(PreprocessToFile)"
867 IncludeSearchPaths="$(IncludeSearchPaths)"
868 InstallerPlatform="$(InstallerPlatform)"
869 IntermediateDirectory="$(IntermediateOutputPath)"
870 NoLogo="$(CompilerNoLogo)"
871 OutputFile="%(_CompileWithObjectPath.ObjectPath)"
872 Pedantic="$(Pedantic)"
873 ReferencePaths="$(ReferencePaths)"
874 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
875 SuppressAllWarnings="$(CompilerSuppressAllWarnings)"
876 SuppressSpecificWarnings="$(CompilerSuppressSpecificWarnings)"
877 ToolPath="$(WixToolDir)"
878 TreatWarningsAsErrors="$(CompilerTreatWarningsAsErrors)"
879 TreatSpecificWarningsAsErrors="$(CompilerTreatSpecificWarningsAsErrors)"
880 VerboseOutput="$(CompilerVerboseOutput)">
881 </Candle>
882
883 <!-- These will be still be set even if the Compile target is up to date. -->
884 <ItemGroup>
885 <CompileObjOutput Include="@(_CompileWithObjectPath -> '%(ObjectPath)%(Filename).wixobj')" />
886 <FileWrites Include="@(CompileObjOutput)" />
887 </ItemGroup>
888 </Target>
889
890 <!--
891 ================================================================================================
892 Lib
893
894 Links the .wixobj, .wxl, .wixlib, wix extensions into a .wixlib file using lit.exe.
895
896 [IN]
897 @(CompileObjOutput) - The compiled .wixobj file.
898 @(EmbeddedResource) - The list of wxl files to use for localization.
899 @(WixObject) - The list of .wixobj files.
900 @(WixLibrary) - The list of .wixlib files.
901 @(WixExtension) - The list of wix dll extension files.
902
903 [OUT]
904 $(TargetPath) - The compiled .wixlib file.
905 ================================================================================================
906 -->
907 <PropertyGroup>
908 <LibDependsOn>
909 PrepareForBuild;
910 ResolveReferences
911 </LibDependsOn>
912 </PropertyGroup>
913 <Target
914 Name="Lib"
915 Inputs="@(CompileObjOutput);
916 @(EmbeddedResource);
917 @(WixObject);
918 @(WixLibrary);
919 @(_ResolvedWixExtensionPaths);
920 $(MSBuildAllProjects)"
921 Outputs="$(TargetPath)"
922 DependsOnTargets="$(LibDependsOn)"
923 Condition=" '$(OutputType)' == 'Library' ">
924
925 <Lit
926 ObjectFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(WixLibrary)"
927 AdditionalOptions="$(LibAdditionalOptions)"
928 BindInputPaths="@(LinkerBindInputPaths)"
929 BindFiles="$(LibBindFiles)"
930 ExtensionDirectory="$(WixExtDir)"
931 Extensions="@(_ResolvedWixExtensionPaths)"
932 LocalizationFiles="@(EmbeddedResource)"
933 NoLogo="$(LibNoLogo)"
934 OutputFile="$(TargetPath)"
935 Pedantic="$(LibPedantic)"
936 ReferencePaths="$(ReferencePaths)"
937 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
938 SuppressAllWarnings="$(LibSuppressAllWarnings)"
939 SuppressIntermediateFileVersionMatching="$(LibSuppressIntermediateFileVersionMatching)"
940 SuppressSchemaValidation="$(LibSuppressSchemaValidation)"
941 SuppressSpecificWarnings="$(LibSuppressSpecificWarnings)"
942 ToolPath="$(WixToolDir)"
943 TreatWarningsAsErrors="$(LibTreatWarningsAsErrors)"
944 VerboseOutput="$(LibVerboseOutput)" />
945 </Target>
946
947 <!--
948 ================================================================================================
949 AssignCultures
950
951 Determines the final list of culture groups to build based on either the Cultures property or
952 those specified in .wxl files.
953
954 Culture groups specified in the Cultures property must be specified as a semi-colon
955 delimited list of groups, with comma-delimited cultures within a group.
956 For example:
957 <Cultures>en-US,en;en-GB,en</Cultures>
958 This will build 2 targets, outputing to en-US and en-GB sub-folders. Light will first look
959 for strings in the first culture (en-US or en-GB) then the second (en).
960
961 Cultures of .wxl files will be used when the Culture property is not set. The culture of a
962 .wxl file is determined by the Culture attribute in the WixLocalization element in the file
963
964 Sets the OutputFolder metadata on each culture group. In most cases this is the same as the
965 first culture in the culture group. When the Culture's property is unspecified and no .wxl
966 files are provided this is the same as the output directory. When the Culture's property
967 specifies a single culture group and no .wxl files are provided this is the same as the output
968 directory.
969
970 Updates the TargetPath and TargetPdbPath properties to be used in subsequent targets.
971
972 [IN]
973 @(EmbeddedResource) - The list of wxl files to use for localization.
974 $(Cultures) - The list of culture groups to build.
975
976 [OUT]
977 @(CultureGroup) - The list of culture group strings with OutputFolder metadata
978 $(TargetPath) - Property list of target link output MSIs/MSMs
979 $(TargetPdbPath) - Property list of target output pdbs
980 @(SignTargetPath) - The list of target to be signed
981
982 ================================================================================================
983 -->
984 <Target
985 Name="AssignCultures"
986 Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
987
988 <WixAssignCulture
989 Cultures="$(Cultures)"
990 Files="@(EmbeddedResource)">
991
992 <Output TaskParameter="CultureGroups" ItemName="CultureGroup" />
993 </WixAssignCulture>
994
995 <!-- Build an itemgroup of outputs -->
996 <ItemGroup>
997 <_TargetPathItems Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)" />
998 <_TargetPdbPathItems Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)" />
999 </ItemGroup>
1000
1001 <!-- Convert the itemgroup to a semicolon-delimited property -->
1002 <PropertyGroup>
1003 <TargetPath>@(_TargetPathItems)</TargetPath>
1004 <TargetPdbPath>@(_TargetPdbPathItems)</TargetPdbPath>
1005 </PropertyGroup>
1006
1007 <!-- Set the sign target items, if we're signing output. -->
1008 <ItemGroup Condition=" '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' ">
1009 <SignTargetPath Include="@(_TargetPathItems)" />
1010 </ItemGroup>
1011 </Target>
1012
1013 <!--
1014 ================================================================================================
1015 ReadPreviousBindInputsAndBuiltOutputs
1016
1017 Reads a previous build's Bind contents and built outputs file into @(_BindInputs) and
1018 @(_BindBuiltOutputs) respectively.
1019
1020 Note: Only the *built* outputs are used because using files copied to output folder
1021 can cause perpetual incremental build.
1022
1023 Imagine the case where you have: Msi.wixproj -> Lib.wixproj -> Exe.csproj. The
1024 Exe.csproj cannot be both an input to Lib.wixproj and an output of Msi.wixproj
1025 (as an uncompressed file) because the Lib.wixproj will always newer than the
1026 Exe.csproj.
1027
1028 [IN]
1029
1030 [OUT]
1031 @(_BindInputs) - the content files required to bind (i.e. the Binary/@SourceFile and File/@Source files).
1032 @(_BindBuiltOutputs) - the previously built .msi, .msm, .pcp, .exe .wixpdb, .cabs, etc.
1033 Does not include content copied to output folder.
1034 ================================================================================================
1035 -->
1036 <Target
1037 Name="ReadPreviousBindInputsAndBuiltOutputs">
1038
1039 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)">
1040 <Output TaskParameter="Lines" ItemName="_BindInputs" />
1041 </ReadLinesFromFile>
1042
1043 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)">
1044 <Output TaskParameter="Lines" ItemName="_BindBuiltOutputs" />
1045 </ReadLinesFromFile>
1046
1047 <Message Importance="low" Text="Previous bind inputs: @(_BindInputs)" />
1048 <Message Importance="low" Text="Previous bind outputs: @(_BindBuiltOutputs)" />
1049 </Target>
1050
1051 <!--
1052 ================================================================================================
1053 Link
1054
1055 Links the .wixobj, .wxl, .wixlib, wix extensions into an .msi or .msm file using light.exe,
1056 once per culture group. All WXL files are passed into light and the culture switch determines
1057 which are used
1058
1059 [IN]
1060 @(CompileObjOutput) - The compiled .wixobj file.
1061 @(CultureGroup) - The cultures to build
1062 @(EmbeddedResource) - The list of wxl files to use for localization.
1063 @(WixObject) - The list of .wixobj files.
1064 @(WixLibrary) - The list of .wixlib files.
1065 @(WixExtension) - The list of wix dll extension files.
1066
1067 [OUT]
1068 $(TargetDir)\%(Culture)\$(TargetName)$(TargetExt) - The compiled .msi, .msm, or .exe files.
1069 ================================================================================================
1070 -->
1071 <PropertyGroup>
1072 <LinkDependsOn>
1073 PrepareForBuild;
1074 ResolveReferences;
1075 AssignCultures;
1076 ReadPreviousBindInputsAndBuiltOutputs;
1077 </LinkDependsOn>
1078 </PropertyGroup>
1079 <Target
1080 Name="Link"
1081 Inputs="@(CompileObjOutput);
1082 @(EmbeddedResource);
1083 @(WixObject);
1084 @(_ResolvedProjectReferencePaths);
1085 @(_ResolvedWixLibraryPaths);
1086 @(_ResolvedWixExtensionPaths);
1087 $(MSBuildAllProjects);
1088 @(_BindInputs)"
1089 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
1090 DependsOnTargets="$(LinkDependsOn)"
1091 Condition=" '$(OutputType)' == 'Bundle' or '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
1092
1093 <PropertyGroup>
1094 <PdbOutputFile>$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)</PdbOutputFile>
1095 </PropertyGroup>
1096
1097 <!-- Call light using the culture subdirectory for output -->
1098 <Light
1099 ObjectFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(_ResolvedWixLibraryPaths)"
1100 AdditionalOptions="$(LinkerAdditionalOptions)"
1101 AllowIdenticalRows="$(AllowIdenticalRows)"
1102 AllowUnresolvedReferences="$(AllowUnresolvedReferences)"
1103 AdditionalCub="$(AdditionalCub)"
1104 BackwardsCompatibleGuidGeneration="$(BackwardsCompatibleGuidGeneration)"
1105 BindInputPaths="@(LinkerBindInputPaths)"
1106 BindFiles="$(LinkerBindFiles)"
1107 BindContentsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)"
1108 BindOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"
1109 BindBuiltOutputsFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"
1110 CabinetCachePath="$(CabinetCachePath)"
1111 CabinetCreationThreadCount="$(CabinetCreationThreadCount)"
1112 Cultures="%(CultureGroup.Identity)"
1113 CustomBinder="$(CustomBinder)"
1114 DefaultCompressionLevel="$(DefaultCompressionLevel)"
1115 DropUnrealTables="$(DropUnrealTables)"
1116 ExactAssemblyVersions="$(ExactAssemblyVersions)"
1117 ExtensionDirectory="$(WixExtDir)"
1118 Extensions="@(_ResolvedWixExtensionPaths)"
1119 Ices="$(Ices)"
1120 LeaveTemporaryFiles="$(LeaveTemporaryFiles)"
1121 LocalizationFiles="@(EmbeddedResource)"
1122 NoLogo="$(LinkerNoLogo)"
1123 OutputAsXml="$(OutputAsXml)"
1124 OutputFile="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)"
1125 PdbOutputFile="$(PdbOutputFile)"
1126 Pedantic="$(LinkerPedantic)"
1127 ReferencePaths="$(ReferencePaths)"
1128 ReuseCabinetCache="$(ReuseCabinetCache)"
1129 RunAsSeparateProcess="$(RunWixToolsOutOfProc)"
1130 SuppressAclReset="$(SuppressAclReset)"
1131 SuppressAllWarnings="$(LinkerSuppressAllWarnings)"
1132 SuppressAssemblies="$(SuppressAssemblies)"
1133 SuppressDefaultAdminSequenceActions="$(SuppressDefaultAdminSequenceActions)"
1134 SuppressDefaultAdvSequenceActions="$(SuppressDefaultAdvSequenceActions)"
1135 SuppressDefaultUISequenceActions="$(SuppressDefaultUISequenceActions)"
1136 SuppressFileHashAndInfo="$(SuppressFileHashAndInfo)"
1137 SuppressFiles="$(SuppressFiles)"
1138 SuppressIntermediateFileVersionMatching="$(LinkerSuppressIntermediateFileVersionMatching)"
1139 SuppressIces="$(SuppressIces)"
1140 SuppressLayout="$(SuppressLayout)"
1141 SuppressLocalization="$(SuppressLocalization)"
1142 SuppressMsiAssemblyTableProcessing="$(SuppressMsiAssemblyTableProcessing)"
1143 SuppressPdbOutput="$(SuppressPdbOutput)"
1144 SuppressSchemaValidation="$(LinkerSuppressSchemaValidation)"
1145 SuppressValidation="$(SuppressValidation)"
1146 SuppressSpecificWarnings="$(LinkerSuppressSpecificWarnings)"
1147 SuppressTagSectionIdAttributeOnTuples="$(SuppressTagSectionIdAttributeOnTuples)"
1148 ToolPath="$(WixToolDir)"
1149 TreatWarningsAsErrors="$(LinkerTreatWarningsAsErrors)"
1150 UnreferencedSymbolsFile="$(UnreferencedSymbolsFile)"
1151 VerboseOutput="$(LinkerVerboseOutput)"
1152 WixProjectFile="$(ProjectPath)"
1153 WixVariables="$(WixVariables)" />
1154 </Target>
1155
1156 <!--
1157 ================================================================================================
1158 UpdateLinkFileWrites
1159
1160 Reads the bind outputs file(s) output generated during Link to correctly set the @(FileWrites)
1161 item. Most targets have it easy because they can do a static mapping from inputs to the outputs.
1162 However, the Link target outputs are determined after a rather complex calculation we call
1163 linking and binding!
1164
1165 This target runs independently after Link to ensure that @(FileWrites) is updated even if the
1166 "Light" task fails.
1167
1168 [IN]
1169 Path to bind outputs file(s).
1170
1171 [OUT]
1172 @(FileWrites) updated with outputs from bind.
1173 ================================================================================================
1174 -->
1175 <Target
1176 Name="UpdateLinkFileWrites">
1177
1178 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1179 <Output TaskParameter="Lines" ItemName="FileWrites"/>
1180 </ReadLinesFromFile>
1181
1182 <ItemGroup>
1183 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)" Condition=" Exists('$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindContentsFile)') " />
1184 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)" Condition=" Exists('$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)') " />
1185 <FileWrites Include="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)" Condition=" Exists('$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)') " />
1186 </ItemGroup>
1187
1188 <Message Importance="low" Text="Build files after link: @(FileWrites)" />
1189 </Target>
1190
1191 <!--
1192 //////////////////////////////////////////////////////////////////////////////////////////////////
1193 //////////////////////////////////////////////////////////////////////////////////////////////////
1194 AllProjectOutputGroups Section
1195 //////////////////////////////////////////////////////////////////////////////////////////////////
1196 //////////////////////////////////////////////////////////////////////////////////////////////////
1197 -->
1198
1199 <!--
1200 ==================================================================================================
1201 AllProjectOutputGroups - OVERRIDE Target
1202
1203 ==================================================================================================
1204 -->
1205 <Target
1206 Name="AllProjectOutputGroups"
1207 DependsOnTargets="
1208 BuiltProjectOutputGroup;
1209 DebugSymbolsProjectOutputGroup;
1210 SourceFilesProjectOutputGroup;
1211 ContentFilesProjectOutputGroup" />
1212
1213 <!--
1214 This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE.
1215 Reading an item is faster than invoking a target.
1216 -->
1217 <ItemGroup>
1218 <BuiltProjectOutputGroupKeyOutput Include="$(TargetPath)">
1219 <IsKeyOutput>true</IsKeyOutput>
1220 <FinalOutputPath>$(TargetPath)</FinalOutputPath>
1221 <TargetPath>$(TargetFileName)</TargetPath>
1222 </BuiltProjectOutputGroupKeyOutput>
1223 </ItemGroup>
1224
1225 <!--
1226 ==================================================================================================
1227 BuiltProjectOutputGroup - OVERRIDE Target
1228 ==================================================================================================
1229 -->
1230 <PropertyGroup>
1231 <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignCultures</BuiltProjectOutputGroupDependsOn>
1232 </PropertyGroup>
1233 <Target
1234 Name="BuiltProjectOutputGroup"
1235 Outputs="@(BuiltProjectOutputGroupOutput)"
1236 DependsOnTargets="$(BuiltProjectOutputGroupDependsOn)">
1237
1238 <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below -->
1239
1240 <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from linker. -->
1241 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1242 <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/>
1243 </ReadLinesFromFile>
1244
1245 <!-- If we didn't get anything from the bind outputs text file, default to the target path. -->
1246 <ItemGroup Condition=" '@(_BuiltProjectOutputGroupOutputIntermediate)'=='' ">
1247 <_BuiltProjectOutputGroupOutputIntermediate Include="$(TargetPath)" />
1248 </ItemGroup>
1249
1250 <!-- Convert intermediate items into final items; this way we can get the full path for each item -->
1251 <ItemGroup>
1252 <BuiltProjectOutputGroupOutput Include="@(_BuiltProjectOutputGroupOutputIntermediate->'%(FullPath)')">
1253 <!-- For compatibility with 2.0 -->
1254 <OriginalItemSpec Condition="'%(_BuiltProjectOutputGroupOutputIntermediate.OriginalItemSpec)' == ''">%(_BuiltProjectOutputGroupOutputIntermediate.FullPath)</OriginalItemSpec>
1255 </BuiltProjectOutputGroupOutput>
1256 </ItemGroup>
1257 </Target>
1258
1259 <!--
1260 ==================================================================================================
1261 DebugSymbolsProjectOutputGroup
1262
1263 Populates the Debug Symbols project output group.
1264 ==================================================================================================
1265 -->
1266 <PropertyGroup>
1267 <DebugSymbolsProjectOutputGroupDependsOn>AssignCultures</DebugSymbolsProjectOutputGroupDependsOn>
1268 </PropertyGroup>
1269 <Target
1270 Name="DebugSymbolsProjectOutputGroup"
1271 Outputs="@(DebugSymbolsProjectOutputGroupOutput)"
1272 DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)">
1273
1274 <!-- Include build output pdb(s). Different than predefined itemgroup since AssignCultures target may change -->
1275 <ItemGroup>
1276 <DebugSymbolsProjectOutputGroupOutput Include="$(TargetPdbPath)" Condition=" '$(SuppressPdbOutput)' != 'true' "/>
1277 </ItemGroup>
1278 </Target>
1279
1280
1281 <!--
1282 ==================================================================================================
1283 CopyFilesToOutputDirectory - OVERRIDE Target
1284
1285 Copy all build outputs, satellites and other necessary files to the final directory.
1286 ============================================================
1287 -->
1288 <Target
1289 Name="CopyFilesToOutputDirectory">
1290
1291 <PropertyGroup>
1292 <!-- By default we're using hard links to copy to the output directory, disabling this could slow the build significantly -->
1293 <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition=" '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == '' ">true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>
1294 </PropertyGroup>
1295
1296 <PropertyGroup>
1297 <CopyBuildOutputToOutputDirectory Condition="'$(CopyBuildOutputToOutputDirectory)'==''">true</CopyBuildOutputToOutputDirectory>
1298 <CopyOutputSymbolsToOutputDirectory Condition="'$(CopyOutputSymbolsToOutputDirectory)'==''">true</CopyOutputSymbolsToOutputDirectory>
1299 <FullIntermediateOutputPath>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)))</FullIntermediateOutputPath>
1300 </PropertyGroup>
1301
1302 <!-- Copy the bound files. -->
1303 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
1304 <Output TaskParameter="Lines" ItemName="_FullPathToCopy"/>
1305 </ReadLinesFromFile>
1306
1307 <ItemGroup>
1308 <_FullPathToCopy Include="$(OutputFile)" Condition=" '@(_FullPathToCopy)'=='' " />
1309 <_RelativePath Include="$([MSBuild]::MakeRelative($(FullIntermediateOutputPath), %(_FullPathToCopy.Identity)))" />
1310 </ItemGroup>
1311
1312 <Copy
1313 SourceFiles="@(_RelativePath->'$(IntermediateOutputPath)%(Identity)')"
1314 DestinationFiles="@(_RelativePath->'$(OutDir)%(Identity)')"
1315 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
1316 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
1317 Retries="$(CopyRetryCount)"
1318 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
1319 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
1320 Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
1321 >
1322
1323 <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
1324 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
1325
1326 </Copy>
1327
1328 <Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(TargetPath)" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />
1329 <!--<Message Importance="High" Text="$(MSBuildProjectName) -&gt; @(MainAssembly->'%(FullPath)')" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />-->
1330
1331 <!-- Copy the debug information file (.pdb), if any
1332 <Copy
1333 SourceFiles="@(_DebugSymbolsIntermediatePath)"
1334 DestinationFiles="@(_DebugSymbolsOutputPath)"
1335 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
1336 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
1337 Retries="$(CopyRetryCount)"
1338 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
1339 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
1340 Condition="'$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true' and '$(CopyOutputSymbolsToOutputDirectory)'=='true'">
1341
1342 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
1343
1344 </Copy>
1345 -->
1346 </Target>
1347
1348
1349 <Import Project="$(WixHarvestTargetsPath)" Condition=" '$(WixHarvestTargetsPath)' != '' and Exists('$(WixHarvestTargetsPath)')" />
1350 <Import Project="$(WixSigningTargetsPath)" Condition=" '$(WixSigningTargetsPath)' != '' and Exists('$(WixSigningTargetsPath)')" />
1351 <Import Project="$(LuxTargetsPath)" Condition=" '$(LuxTargetsPath)' != '' and Exists('$(LuxTargetsPath)')" />
1352
1353 <!-- Extension point: Define CustomAfterWixTargets to a .targets file that you want to include after this file. -->
1354 <Import Project="$(CustomAfterWixTargets)" Condition=" '$(CustomAfterWixTargets)' != '' and Exists('$(CustomAfterWixTargets)')" />
1355
1356</Project>
diff --git a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.csproj b/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.csproj
deleted file mode 100644
index 73f331ff..00000000
--- a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.csproj
+++ /dev/null
@@ -1,28 +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 <TargetFramework>netstandard2.0</TargetFramework>
7 <IncludeBuildOutput>false</IncludeBuildOutput>
8 <Description>Internal WiX Toolset Tools</Description>
9 <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile>
10 <NuspecBasePath>$(OutputPath)publish</NuspecBasePath>
11 <NuspecProperties>Id=$(MSBuildThisFileName);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description)</NuspecProperties>
12 </PropertyGroup>
13
14 <ItemGroup>
15 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
16 </ItemGroup>
17
18 <PropertyGroup>
19 <GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);SetNuspecVersion</GenerateNuspecDependsOn>
20 </PropertyGroup>
21 <Target Name="SetNuspecVersion">
22 <Error Text="Cannot pack $(MSBuildThisFileName) until all projects are published to: '$(NuspecBasePath)'. Run appveyor.cmd to publish projects properly." Condition=" !Exists('$(NuspecBasePath)') " />
23
24 <PropertyGroup>
25 <NuspecProperties>$(NuspecProperties);Version=$(Version);ProjectFolder=$(MSBuildThisFileDirectory)</NuspecProperties>
26 </PropertyGroup>
27 </Target>
28</Project>
diff --git a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.nuspec b/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.nuspec
deleted file mode 100644
index a461557a..00000000
--- a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.nuspec
+++ /dev/null
@@ -1,20 +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 <authors>$authors$</authors>
7 <owners>$authors$</owners>
8 <requireLicenseAcceptance>false</requireLicenseAcceptance>
9 <description>$description$</description>
10 <copyright>$copyright$</copyright>
11 </metadata>
12
13 <files>
14 <file src="$projectFolder$$id$.props" target="build" />
15
16 <file src="netcoreapp2.1\*" target="tools\netcoreapp2.1" />
17 <file src="net461\*" target="tools\net461" />
18 <file src="net461\redirects\*" target="msbuild" />
19 </files>
20</package>
diff --git a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.props b/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.props
deleted file mode 100644
index 8d71aa66..00000000
--- a/src/WixToolset.Core.InternalPackage/WixToolset.Core.InternalPackage.props
+++ /dev/null
@@ -1,8 +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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
5 <PropertyGroup>
6 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileDirectory)..\tools\net461\wix.targets</WixTargetsPath>
7 </PropertyGroup>
8</Project>
diff --git a/src/WixToolset.Core.TestPackage/WixRunner.cs b/src/WixToolset.Core.TestPackage/WixRunner.cs
index ca0a6fb8..45c7ab3d 100644
--- a/src/WixToolset.Core.TestPackage/WixRunner.cs
+++ b/src/WixToolset.Core.TestPackage/WixRunner.cs
@@ -2,9 +2,11 @@
2 2
3namespace WixToolset.Core.TestPackage 3namespace WixToolset.Core.TestPackage
4{ 4{
5 using System;
5 using System.Collections.Generic; 6 using System.Collections.Generic;
6 using WixToolset.Data; 7 using WixToolset.Data;
7 using WixToolset.Extensibility; 8 using WixToolset.Extensibility;
9 using WixToolset.Extensibility.Services;
8 10
9 public static class WixRunner 11 public static class WixRunner
10 { 12 {
@@ -12,12 +14,41 @@ namespace WixToolset.Core.TestPackage
12 { 14 {
13 var listener = new TestListener(); 15 var listener = new TestListener();
14 16
15 var program = new Program();
16 var result = program.Run(new WixToolsetServiceProvider(), listener, args);
17
18 messages = listener.Messages; 17 messages = listener.Messages;
19 18
20 return result; 19 var serviceProvider = new WixToolsetServiceProvider();
20
21 var messaging = serviceProvider.GetService<IMessaging>();
22 messaging.SetListener(listener);
23
24 var arguments = serviceProvider.GetService<ICommandLineArguments>();
25 arguments.Populate(args);
26
27 var context = serviceProvider.GetService<ICommandLineContext>();
28 context.Messaging = messaging;
29 context.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
30 context.Arguments = arguments;
31
32 var commandLine = serviceProvider.GetService<ICommandLine>();
33 var command = commandLine.ParseStandardCommandLine(context);
34 return command?.Execute() ?? 1;
35 }
36
37 private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, string[] extensions)
38 {
39 var extensionManager = serviceProvider.GetService<IExtensionManager>();
40
41 foreach (var type in new[] { typeof(WixToolset.Core.Burn.WixToolsetStandardBackend), typeof(WixToolset.Core.WindowsInstaller.WixToolsetStandardBackend) })
42 {
43 extensionManager.Add(type.Assembly);
44 }
45
46 foreach (var extension in extensions)
47 {
48 extensionManager.Load(extension);
49 }
50
51 return extensionManager;
21 } 52 }
22 53
23 private class TestListener : IMessageListener 54 private class TestListener : IMessageListener
diff --git a/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj b/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj
index 2b9e2bde..6cdd8762 100644
--- a/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj
+++ b/src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj
@@ -10,7 +10,6 @@
10 </PropertyGroup> 10 </PropertyGroup>
11 11
12 <ItemGroup> 12 <ItemGroup>
13 <ProjectReference Include="..\wix\wix.csproj" IncludeAssets="true" />
14 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" IncludeAssets="true" /> 13 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" IncludeAssets="true" />
15 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" IncludeAssets="true" /> 14 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" IncludeAssets="true" />
16 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" IncludeAssets="true" /> 15 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" IncludeAssets="true" />
@@ -18,7 +17,6 @@
18 17
19 <!-- This is a workaround until https://github.com/NuGet/Home/issues/3891 is resolved --> 18 <!-- This is a workaround until https://github.com/NuGet/Home/issues/3891 is resolved -->
20 <ItemGroup> 19 <ItemGroup>
21 <_PackageFiles Include="$(OutputPath)\wix.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" />
22 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" /> 20 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" />
23 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.Burn.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" /> 21 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.Burn.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" />
24 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.WindowsInstaller.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" /> 22 <_PackageFiles Include="$(OutputPath)\WixToolset.Core.WindowsInstaller.dll" BuildAction="None" PackagePath="lib\$(TargetFramework)\" />
@@ -37,6 +35,6 @@
37 35
38 <ItemGroup> 36 <ItemGroup>
39 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/> 37 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/>
40 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> 38 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" />
41 </ItemGroup> 39 </ItemGroup>
42</Project> 40</Project>
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
index 60aec15b..11198b2b 100644
--- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
@@ -13,7 +13,7 @@ namespace WixToolset.Core.WindowsInstaller
13 13
14 internal class MsiBackend : IBackend 14 internal class MsiBackend : IBackend
15 { 15 {
16 public BindResult Bind(WixToolset.Extensibility.IBindContext context) 16 public BindResult Bind(IBindContext context)
17 { 17 {
18 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); 18 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
19 19
diff --git a/src/WixToolset.Core/WixToolset.Core.csproj b/src/WixToolset.Core/WixToolset.Core.csproj
index 3c3ac5d7..1d884489 100644
--- a/src/WixToolset.Core/WixToolset.Core.csproj
+++ b/src/WixToolset.Core/WixToolset.Core.csproj
@@ -28,6 +28,6 @@
28 28
29 <ItemGroup> 29 <ItemGroup>
30 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/> 30 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/>
31 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> 31 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" />
32 </ItemGroup> 32 </ItemGroup>
33</Project> 33</Project>
diff --git a/src/candle/App.ico b/src/candle/App.ico
deleted file mode 100644
index 3a5525fd..00000000
--- a/src/candle/App.ico
+++ /dev/null
Binary files differ
diff --git a/src/candle/AssemblyInfo.cs b/src/candle/AssemblyInfo.cs
deleted file mode 100644
index 7df55940..00000000
--- a/src/candle/AssemblyInfo.cs
+++ /dev/null
@@ -1,11 +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
3using System;
4using System.Reflection;
5using System.Runtime.CompilerServices;
6using System.Runtime.InteropServices;
7
8[assembly: AssemblyTitle("WiX Toolset Compiler")]
9[assembly: AssemblyDescription("Compiler")]
10[assembly: AssemblyCulture("")]
11[assembly: ComVisible(false)]
diff --git a/src/candle/CandleCommandLine.cs b/src/candle/CandleCommandLine.cs
deleted file mode 100644
index 81fdf7b2..00000000
--- a/src/candle/CandleCommandLine.cs
+++ /dev/null
@@ -1,343 +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.Tools
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9 using WixToolset.Data;
10
11 /// <summary>
12 /// Parse command line for candle.
13 /// </summary>
14 public class CandleCommandLine
15 {
16 public CandleCommandLine()
17 {
18 this.Platform = Platform.X86;
19
20 this.ShowLogo = true;
21 this.Extensions = new List<string>();
22 this.Files = new List<CompileFile>();
23 this.IncludeSearchPaths = new List<string>();
24 this.PreprocessorVariables = new Dictionary<string, string>();
25 }
26
27 public Platform Platform { get; private set; }
28
29 public bool ShowLogo { get; private set; }
30
31 public bool ShowHelp { get; private set; }
32
33 public bool ShowPedanticMessages { get; private set; }
34
35 public string OutputFolder { get; private set; }
36
37 public string OutputFile { get; private set; }
38
39 public List<string> Extensions { get; private set; }
40
41 public List<CompileFile> Files { get; private set; }
42
43 public List<string> IncludeSearchPaths { get; private set; }
44
45 public string PreprocessFile { get; private set; }
46
47 public Dictionary<string, string> PreprocessorVariables { get; private set; }
48
49 /// <summary>
50 /// Parse the commandline arguments.
51 /// </summary>
52 /// <param name="args">Commandline arguments.</param>
53 public string[] Parse(string[] args)
54 {
55 List<string> unprocessed = new List<string>();
56
57 for (int i = 0; i < args.Length; ++i)
58 {
59 string arg = args[i];
60 if (String.IsNullOrEmpty(arg)) // skip blank arguments
61 {
62 continue;
63 }
64
65 if (1 == arg.Length) // treat '-' and '@' as filenames when by themselves.
66 {
67 unprocessed.Add(arg);
68 }
69 else if ('-' == arg[0] || '/' == arg[0])
70 {
71 string parameter = arg.Substring(1);
72 if ('d' == parameter[0])
73 {
74 if (1 >= parameter.Length || '=' == parameter[1])
75 {
76 Messaging.Instance.OnMessage(WixErrors.InvalidVariableDefinition(arg));
77 break;
78 }
79
80 parameter = arg.Substring(2);
81
82 string[] value = parameter.Split("=".ToCharArray(), 2);
83
84 if (this.PreprocessorVariables.ContainsKey(value[0]))
85 {
86 Messaging.Instance.OnMessage(WixErrors.DuplicateVariableDefinition(value[0], (1 == value.Length) ? String.Empty : value[1], this.PreprocessorVariables[value[0]]));
87 break;
88 }
89
90 if (1 == value.Length)
91 {
92 this.PreprocessorVariables.Add(value[0], String.Empty);
93 }
94 else
95 {
96 this.PreprocessorVariables.Add(value[0], value[1]);
97 }
98 }
99 else if ('I' == parameter[0])
100 {
101 this.IncludeSearchPaths.Add(parameter.Substring(1));
102 }
103 else if ("ext" == parameter)
104 {
105 if (!CommandLine.IsValidArg(args, ++i))
106 {
107 Messaging.Instance.OnMessage(WixErrors.TypeSpecificationForExtensionRequired("-ext"));
108 break;
109 }
110 else
111 {
112 this.Extensions.Add(args[i]);
113 }
114 }
115 else if ("nologo" == parameter)
116 {
117 this.ShowLogo = false;
118 }
119 else if ("o" == parameter || "out" == parameter)
120 {
121 string path = CommandLine.GetFileOrDirectory(parameter, args, ++i);
122
123 if (!String.IsNullOrEmpty(path))
124 {
125 if (path.EndsWith("\\", StringComparison.Ordinal) || path.EndsWith("/", StringComparison.Ordinal))
126 {
127 this.OutputFolder = path;
128 }
129 else
130 {
131 this.OutputFile = path;
132 }
133 }
134 else
135 {
136 break;
137 }
138 }
139 else if ("pedantic" == parameter)
140 {
141 this.ShowPedanticMessages = true;
142 }
143 else if ("arch" == parameter)
144 {
145 if (!CommandLine.IsValidArg(args, ++i))
146 {
147 Messaging.Instance.OnMessage(WixErrors.InvalidPlatformParameter(parameter, String.Empty));
148 break;
149 }
150
151 if (String.Equals(args[i], "intel", StringComparison.OrdinalIgnoreCase) || String.Equals(args[i], "x86", StringComparison.OrdinalIgnoreCase))
152 {
153 this.Platform = Platform.X86;
154 }
155 else if (String.Equals(args[i], "x64", StringComparison.OrdinalIgnoreCase))
156 {
157 this.Platform = Platform.X64;
158 }
159 else if (String.Equals(args[i], "intel64", StringComparison.OrdinalIgnoreCase) || String.Equals(args[i], "ia64", StringComparison.OrdinalIgnoreCase))
160 {
161 this.Platform = Platform.IA64;
162 }
163 else if (String.Equals(args[i], "arm", StringComparison.OrdinalIgnoreCase))
164 {
165 this.Platform = Platform.ARM;
166 }
167 else
168 {
169 Messaging.Instance.OnMessage(WixErrors.InvalidPlatformParameter(parameter, args[i]));
170 }
171 }
172 else if ('p' == parameter[0])
173 {
174 string file = parameter.Substring(1);
175 this.PreprocessFile = String.IsNullOrEmpty(file) ? "con:" : file;
176 }
177 else if (parameter.StartsWith("sw", StringComparison.Ordinal))
178 {
179 string paramArg = parameter.Substring(2);
180 try
181 {
182 if (0 == paramArg.Length)
183 {
184 Messaging.Instance.SuppressAllWarnings = true;
185 }
186 else
187 {
188 int suppressWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
189 if (0 >= suppressWarning)
190 {
191 Messaging.Instance.OnMessage(WixErrors.IllegalSuppressWarningId(paramArg));
192 }
193
194 Messaging.Instance.SuppressWarningMessage(suppressWarning);
195 }
196 }
197 catch (FormatException)
198 {
199 Messaging.Instance.OnMessage(WixErrors.IllegalSuppressWarningId(paramArg));
200 }
201 catch (OverflowException)
202 {
203 Messaging.Instance.OnMessage(WixErrors.IllegalSuppressWarningId(paramArg));
204 }
205 }
206 else if (parameter.StartsWith("wx", StringComparison.Ordinal))
207 {
208 string paramArg = parameter.Substring(2);
209 try
210 {
211 if (0 == paramArg.Length)
212 {
213 Messaging.Instance.WarningsAsError = true;
214 }
215 else
216 {
217 int elevateWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
218 if (0 >= elevateWarning)
219 {
220 Messaging.Instance.OnMessage(WixErrors.IllegalWarningIdAsError(paramArg));
221 }
222
223 Messaging.Instance.ElevateWarningMessage(elevateWarning);
224 }
225 }
226 catch (FormatException)
227 {
228 Messaging.Instance.OnMessage(WixErrors.IllegalWarningIdAsError(paramArg));
229 }
230 catch (OverflowException)
231 {
232 Messaging.Instance.OnMessage(WixErrors.IllegalWarningIdAsError(paramArg));
233 }
234 }
235 else if ("v" == parameter)
236 {
237 Messaging.Instance.ShowVerboseMessages = true;
238 }
239 else if ("?" == parameter || "help" == parameter)
240 {
241 this.ShowHelp = true;
242 break;
243 }
244 else
245 {
246 unprocessed.Add(arg);
247 }
248 }
249 else if ('@' == arg[0])
250 {
251 string[] parsedArgs = CommandLineResponseFile.Parse(arg.Substring(1));
252 string[] unparsedArgs = this.Parse(parsedArgs);
253 unprocessed.AddRange(unparsedArgs);
254 }
255 else
256 {
257 unprocessed.Add(arg);
258 }
259 }
260
261 return unprocessed.ToArray();
262 }
263
264 public string[] ParsePostExtensions(string[] remaining)
265 {
266 List<string> unprocessed = new List<string>();
267 List<string> files = new List<string>();
268
269 for (int i = 0; i < remaining.Length; ++i)
270 {
271 string arg = remaining[i];
272 if (String.IsNullOrEmpty(arg)) // skip blank arguments
273 {
274 continue;
275 }
276
277 if (1 < arg.Length && ('-' == arg[0] || '/' == arg[0]))
278 {
279 unprocessed.Add(arg);
280 }
281 else
282 {
283 files.AddRange(CommandLine.GetFiles(arg, "Source"));
284 }
285 }
286
287 if (0 == files.Count)
288 {
289 this.ShowHelp = true;
290 }
291 else
292 {
293 Dictionary<string, List<string>> sourcesForOutput = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
294 foreach (string file in files)
295 {
296 string sourceFileName = Path.GetFileName(file);
297
298 CompileFile compileFile = new CompileFile();
299 compileFile.SourcePath = Path.GetFullPath(file);
300
301 if (null != this.OutputFile)
302 {
303 compileFile.OutputPath = this.OutputFile;
304 }
305 else if (null != this.OutputFolder)
306 {
307 compileFile.OutputPath = Path.Combine(this.OutputFolder, Path.ChangeExtension(sourceFileName, ".wixobj"));
308 }
309 else
310 {
311 compileFile.OutputPath = Path.ChangeExtension(sourceFileName, ".wixobj");
312 }
313
314 // Track which source files result in a given output file, to ensure we aren't
315 // overwriting the output.
316 List<string> sources;
317 string targetPath = Path.GetFullPath(compileFile.OutputPath);
318 if (!sourcesForOutput.TryGetValue(targetPath, out sources))
319 {
320 sources = new List<string>();
321 sourcesForOutput.Add(targetPath, sources);
322 }
323
324 sources.Add(compileFile.SourcePath);
325
326 this.Files.Add(compileFile);
327 }
328
329 // Show an error for every output file that had more than 1 source file.
330 foreach (KeyValuePair<string, List<string>> outputSources in sourcesForOutput)
331 {
332 if (1 < outputSources.Value.Count)
333 {
334 string sourceFiles = String.Join(", ", outputSources.Value);
335 Messaging.Instance.OnMessage(WixErrors.DuplicateSourcesForOutput(sourceFiles, outputSources.Key));
336 }
337 }
338 }
339
340 return unprocessed.ToArray();
341 }
342 }
343}
diff --git a/src/candle/CandleStrings.Designer.cs b/src/candle/CandleStrings.Designer.cs
deleted file mode 100644
index aaf7254e..00000000
--- a/src/candle/CandleStrings.Designer.cs
+++ /dev/null
@@ -1,81 +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.Tools {
4 using System;
5
6
7 /// <summary>
8 /// A strongly-typed resource class, for looking up localized strings, etc.
9 /// </summary>
10 // This class was auto-generated by the StronglyTypedResourceBuilder
11 // class via a tool like ResGen or Visual Studio.
12 // To add or remove a member, edit your .ResX file then rerun ResGen
13 // with the /str option, or rebuild your VS project.
14 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
15 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
16 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
17 internal class CandleStrings {
18
19 private static global::System.Resources.ResourceManager resourceMan;
20
21 private static global::System.Globalization.CultureInfo resourceCulture;
22
23 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
24 internal CandleStrings() {
25 }
26
27 /// <summary>
28 /// Returns the cached ResourceManager instance used by this class.
29 /// </summary>
30 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
31 internal static global::System.Resources.ResourceManager ResourceManager {
32 get {
33 if (object.ReferenceEquals(resourceMan, null)) {
34 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WixToolset.Tools.CandleStrings", typeof(CandleStrings).Assembly);
35 resourceMan = temp;
36 }
37 return resourceMan;
38 }
39 }
40
41 /// <summary>
42 /// Overrides the current thread's CurrentUICulture property for all
43 /// resource lookups using this strongly typed resource class.
44 /// </summary>
45 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
46 internal static global::System.Globalization.CultureInfo Culture {
47 get {
48 return resourceCulture;
49 }
50 set {
51 resourceCulture = value;
52 }
53 }
54
55 /// <summary>
56 /// Looks up a localized string similar to Cannot specify more than one source file with single output file. Either specify an output directory for the -out argument by ending the argument with a &apos;\&apos; or remove the -out argument to have the source files compiled to the current directory..
57 /// </summary>
58 internal static string CannotSpecifyMoreThanOneSourceFileForSingleTargetFile {
59 get {
60 return ResourceManager.GetString("CannotSpecifyMoreThanOneSourceFileForSingleTargetFile", resourceCulture);
61 }
62 }
63
64 /// <summary>
65 /// Looks up a localized string similar to usage: candle.exe [-?] [-nologo] [-out outputFile] sourceFile [sourceFile ...] [@responseFile]
66 ///
67 /// -arch set architecture defaults for package, components, etc.
68 /// values: x86, x64, or ia64 (default: x86)
69 /// -d&lt;name&gt;[=&lt;value&gt;] define a parameter for the preprocessor
70 /// -ext &lt;extension&gt; extension assembly or &quot;class, assembly&quot;
71 /// -I&lt;dir&gt; add to include search path
72 /// -nologo skip printing candle logo information
73 /// -o[ut] s [rest of string was truncated]&quot;;.
74 /// </summary>
75 internal static string HelpMessage {
76 get {
77 return ResourceManager.GetString("HelpMessage", resourceCulture);
78 }
79 }
80 }
81}
diff --git a/src/candle/CandleStrings.resx b/src/candle/CandleStrings.resx
deleted file mode 100644
index d77788ca..00000000
--- a/src/candle/CandleStrings.resx
+++ /dev/null
@@ -1,142 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 <data name="CannotSpecifyMoreThanOneSourceFileForSingleTargetFile" xml:space="preserve">
121 <value>Cannot specify more than one source file with single output file. Either specify an output directory for the -out argument by ending the argument with a '\' or remove the -out argument to have the source files compiled to the current directory.</value>
122 </data>
123 <data name="HelpMessage" xml:space="preserve">
124 <value> usage: candle.exe [-?] [-nologo] [-out outputFile] sourceFile [sourceFile ...] [@responseFile]
125
126 -arch set architecture defaults for package, components, etc.
127 values: x86, x64, ia64 or arm (default: x86)
128 -d&lt;name&gt;[=&lt;value&gt;] define a parameter for the preprocessor
129 -ext &lt;extension&gt; extension assembly or "class, assembly"
130 -I&lt;dir&gt; add to include search path
131 -nologo skip printing candle logo information
132 -o[ut] specify output file (default: write to current directory)
133 -p&lt;file&gt; preprocess to a file (or stdout if no file supplied)
134 -pedantic show pedantic messages
135 -sw[N] suppress all warnings or a specific message ID
136 (example: -sw1009 -sw1103)
137 -v verbose output
138 -wx[N] treat all warnings or a specific message ID as an error
139 (example: -wx1009 -wx1103)
140 -? | -help this help information</value>
141 </data>
142</root> \ No newline at end of file
diff --git a/src/candle/CompileFile.cs b/src/candle/CompileFile.cs
deleted file mode 100644
index 682acc21..00000000
--- a/src/candle/CompileFile.cs
+++ /dev/null
@@ -1,20 +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.Tools
4{
5 /// <summary>
6 /// Source code file to be compiled.
7 /// </summary>
8 public class CompileFile
9 {
10 /// <summary>
11 /// Path to the source code file.
12 /// </summary>
13 public string SourcePath { get; set; }
14
15 /// <summary>
16 /// Path to compile the output to.
17 /// </summary>
18 public string OutputPath { get; set; }
19 }
20}
diff --git a/src/candle/app.config b/src/candle/app.config
deleted file mode 100644
index 71c529fb..00000000
--- a/src/candle/app.config
+++ /dev/null
@@ -1,9 +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<configuration>
6 <runtime>
7 <loadFromRemoteSources enabled="true"/>
8 </runtime>
9</configuration>
diff --git a/src/candle/candle.cs b/src/candle/candle.cs
deleted file mode 100644
index f5c65cb1..00000000
--- a/src/candle/candle.cs
+++ /dev/null
@@ -1,200 +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.Tools
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using System.Linq;
9 using System.Runtime.InteropServices;
10 using System.Xml.Linq;
11 using WixToolset.Data;
12 using WixToolset.Extensibility;
13
14 /// <summary>
15 /// The main entry point for candle.
16 /// </summary>
17 public sealed class Candle
18 {
19 private CandleCommandLine commandLine;
20
21 private IEnumerable<IPreprocessorExtension> preprocessorExtensions;
22 private IEnumerable<ICompilerExtension> compilerExtensions;
23 private IEnumerable<IExtensionData> extensionData;
24
25 /// <summary>
26 /// The main entry point for candle.
27 /// </summary>
28 /// <param name="args">Commandline arguments for the application.</param>
29 /// <returns>Returns the application error code.</returns>
30 [MTAThread]
31 public static int Main(string[] args)
32 {
33 AppCommon.PrepareConsoleForLocalization();
34 Messaging.Instance.InitializeAppName("CNDL", "candle.exe").Display += AppCommon.ConsoleDisplayMessage;
35
36 Candle candle = new Candle();
37 return candle.Execute(args);
38 }
39
40 private int Execute(string[] args)
41 {
42 try
43 {
44 string[] unparsed = this.ParseCommandLineAndLoadExtensions(args);
45
46 if (!Messaging.Instance.EncounteredError)
47 {
48 if (this.commandLine.ShowLogo)
49 {
50 AppCommon.DisplayToolHeader();
51 }
52
53 if (this.commandLine.ShowHelp)
54 {
55 Console.WriteLine(CandleStrings.HelpMessage);
56 AppCommon.DisplayToolFooter();
57 }
58 else
59 {
60 foreach (string arg in unparsed)
61 {
62 Messaging.Instance.OnMessage(WixWarnings.UnsupportedCommandLineArgument(arg));
63 }
64
65 this.Run();
66 }
67 }
68 }
69 catch (WixException we)
70 {
71 Messaging.Instance.OnMessage(we.Error);
72 }
73 catch (Exception e)
74 {
75 Messaging.Instance.OnMessage(WixErrors.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace));
76 if (e is NullReferenceException || e is SEHException)
77 {
78 throw;
79 }
80 }
81
82 return Messaging.Instance.LastErrorNumber;
83 }
84
85 private string[] ParseCommandLineAndLoadExtensions(string[] args)
86 {
87 this.commandLine = new CandleCommandLine();
88 string[] unprocessed = commandLine.Parse(args);
89 if (Messaging.Instance.EncounteredError)
90 {
91 return unprocessed;
92 }
93
94 // Load extensions.
95 ExtensionManager extensionManager = new ExtensionManager();
96 foreach (string extension in this.commandLine.Extensions)
97 {
98 extensionManager.Load(extension);
99 }
100
101 // Preprocessor extension command line processing.
102 this.preprocessorExtensions = extensionManager.Create<IPreprocessorExtension>();
103 foreach (IExtensionCommandLine pce in this.preprocessorExtensions.Where(e => e is IExtensionCommandLine).Cast<IExtensionCommandLine>())
104 {
105 pce.MessageHandler = Messaging.Instance;
106 unprocessed = pce.ParseCommandLine(unprocessed);
107 }
108
109 // Compiler extension command line processing.
110 this.compilerExtensions = extensionManager.Create<ICompilerExtension>();
111 foreach (IExtensionCommandLine cce in this.compilerExtensions.Where(e => e is IExtensionCommandLine).Cast<IExtensionCommandLine>())
112 {
113 cce.MessageHandler = Messaging.Instance;
114 unprocessed = cce.ParseCommandLine(unprocessed);
115 }
116
117 // Extension data command line processing.
118 this.extensionData = extensionManager.Create<IExtensionData>();
119 foreach (IExtensionCommandLine dce in this.extensionData.Where(e => e is IExtensionCommandLine).Cast<IExtensionCommandLine>())
120 {
121 dce.MessageHandler = Messaging.Instance;
122 unprocessed = dce.ParseCommandLine(unprocessed);
123 }
124
125 return commandLine.ParsePostExtensions(unprocessed);
126 }
127
128 private void Run()
129 {
130 // Create the preprocessor and compiler
131 Preprocessor preprocessor = new Preprocessor();
132 preprocessor.CurrentPlatform = this.commandLine.Platform;
133
134 foreach (string includePath in this.commandLine.IncludeSearchPaths)
135 {
136 preprocessor.IncludeSearchPaths.Add(includePath);
137 }
138
139 foreach (IPreprocessorExtension pe in this.preprocessorExtensions)
140 {
141 preprocessor.AddExtension(pe);
142 }
143
144 Compiler compiler = new Compiler();
145 compiler.ShowPedanticMessages = this.commandLine.ShowPedanticMessages;
146 compiler.CurrentPlatform = this.commandLine.Platform;
147
148 foreach (IExtensionData ed in this.extensionData)
149 {
150 compiler.AddExtensionData(ed);
151 }
152
153 foreach (ICompilerExtension ce in this.compilerExtensions)
154 {
155 compiler.AddExtension(ce);
156 }
157
158 // Preprocess then compile each source file.
159 foreach (CompileFile file in this.commandLine.Files)
160 {
161 // print friendly message saying what file is being compiled
162 Console.WriteLine(file.SourcePath);
163
164 // preprocess the source
165 XDocument sourceDocument;
166 try
167 {
168 if (!String.IsNullOrEmpty(this.commandLine.PreprocessFile))
169 {
170 preprocessor.PreprocessOut = this.commandLine.PreprocessFile.Equals("con:", StringComparison.OrdinalIgnoreCase) ? Console.Out : new StreamWriter(this.commandLine.PreprocessFile);
171 }
172
173 sourceDocument = preprocessor.Process(file.SourcePath, this.commandLine.PreprocessorVariables);
174 }
175 finally
176 {
177 if (null != preprocessor.PreprocessOut && Console.Out != preprocessor.PreprocessOut)
178 {
179 preprocessor.PreprocessOut.Close();
180 }
181 }
182
183 // If we're not actually going to compile anything, move on to the next file.
184 if (null == sourceDocument || !String.IsNullOrEmpty(this.commandLine.PreprocessFile))
185 {
186 continue;
187 }
188
189 // and now we do what we came here to do...
190 Intermediate intermediate = compiler.Compile(sourceDocument);
191
192 // save the intermediate to disk if no errors were found for this source file
193 if (null != intermediate)
194 {
195 intermediate.Save(file.OutputPath);
196 }
197 }
198 }
199 }
200}
diff --git a/src/candle/candle.csproj b/src/candle/candle.csproj
deleted file mode 100644
index cea0cf62..00000000
--- a/src/candle/candle.csproj
+++ /dev/null
@@ -1,62 +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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
6 <PropertyGroup>
7 <ProjectGuid>{956401A5-3C04-4786-9611-B2AEC6207686}</ProjectGuid>
8 <AssemblyName>candle</AssemblyName>
9 <OutputType>Exe</OutputType>
10 <RootNamespace>WixToolset.Tools</RootNamespace>
11 <PlatformTarget>x86</PlatformTarget>
12 </PropertyGroup>
13 <ItemGroup>
14 <Compile Include="AssemblyInfo.cs" />
15 <Compile Include="candle.cs" />
16 <Compile Include="CandleCommandLine.cs" />
17 <Compile Include="CompileFile.cs" />
18 <Compile Include="CandleStrings.Designer.cs">
19 <AutoGen>True</AutoGen>
20 <DesignTime>True</DesignTime>
21 <DependentUpon>CandleStrings.resx</DependentUpon>
22 </Compile>
23 </ItemGroup>
24 <ItemGroup>
25 <EmbeddedNativeResource Include="candle.rc" />
26 </ItemGroup>
27 <ItemGroup>
28 <None Include="app.config" />
29 </ItemGroup>
30 <ItemGroup>
31 <EmbeddedResource Include="CandleStrings.resx">
32 <SubType>Designer</SubType>
33 <Generator>ResXFileCodeGenerator</Generator>
34 <LastGenOutput>CandleStrings.Designer.cs</LastGenOutput>
35 </EmbeddedResource>
36 </ItemGroup>
37 <ItemGroup>
38 <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
39 </ItemGroup>
40 <ItemGroup>
41 <Reference Include="System" />
42 <Reference Include="System.Xml" />
43 <ProjectReference Include="..\..\libs\WixToolset.Data\WixToolset.Data.csproj">
44 <Project>{6a98499e-40ec-4335-9c31-96a2511d47c6}</Project>
45 <Name>WixToolset.Data</Name>
46 </ProjectReference>
47 <ProjectReference Include="..\..\libs\WixToolset.Extensibility\WixToolset.Extensibility.csproj">
48 <Project>{eee88c2a-45a0-4e48-a40a-431a4ba458d8}</Project>
49 <Name>WixToolset.Extensibility</Name>
50 </ProjectReference>
51 <ProjectReference Include="..\wconsole\wconsole.csproj">
52 <Project>{4B2BD779-59F7-4BF1-871C-A75952BCA749}</Project>
53 <Name>wconsole</Name>
54 </ProjectReference>
55 <ProjectReference Include="..\wix\Wix.csproj">
56 <Project>{9E03A94C-C70E-45C6-A269-E737BBD8B319}</Project>
57 <Name>Wix</Name>
58 </ProjectReference>
59 <Reference Include="System.Xml.Linq" />
60 </ItemGroup>
61 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" />
62</Project>
diff --git a/src/candle/candle.exe.manifest b/src/candle/candle.exe.manifest
deleted file mode 100644
index b05ab18b..00000000
--- a/src/candle/candle.exe.manifest
+++ /dev/null
@@ -1,9 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
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<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
6 <assemblyIdentity name="WixToolset.Tools.Candle" version="2.0.0.0" processorArchitecture="x86" type="win32"/>
7 <description>WiX Toolset Compiler</description>
8 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"/></requestedPrivileges></security></trustInfo>
9</assembly>
diff --git a/src/candle/candle.rc b/src/candle/candle.rc
deleted file mode 100644
index 47864811..00000000
--- a/src/candle/candle.rc
+++ /dev/null
@@ -1,10 +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
3#define VER_APP
4#define VER_ORIGINAL_FILENAME "candle.exe"
5#define VER_INTERNAL_NAME "candle"
6#define VER_FILE_DESCRIPTION "WiX Toolset Compiler"
7#include "wix.rc"
8
9#define MANIFEST_RESOURCE_ID 1
10MANIFEST_RESOURCE_ID RT_MANIFEST "candle.exe.manifest"
diff --git a/src/light/App.ico b/src/light/App.ico
deleted file mode 100644
index 3a5525fd..00000000
--- a/src/light/App.ico
+++ /dev/null
Binary files differ
diff --git a/src/light/AssemblyInfo.cs b/src/light/AssemblyInfo.cs
deleted file mode 100644
index ab2fc0ab..00000000
--- a/src/light/AssemblyInfo.cs
+++ /dev/null
@@ -1,9 +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
3using System;
4using System.Reflection;
5using System.Runtime.CompilerServices;
6using System.Runtime.InteropServices;
7
8[assembly: AssemblyCulture("")]
9[assembly: ComVisible(false)]
diff --git a/src/light/LightCommandLine.cs b/src/light/LightCommandLine.cs
deleted file mode 100644
index 2aa9ea59..00000000
--- a/src/light/LightCommandLine.cs
+++ /dev/null
@@ -1,421 +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.Tools
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9 using WixToolset.Data;
10 using WixToolset.Extensibility;
11 using WixToolset.Extensibility.Services;
12
13 public class LightCommandLine
14 {
15 public LightCommandLine(IMessaging messaging)
16 {
17 this.Messaging = messaging;
18 this.ShowLogo = true;
19 this.Tidy = true;
20
21 this.CubeFiles = new List<string>();
22 this.SuppressIces = new List<string>();
23 this.Ices = new List<string>();
24 this.BindPaths = new List<BindPath>();
25 this.Files = new List<string>();
26 this.LocalizationFiles = new List<string>();
27 this.Variables = new Dictionary<string, string>();
28 }
29
30 public IMessaging Messaging { get; }
31
32 public string PdbFile { get; private set; }
33
34 public CompressionLevel? DefaultCompressionLevel { get; set; }
35
36 public bool SuppressAclReset { get; private set; }
37
38 public bool SuppressLayout { get; private set; }
39
40 public bool SuppressWixPdb { get; private set; }
41
42 public bool SuppressValidation { get; private set; }
43
44 public string IntermediateFolder { get; private set; }
45
46 public string OutputsFile { get; private set; }
47
48 public string BuiltOutputsFile { get; private set; }
49
50 public string WixprojectFile { get; private set; }
51
52 public string ContentsFile { get; private set; }
53
54 public List<string> Ices { get; private set; }
55
56 public string CabCachePath { get; private set; }
57
58 public int CabbingThreadCount { get; private set; }
59
60 public List<string> CubeFiles { get; private set; }
61
62 public List<string> SuppressIces { get; private set; }
63
64 public bool ShowLogo { get; private set; }
65
66 public bool ShowHelp { get; private set; }
67
68 public bool ShowPedanticMessages { get; private set; }
69
70 public bool SuppressLocalization { get; private set; }
71
72 public bool SuppressVersionCheck { get; private set; }
73
74 public string[] Cultures { get; private set; }
75
76 public string OutputFile { get; private set; }
77
78 public bool OutputXml { get; private set; }
79
80 public List<BindPath> BindPaths { get; private set; }
81
82 public List<string> Files { get; private set; }
83
84 public List<string> LocalizationFiles { get; private set; }
85
86 public bool Tidy { get; private set; }
87
88 public string UnreferencedSymbolsFile { get; private set; }
89
90 public IDictionary<string, string> Variables { get; private set; }
91
92 /// <summary>
93 /// Parse the commandline arguments.
94 /// </summary>
95 /// <param name="args">Commandline arguments.</param>
96 public string[] Parse(ICommandLineContext context)
97 {
98 var unprocessed = new List<string>();
99
100 var extensions = context.ExtensionManager.Create<IExtensionCommandLine>();
101
102 foreach (var extension in extensions)
103 {
104 extension.PreParse(context);
105 }
106
107 var parser = context.Arguments.Parse();
108
109 while (!this.ShowHelp &&
110 String.IsNullOrEmpty(parser.ErrorArgument) &&
111 parser.TryGetNextSwitchOrArgument(out var arg))
112 {
113 if (String.IsNullOrWhiteSpace(arg)) // skip blank arguments.
114 {
115 continue;
116 }
117
118 if (parser.IsSwitch(arg))
119 {
120 var parameter = arg.Substring(1);
121 if (parameter.Equals("b", StringComparison.Ordinal))
122 {
123 var result = parser.GetNextArgumentOrError(arg);
124 if (!String.IsNullOrEmpty(result))
125 {
126 var bindPath = BindPath.Parse(result);
127
128 this.BindPaths.Add(bindPath);
129 }
130 }
131 else if (parameter.StartsWith("cultures:", StringComparison.Ordinal))
132 {
133 string culturesString = arg.Substring(10).ToLower(CultureInfo.InvariantCulture);
134
135 // When null is used treat it as if cultures wasn't specified.
136 // This is needed for batching over the light task when using MSBuild which doesn't
137 // support empty items
138 if (culturesString.Equals("null", StringComparison.OrdinalIgnoreCase))
139 {
140 this.Cultures = null;
141 }
142 else
143 {
144 this.Cultures = culturesString.Split(';', ',');
145
146 for (int c = 0; c < this.Cultures.Length; ++c)
147 {
148 // Neutral is different from null. For neutral we still want to do WXL filtering.
149 // Set the culture to the empty string = identifier for the invariant culture
150 if (this.Cultures[c].Equals("neutral", StringComparison.OrdinalIgnoreCase))
151 {
152 this.Cultures[c] = String.Empty;
153 }
154 }
155 }
156 }
157 else if (parameter.StartsWith("dcl:", StringComparison.Ordinal))
158 {
159 string defaultCompressionLevel = arg.Substring(5);
160
161 if (String.IsNullOrEmpty(defaultCompressionLevel))
162 {
163 break;
164 }
165 else if (Enum.TryParse(defaultCompressionLevel, true, out CompressionLevel compressionLevel))
166 {
167 this.DefaultCompressionLevel = compressionLevel;
168 }
169 }
170 else if (parameter.StartsWith("d", StringComparison.Ordinal))
171 {
172 parameter = arg.Substring(2);
173 string[] value = parameter.Split("=".ToCharArray(), 2);
174
175 string preexisting;
176 if (1 == value.Length)
177 {
178 this.Messaging.Write(ErrorMessages.ExpectedWixVariableValue(value[0]));
179 }
180 else if (this.Variables.TryGetValue(value[0], out preexisting))
181 {
182 this.Messaging.Write(ErrorMessages.WixVariableCollision(null, value[0]));
183 }
184 else
185 {
186 this.Variables.Add(value[0], value[1]);
187 }
188 }
189 else if (parameter.Equals("loc", StringComparison.Ordinal))
190 {
191 parser.GetNextArgumentAsFilePathOrError(arg, "localization files", this.LocalizationFiles);
192 }
193 else if (parameter.Equals("nologo", StringComparison.Ordinal))
194 {
195 this.ShowLogo = false;
196 }
197 else if (parameter.Equals("notidy", StringComparison.Ordinal))
198 {
199 this.Tidy = false;
200 }
201 else if ("o" == parameter || "out" == parameter)
202 {
203 this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg);
204 }
205 else if (parameter.Equals("pedantic", StringComparison.Ordinal))
206 {
207 this.ShowPedanticMessages = true;
208 }
209 else if (parameter.Equals("sloc", StringComparison.Ordinal))
210 {
211 this.SuppressLocalization = true;
212 }
213 else if (parameter.Equals("usf", StringComparison.Ordinal))
214 {
215 this.UnreferencedSymbolsFile = parser.GetNextArgumentAsDirectoryOrError(arg);
216 }
217 else if (parameter.Equals("xo", StringComparison.Ordinal))
218 {
219 this.OutputXml = true;
220 }
221 else if (parameter.Equals("cc", StringComparison.Ordinal))
222 {
223 this.CabCachePath = parser.GetNextArgumentAsDirectoryOrError(arg);
224 }
225 else if (parameter.Equals("ct", StringComparison.Ordinal))
226 {
227 var result = parser.GetNextArgumentOrError(arg);
228 if (!String.IsNullOrEmpty(result))
229 {
230 if (!Int32.TryParse(result, out var ct) || 0 >= ct)
231 {
232 this.Messaging.Write(ErrorMessages.IllegalCabbingThreadCount(result));
233 parser.ErrorArgument = arg;
234 break;
235 }
236
237 this.CabbingThreadCount = ct;
238 this.Messaging.Write(VerboseMessages.SetCabbingThreadCount(this.CabbingThreadCount.ToString()));
239 }
240 }
241 else if (parameter.Equals("cub", StringComparison.Ordinal))
242 {
243 parser.GetNextArgumentAsFilePathOrError(arg, "static validation files", this.CubeFiles);
244 }
245 else if (parameter.StartsWith("ice:", StringComparison.Ordinal))
246 {
247 this.Ices.Add(parameter.Substring(4));
248 }
249 else if (parameter.Equals("intermediatefolder", StringComparison.OrdinalIgnoreCase))
250 {
251 this.IntermediateFolder = parser.GetNextArgumentAsDirectoryOrError(arg);
252 }
253 else if (parameter.Equals("contentsfile", StringComparison.Ordinal))
254 {
255 this.ContentsFile = parser.GetNextArgumentAsFilePathOrError(arg);
256 }
257 else if (parameter.Equals("outputsfile", StringComparison.Ordinal))
258 {
259 this.OutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
260 }
261 else if (parameter.Equals("builtoutputsfile", StringComparison.Ordinal))
262 {
263 this.BuiltOutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
264 }
265 else if (parameter.Equals("wixprojectfile", StringComparison.Ordinal))
266 {
267 this.WixprojectFile = parser.GetNextArgumentAsFilePathOrError(arg);
268 }
269 else if (parameter.Equals("pdbout", StringComparison.Ordinal))
270 {
271 this.PdbFile = parser.GetNextArgumentAsFilePathOrError(arg);
272 }
273 else if (parameter.StartsWith("sice:", StringComparison.Ordinal))
274 {
275 this.SuppressIces.Add(parameter.Substring(5));
276 }
277 else if (parameter.Equals("sl", StringComparison.Ordinal))
278 {
279 this.SuppressLayout = true;
280 }
281 else if (parameter.Equals("spdb", StringComparison.Ordinal))
282 {
283 this.SuppressWixPdb = true;
284 }
285 else if (parameter.Equals("sacl", StringComparison.Ordinal))
286 {
287 this.SuppressAclReset = true;
288 }
289 else if (parameter.Equals("sval", StringComparison.Ordinal))
290 {
291 this.SuppressValidation = true;
292 }
293 else if ("sv" == parameter)
294 {
295 this.SuppressVersionCheck = true;
296 }
297 else if (parameter.StartsWith("sw", StringComparison.Ordinal))
298 {
299 string paramArg = parameter.Substring(2);
300 if (0 == paramArg.Length)
301 {
302 this.Messaging.SuppressAllWarnings = true;
303 }
304 else
305 {
306 int suppressWarning = 0;
307 if (!Int32.TryParse(paramArg, out suppressWarning) || 0 >= suppressWarning)
308 {
309 this.Messaging.Write(ErrorMessages.IllegalSuppressWarningId(paramArg));
310 }
311 else
312 {
313 this.Messaging.SuppressWarningMessage(suppressWarning);
314 }
315 }
316 }
317 else if (parameter.StartsWith("wx", StringComparison.Ordinal))
318 {
319 string paramArg = parameter.Substring(2);
320 if (0 == paramArg.Length)
321 {
322 this.Messaging.WarningsAsError = true;
323 }
324 else
325 {
326 int elevateWarning = 0;
327 if (!Int32.TryParse(paramArg, out elevateWarning) || 0 >= elevateWarning)
328 {
329 this.Messaging.Write(ErrorMessages.IllegalWarningIdAsError(paramArg));
330 }
331 else
332 {
333 this.Messaging.ElevateWarningMessage(elevateWarning);
334 }
335 }
336 }
337 else if ("v" == parameter)
338 {
339 this.Messaging.ShowVerboseMessages = true;
340 }
341 else if ("?" == parameter || "help" == parameter)
342 {
343 this.ShowHelp = true;
344 break;
345 }
346 else if (!this.TryParseCommandLineArgumentWithExtension(arg, parser, extensions))
347 {
348 unprocessed.Add(arg);
349 }
350 }
351 else if (!this.TryParseCommandLineArgumentWithExtension(arg, parser, extensions))
352 {
353 unprocessed.Add(arg);
354 }
355 }
356
357 return this.ParsePostExtensions(parser, unprocessed.ToArray());
358 }
359
360 private string[] ParsePostExtensions(IParseCommandLine parser, string[] remaining)
361 {
362 var unprocessed = new List<string>();
363
364 for (int i = 0; i < remaining.Length; ++i)
365 {
366 var arg = remaining[i];
367
368 if (parser.IsSwitch(arg))
369 {
370 unprocessed.Add(arg);
371 }
372 else
373 {
374 parser.GetArgumentAsFilePathOrError(arg, "source files", this.Files);
375 }
376 }
377
378 if (0 == this.Files.Count)
379 {
380 this.ShowHelp = true;
381 }
382 else if (String.IsNullOrEmpty(this.OutputFile))
383 {
384 if (1 < this.Files.Count)
385 {
386 this.Messaging.Write(ErrorMessages.MustSpecifyOutputWithMoreThanOneInput());
387 }
388
389 // After the linker tells us what the output type actually is, we'll change the ".wix" to the correct extension.
390 this.OutputFile = Path.ChangeExtension(Path.GetFileName(this.Files[0]), ".wix");
391
392 // Add the directories of the input files as unnamed bind paths.
393 foreach (string file in this.Files)
394 {
395 var bindPath = new BindPath(Path.GetDirectoryName(Path.GetFullPath(file)));
396 this.BindPaths.Add(bindPath);
397 }
398 }
399
400 if (!this.SuppressWixPdb && String.IsNullOrEmpty(this.PdbFile) && !String.IsNullOrEmpty(this.OutputFile))
401 {
402 this.PdbFile = Path.ChangeExtension(this.OutputFile, ".wixpdb");
403 }
404
405 return unprocessed.ToArray();
406 }
407
408 private bool TryParseCommandLineArgumentWithExtension(string arg, IParseCommandLine parser, IEnumerable<IExtensionCommandLine> extensions)
409 {
410 foreach (var extension in extensions)
411 {
412 if (extension.TryParseArgument(parser, arg))
413 {
414 return true;
415 }
416 }
417
418 return false;
419 }
420 }
421}
diff --git a/src/light/LightStrings.Designer.cs b/src/light/LightStrings.Designer.cs
deleted file mode 100644
index 50e271fd..00000000
--- a/src/light/LightStrings.Designer.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.Tools {
4 using System;
5
6
7 /// <summary>
8 /// A strongly-typed resource class, for looking up localized strings, etc.
9 /// </summary>
10 // This class was auto-generated by the StronglyTypedResourceBuilder
11 // class via a tool like ResGen or Visual Studio.
12 // To add or remove a member, edit your .ResX file then rerun ResGen
13 // with the /str option, or rebuild your VS project.
14 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
15 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
16 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
17 internal class LightStrings {
18
19 private static global::System.Resources.ResourceManager resourceMan;
20
21 private static global::System.Globalization.CultureInfo resourceCulture;
22
23 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
24 internal LightStrings() {
25 }
26
27 /// <summary>
28 /// Returns the cached ResourceManager instance used by this class.
29 /// </summary>
30 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
31 internal static global::System.Resources.ResourceManager ResourceManager {
32 get {
33 if (object.ReferenceEquals(resourceMan, null)) {
34 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WixToolset.Tools.LightStrings", typeof(LightStrings).Assembly);
35 resourceMan = temp;
36 }
37 return resourceMan;
38 }
39 }
40
41 /// <summary>
42 /// Overrides the current thread's CurrentUICulture property for all
43 /// resource lookups using this strongly typed resource class.
44 /// </summary>
45 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
46 internal static global::System.Globalization.CultureInfo Culture {
47 get {
48 return resourceCulture;
49 }
50 set {
51 resourceCulture = value;
52 }
53 }
54
55 /// <summary>
56 /// Looks up a localized string similar to -b &lt;path&gt; specify a binder path to locate all files
57 /// (default: current directory)
58 /// prefix the path with &apos;name=&apos; where &apos;name&apos; is the name of your
59 /// named bindpath.
60 /// -cc &lt;path&gt; path to cache built cabinets (will not be deleted after linking)
61 /// -ct &lt;N&gt; number of threads to use when creating cabinets
62 /// (default: %NUMBER_OF_PROCESSORS%)
63 /// -cub &lt;file.cub&gt; additional .cub file containing ICEs to run
64 /// -dcl:level set default cabinet compression l [rest of string was truncated]&quot;;.
65 /// </summary>
66 internal static string CommandLineArguments {
67 get {
68 return ResourceManager.GetString("CommandLineArguments", resourceCulture);
69 }
70 }
71
72 /// <summary>
73 /// Looks up a localized string similar to The -bf (bind files) option is only applicable with the -xo option..
74 /// </summary>
75 internal static string EXP_BindFileOptionNotApplicable {
76 get {
77 return ResourceManager.GetString("EXP_BindFileOptionNotApplicable", resourceCulture);
78 }
79 }
80
81 /// <summary>
82 /// Looks up a localized string similar to Cannot link object files (.wixobj) files with an output file (.wixout).
83 /// </summary>
84 internal static string EXP_CannotLinkObjFilesWithOutpuFile {
85 get {
86 return ResourceManager.GetString("EXP_CannotLinkObjFilesWithOutpuFile", resourceCulture);
87 }
88 }
89
90 /// <summary>
91 /// Looks up a localized string similar to usage: light.exe [-?] [-b bindPath] [-nologo] [-out outputFile] objectFile [objectFile ...] [@responseFile]
92 ///
93 ///{0}
94 ///
95 ///Environment variables:
96 /// WIX_TEMP overrides the temporary directory used for cab creation, msm exploding, ....
97 /// </summary>
98 internal static string HelpMessage {
99 get {
100 return ResourceManager.GetString("HelpMessage", resourceCulture);
101 }
102 }
103 }
104}
diff --git a/src/light/LightStrings.resx b/src/light/LightStrings.resx
deleted file mode 100644
index 3f586a5d..00000000
--- a/src/light/LightStrings.resx
+++ /dev/null
@@ -1,174 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 <data name="CommandLineArguments" xml:space="preserve">
121 <value> -b &lt;path&gt; specify a binder path to locate all files
122 (default: current directory)
123 prefix the path with 'name=' where 'name' is the name of your
124 named bindpath.
125 -cc &lt;path&gt; path to cache built cabinets (will not be deleted after linking)
126 -ct &lt;N&gt; number of threads to use when creating cabinets
127 (default: %NUMBER_OF_PROCESSORS%)
128 -cub &lt;file.cub&gt; additional .cub file containing ICEs to run
129 -dcl:level set default cabinet compression level
130 (low, medium, high, none, mszip; mszip default)
131 -eav exact assembly versions (breaks .NET 1.1 RTM compatibility)
132 -ice:&lt;ICE&gt; run a specific internal consistency evaluator (ICE)
133 -pdbout &lt;output.wixpdb&gt; save the WixPdb to a specific file
134 (default: same name as output with wixpdb extension)
135 -reusecab reuse cabinets from cabinet cache
136 -sacl suppress resetting ACLs
137 (useful when laying out image to a network share)
138 -sice:&lt;ICE&gt; suppress an internal consistency evaluator (ICE)
139 -sl suppress layout
140 -spdb suppress outputting the WixPdb
141 -sval suppress MSI/MSM validation
142 -cultures:&lt;cultures&gt; semicolon or comma delimited list of localized
143 string cultures to load from .wxl files and libraries.
144 Precedence of cultures is from left to right.
145 -d&lt;name&gt;[=&lt;value&gt;] define a wix variable, with or without a value.
146 -ext &lt;extension&gt; extension assembly or "class, assembly"
147 -loc &lt;loc.wxl&gt; read localization strings from .wxl file
148 -nologo skip printing light logo information
149 -notidy do not delete temporary files (useful for debugging)
150 -o[ut] specify output file (default: write to current directory)
151 -pedantic show pedantic messages
152 -sloc suppress localization
153 -sw[N] suppress all warnings or a specific message ID
154 (example: -sw1009 -sw1103)
155 -usf &lt;output.xml&gt; unreferenced symbols file
156 -v verbose output
157 -wx[N] treat all warnings or a specific message ID as an error
158 (example: -wx1009 -wx1103)
159 -xo output wixout format instead of MSI format
160 -? | -help this help information</value>
161 </data>
162 <data name="EXP_CannotLinkObjFilesWithOutpuFile" xml:space="preserve">
163 <value>Cannot link object files (.wixobj) files with an output file (.wixout)</value>
164 </data>
165 <data name="HelpMessage" xml:space="preserve">
166 <value> usage: light.exe [-?] [-b bindPath] [-nologo] [-out outputFile] objectFile [objectFile ...] [@responseFile]
167
168{0}
169
170Environment variables:
171 WIX_TEMP overrides the temporary directory used for cab creation, msm exploding, ...</value>
172 <comment>{0} is replaced by a list of light's arguments.</comment>
173 </data>
174</root>
diff --git a/src/light/app.config b/src/light/app.config
deleted file mode 100644
index 71c529fb..00000000
--- a/src/light/app.config
+++ /dev/null
@@ -1,9 +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<configuration>
6 <runtime>
7 <loadFromRemoteSources enabled="true"/>
8 </runtime>
9</configuration>
diff --git a/src/light/light.cs b/src/light/light.cs
deleted file mode 100644
index 0f467bbb..00000000
--- a/src/light/light.cs
+++ /dev/null
@@ -1,574 +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.Tools
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9 using System.Linq;
10 using System.Runtime.InteropServices;
11 using System.Text;
12 using System.Threading;
13 using WixToolset.Core;
14 using WixToolset.Data;
15 using WixToolset.Data.Bind;
16 using WixToolset.Extensibility;
17 using WixToolset.Extensibility.Services;
18
19 /// <summary>
20 /// The main entry point for light.
21 /// </summary>
22 public sealed class Light
23 {
24 LightCommandLine commandLine;
25 //private IEnumerable<IBinderExtension> binderExtensions;
26 //private IEnumerable<IBinderFileManager> fileManagers;
27
28 /// <summary>
29 /// The main entry point for light.
30 /// </summary>
31 /// <param name="args">Commandline arguments for the application.</param>
32 /// <returns>Returns the application error code.</returns>
33 [MTAThread]
34 public static int Main(string[] args)
35 {
36 var serviceProvider = new WixToolsetServiceProvider();
37
38 var listener = new ConsoleMessageListener("WIX", "light.exe");
39
40 Light light = new Light();
41 return light.Run(serviceProvider, listener, args);
42 }
43
44 /// <summary>
45 /// Main running method for the application.
46 /// </summary>
47 /// <param name="args">Commandline arguments to the application.</param>
48 /// <returns>Returns the application error code.</returns>
49 public int Run(IServiceProvider serviceProvider, IMessageListener listener, string[] args)
50 {
51 var messaging = serviceProvider.GetService<IMessaging>();
52 messaging.SetListener(listener);
53
54 try
55 {
56 var unparsed = this.ParseCommandLineAndLoadExtensions(serviceProvider, messaging, args);
57
58 if (!messaging.EncounteredError)
59 {
60 if (this.commandLine.ShowLogo)
61 {
62 AppCommon.DisplayToolHeader();
63 }
64
65 if (this.commandLine.ShowHelp)
66 {
67 PrintHelp();
68 AppCommon.DisplayToolFooter();
69 }
70 else
71 {
72 foreach (string arg in unparsed)
73 {
74 messaging.Write(WarningMessages.UnsupportedCommandLineArgument(arg));
75 }
76
77 this.Bind(serviceProvider, messaging);
78 }
79 }
80 }
81 catch (WixException we)
82 {
83 messaging.Write(we.Error);
84 }
85 catch (Exception e)
86 {
87 messaging.Write(ErrorMessages.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace));
88 if (e is NullReferenceException || e is SEHException)
89 {
90 throw;
91 }
92 }
93
94 return messaging.LastErrorNumber;
95 }
96
97 /// <summary>
98 /// Parse command line and load all the extensions.
99 /// </summary>
100 /// <param name="args">Command line arguments to be parsed.</param>
101 private IEnumerable<string> ParseCommandLineAndLoadExtensions(IServiceProvider serviceProvider, IMessaging messaging, string[] args)
102 {
103 var arguments = serviceProvider.GetService<ICommandLineArguments>();
104 arguments.Populate(args);
105
106 var extensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
107
108 var context = serviceProvider.GetService<ICommandLineContext>();
109 context.ExtensionManager = extensionManager;
110 context.Messaging = messaging;
111 context.Arguments = arguments;
112
113 this.commandLine = new LightCommandLine(messaging);
114 var unprocessed = this.commandLine.Parse(context);
115
116 return unprocessed;
117 }
118
119 private void Bind(IServiceProvider serviceProvider, IMessaging messaging)
120 {
121 var output = this.LoadWixout(messaging);
122
123 if (messaging.EncounteredError)
124 {
125 return;
126 }
127
128 var intermediateFolder = this.commandLine.IntermediateFolder;
129 if (String.IsNullOrEmpty(intermediateFolder))
130 {
131 intermediateFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
132 }
133
134 var localizations = this.LoadLocalizationFiles(messaging, this.commandLine.LocalizationFiles);
135
136 if (messaging.EncounteredError)
137 {
138 return;
139 }
140
141 ResolveResult resolveResult;
142 {
143 var resolver = new Resolver(serviceProvider);
144 resolver.BindPaths = this.commandLine.BindPaths;
145 resolver.IntermediateFolder = intermediateFolder;
146 resolver.IntermediateRepresentation = output;
147 resolver.Localizations = localizations;
148
149 resolveResult = resolver.Execute();
150 }
151
152 if (messaging.EncounteredError)
153 {
154 return;
155 }
156
157 BindResult bindResult;
158 {
159 var binder = new Binder(serviceProvider);
160 binder.CabbingThreadCount = this.commandLine.CabbingThreadCount;
161 binder.CabCachePath = this.commandLine.CabCachePath;
162 binder.Codepage = resolveResult.Codepage;
163 binder.DefaultCompressionLevel = this.commandLine.DefaultCompressionLevel;
164 binder.DelayedFields = resolveResult.DelayedFields;
165 binder.ExpectedEmbeddedFiles = resolveResult.ExpectedEmbeddedFiles;
166 binder.Ices = this.commandLine.Ices;
167 binder.IntermediateFolder = intermediateFolder;
168 binder.IntermediateRepresentation = resolveResult.IntermediateRepresentation;
169 binder.OutputPath = this.commandLine.OutputFile;
170 binder.OutputPdbPath = Path.ChangeExtension(this.commandLine.OutputFile, ".wixpdb");
171 binder.SuppressIces = this.commandLine.SuppressIces;
172 binder.SuppressValidation = this.commandLine.SuppressValidation;
173
174 bindResult = binder.Execute();
175 }
176
177 if (messaging.EncounteredError)
178 {
179 return;
180 }
181
182 {
183 var layout = new Layout(serviceProvider);
184 layout.FileTransfers = bindResult.FileTransfers;
185 layout.ContentFilePaths = bindResult.ContentFilePaths;
186 layout.ContentsFile = this.commandLine.ContentsFile;
187 layout.OutputsFile = this.commandLine.OutputsFile;
188 layout.BuiltOutputsFile = this.commandLine.BuiltOutputsFile;
189 layout.SuppressAclReset = this.commandLine.SuppressAclReset;
190
191 layout.Execute();
192 }
193 }
194
195 private void Run(IMessaging messaging)
196 {
197#if false
198 // Initialize the variable resolver from the command line.
199 WixVariableResolver wixVariableResolver = new WixVariableResolver();
200 foreach (var wixVar in this.commandLine.Variables)
201 {
202 wixVariableResolver.AddVariable(wixVar.Key, wixVar.Value);
203 }
204
205 // Initialize the linker from the command line.
206 Linker linker = new Linker();
207 linker.UnreferencedSymbolsFile = this.commandLine.UnreferencedSymbolsFile;
208 linker.ShowPedanticMessages = this.commandLine.ShowPedanticMessages;
209 linker.WixVariableResolver = wixVariableResolver;
210
211 foreach (IExtensionData data in this.extensionData)
212 {
213 linker.AddExtensionData(data);
214 }
215
216 // Initialize the binder from the command line.
217 WixToolset.Binder binder = new WixToolset.Binder();
218 binder.CabCachePath = this.commandLine.CabCachePath;
219 binder.ContentsFile = this.commandLine.ContentsFile;
220 binder.BuiltOutputsFile = this.commandLine.BuiltOutputsFile;
221 binder.OutputsFile = this.commandLine.OutputsFile;
222 binder.WixprojectFile = this.commandLine.WixprojectFile;
223 binder.BindPaths.AddRange(this.commandLine.BindPaths);
224 binder.CabbingThreadCount = this.commandLine.CabbingThreadCount;
225 if (this.commandLine.DefaultCompressionLevel.HasValue)
226 {
227 binder.DefaultCompressionLevel = this.commandLine.DefaultCompressionLevel.Value;
228 }
229 binder.Ices.AddRange(this.commandLine.Ices);
230 binder.SuppressIces.AddRange(this.commandLine.SuppressIces);
231 binder.SuppressAclReset = this.commandLine.SuppressAclReset;
232 binder.SuppressLayout = this.commandLine.SuppressLayout;
233 binder.SuppressValidation = this.commandLine.SuppressValidation;
234 binder.PdbFile = this.commandLine.SuppressWixPdb ? null : this.commandLine.PdbFile;
235 binder.TempFilesLocation = AppCommon.GetTempLocation();
236 binder.WixVariableResolver = wixVariableResolver;
237
238 foreach (IBinderExtension extension in this.binderExtensions)
239 {
240 binder.AddExtension(extension);
241 }
242
243 foreach (IBinderFileManager fileManager in this.fileManagers)
244 {
245 binder.AddExtension(fileManager);
246 }
247
248 // Initialize the localizer.
249 Localizer localizer = this.InitializeLocalization(linker.TableDefinitions);
250 if (messaging.EncounteredError)
251 {
252 return;
253 }
254
255 wixVariableResolver.Localizer = localizer;
256 linker.Localizer = localizer;
257 binder.Localizer = localizer;
258
259 // Loop through all the believed object files.
260 List<Section> sections = new List<Section>();
261 Output output = null;
262 foreach (string inputFile in this.commandLine.Files)
263 {
264 string inputFileFullPath = Path.GetFullPath(inputFile);
265 FileFormat format = FileStructure.GuessFileFormatFromExtension(Path.GetExtension(inputFileFullPath));
266 bool retry;
267 do
268 {
269 retry = false;
270
271 try
272 {
273 switch (format)
274 {
275 case FileFormat.Wixobj:
276 Intermediate intermediate = Intermediate.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck);
277 sections.AddRange(intermediate.Sections);
278 break;
279
280 case FileFormat.Wixlib:
281 Library library = Library.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck);
282 AddLibraryLocalizationsToLocalizer(library, this.commandLine.Cultures, localizer);
283 sections.AddRange(library.Sections);
284 break;
285
286 default:
287 output = Output.Load(inputFileFullPath, this.commandLine.SuppressVersionCheck);
288 break;
289 }
290 }
291 catch (WixUnexpectedFileFormatException e)
292 {
293 format = e.FileFormat;
294 retry = (FileFormat.Wixobj == format || FileFormat.Wixlib == format || FileFormat.Wixout == format); // .wixobj, .wixout and .wixout are supported by light.
295 if (!retry)
296 {
297 messaging.OnMessage(e.Error);
298 }
299 }
300 } while (retry);
301 }
302
303 // Stop processing if any errors were found loading object files.
304 if (messaging.EncounteredError)
305 {
306 return;
307 }
308
309 // and now for the fun part
310 if (null == output)
311 {
312 OutputType expectedOutputType = OutputType.Unknown;
313 if (!String.IsNullOrEmpty(this.commandLine.OutputFile))
314 {
315 expectedOutputType = Output.GetOutputType(Path.GetExtension(this.commandLine.OutputFile));
316 }
317
318 output = linker.Link(sections, expectedOutputType);
319
320 // If an error occurred during linking, stop processing.
321 if (null == output)
322 {
323 return;
324 }
325 }
326 else if (0 != sections.Count)
327 {
328 throw new InvalidOperationException(LightStrings.EXP_CannotLinkObjFilesWithOutpuFile);
329 }
330
331 bool tidy = true; // clean up after ourselves by default.
332 try
333 {
334 // only output the xml if its a patch build or user specfied to only output wixout
335 string outputFile = this.commandLine.OutputFile;
336 string outputExtension = Path.GetExtension(outputFile);
337 if (this.commandLine.OutputXml || OutputType.Patch == output.Type)
338 {
339 if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal))
340 {
341 outputExtension = (OutputType.Patch == output.Type) ? ".wixmsp" : ".wixout";
342 outputFile = Path.ChangeExtension(outputFile, outputExtension);
343 }
344
345 output.Save(outputFile);
346 }
347 else // finish creating the MSI/MSM
348 {
349 if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal))
350 {
351 outputExtension = Output.GetExtension(output.Type);
352 outputFile = Path.ChangeExtension(outputFile, outputExtension);
353 }
354
355 binder.Bind(output, outputFile);
356 }
357 }
358 catch (WixException we) // keep files around for debugging IDT issues.
359 {
360 if (we is WixInvalidIdtException)
361 {
362 tidy = false;
363 }
364
365 throw;
366 }
367 catch (Exception) // keep files around for debugging unexpected exceptions.
368 {
369 tidy = false;
370 throw;
371 }
372 finally
373 {
374 if (null != binder)
375 {
376 binder.Cleanup(tidy);
377 }
378 }
379
380 return;
381#endif
382 }
383
384#if false
385 private Localizer InitializeLocalization(TableDefinitionCollection tableDefinitions)
386 {
387 Localizer localizer = null;
388
389 // Instantiate the localizer and load any localization files.
390 if (!this.commandLine.SuppressLocalization || 0 < this.commandLine.LocalizationFiles.Count || null != this.commandLine.Cultures || !this.commandLine.OutputXml)
391 {
392 List<Localization> localizations = new List<Localization>();
393
394 // Load each localization file.
395 foreach (string localizationFile in this.commandLine.LocalizationFiles)
396 {
397 Localization localization = Localizer.ParseLocalizationFile(localizationFile, tableDefinitions);
398 if (null != localization)
399 {
400 localizations.Add(localization);
401 }
402 }
403
404 localizer = new Localizer();
405 if (null != this.commandLine.Cultures)
406 {
407 // Alocalizations in order specified in cultures.
408 foreach (string culture in this.commandLine.Cultures)
409 {
410 foreach (Localization localization in localizations)
411 {
412 if (culture.Equals(localization.Culture, StringComparison.OrdinalIgnoreCase))
413 {
414 localizer.AddLocalization(localization);
415 }
416 }
417 }
418 }
419 else // no cultures specified, so try neutral culture and if none of those add all loc files.
420 {
421 bool neutralFound = false;
422 foreach (Localization localization in localizations)
423 {
424 if (String.IsNullOrEmpty(localization.Culture))
425 {
426 // If a neutral wxl was provided use it.
427 localizer.AddLocalization(localization);
428 neutralFound = true;
429 }
430 }
431
432 if (!neutralFound)
433 {
434 // No cultures were specified and no neutral wxl are available, include all of the loc files.
435 foreach (Localization localization in localizations)
436 {
437 localizer.AddLocalization(localization);
438 }
439 }
440 }
441
442 // Load localizations provided by extensions with data.
443 foreach (IExtensionData data in this.extensionData)
444 {
445 Library library = data.GetLibrary(tableDefinitions);
446 if (null != library)
447 {
448 // Load the extension's default culture if it provides one and no cultures were specified.
449 string[] extensionCultures = this.commandLine.Cultures;
450 if (null == extensionCultures && null != data.DefaultCulture)
451 {
452 extensionCultures = new string[] { data.DefaultCulture };
453 }
454
455 AddLibraryLocalizationsToLocalizer(library, extensionCultures, localizer);
456 }
457 }
458 }
459
460 return localizer;
461 }
462
463 private void AddLibraryLocalizationsToLocalizer(Library library, string[] cultures, Localizer localizer)
464 {
465 foreach (Localization localization in library.GetLocalizations(cultures))
466 {
467 localizer.AddLocalization(localization);
468 }
469 }
470#endif
471
472 private bool TryParseCommandLineArgumentWithExtension(string arg, IEnumerable<IExtensionCommandLine> extensions)
473 {
474 foreach (var extension in extensions)
475 {
476 // TODO: decide what to do with "IParseCommandLine" argument.
477 if (extension.TryParseArgument(null, arg))
478 {
479 return true;
480 }
481 }
482
483 return false;
484 }
485
486 private IEnumerable<Localization> LoadLocalizationFiles(IMessaging messaging, IEnumerable<string> locFiles)
487 {
488 foreach (var loc in locFiles)
489 {
490 var localization = Localizer.ParseLocalizationFile(messaging, loc);
491
492 yield return localization;
493 }
494 }
495
496 private Intermediate LoadWixout(IMessaging messaging)
497 {
498 var path = this.commandLine.Files.Single();
499
500 return Intermediate.Load(path);
501 }
502
503 private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, IEnumerable<string> extensions)
504 {
505 var extensionManager = serviceProvider.GetService<IExtensionManager>();
506
507 foreach (var type in new[] { typeof(WixToolset.Core.Burn.WixToolsetStandardBackend), typeof(WixToolset.Core.WindowsInstaller.WixToolsetStandardBackend) })
508 {
509 extensionManager.Add(type.Assembly);
510 }
511
512 foreach (var extension in extensions)
513 {
514 extensionManager.Load(extension);
515 }
516
517 return extensionManager;
518 }
519
520 private static void PrintHelp()
521 {
522 string lightArgs = LightStrings.CommandLineArguments;
523
524 Console.WriteLine(String.Format(LightStrings.HelpMessage, lightArgs));
525 }
526
527 private class ConsoleMessageListener : IMessageListener
528 {
529 public ConsoleMessageListener(string shortName, string longName)
530 {
531 this.ShortAppName = shortName;
532 this.LongAppName = longName;
533
534 PrepareConsoleForLocalization();
535 }
536
537 public string LongAppName { get; }
538
539 public string ShortAppName { get; }
540
541 public void Write(Message message)
542 {
543 var filename = message.SourceLineNumbers?.FileName ?? this.LongAppName;
544 var line = message.SourceLineNumbers?.LineNumber ?? -1;
545 var type = message.Level.ToString().ToLowerInvariant();
546 var output = message.Level >= MessageLevel.Warning ? Console.Out : Console.Error;
547
548 if (line > 0)
549 {
550 filename = String.Concat(filename, "(", line, ")");
551 }
552
553 output.WriteLine("{0} : {1} {2}{3:0000}: {4}", filename, type, this.ShortAppName, message.Id, message.ToString());
554 }
555
556 public void Write(string message)
557 {
558 Console.Out.WriteLine(message);
559 }
560
561 private static void PrepareConsoleForLocalization()
562 {
563 Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture();
564
565 if (Console.OutputEncoding.CodePage != Encoding.UTF8.CodePage &&
566 Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage &&
567 Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage)
568 {
569 Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
570 }
571 }
572 }
573 }
574}
diff --git a/src/light/light.csproj b/src/light/light.csproj
deleted file mode 100644
index 95adba01..00000000
--- a/src/light/light.csproj
+++ /dev/null
@@ -1,24 +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 <TargetFramework>net461</TargetFramework>
7 <OutputType>Exe</OutputType>
8 <Description>Linker</Description>
9 <Title>WiX Toolset Linker</Title>
10 <DebugType>embedded</DebugType>
11 <PublishRepositoryUrl>true</PublishRepositoryUrl>
12 </PropertyGroup>
13
14 <ItemGroup>
15 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" />
16 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
17 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
18 </ItemGroup>
19
20 <ItemGroup>
21 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/>
22 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
23 </ItemGroup>
24</Project>
diff --git a/src/test/TestData/Example.Extension/Data/example.txt b/src/test/Example.Extension/Data/example.txt
index 1b4ffe8a..1b4ffe8a 100644
--- a/src/test/TestData/Example.Extension/Data/example.txt
+++ b/src/test/Example.Extension/Data/example.txt
diff --git a/src/test/TestData/Example.Extension/Data/example.wir b/src/test/Example.Extension/Data/example.wir
index 674f63fc..674f63fc 100644
--- a/src/test/TestData/Example.Extension/Data/example.wir
+++ b/src/test/Example.Extension/Data/example.wir
Binary files differ
diff --git a/src/test/TestData/Example.Extension/Data/example.wxs b/src/test/Example.Extension/Data/example.wxs
index 53531e99..53531e99 100644
--- a/src/test/TestData/Example.Extension/Data/example.wxs
+++ b/src/test/Example.Extension/Data/example.wxs
diff --git a/src/test/TestData/Example.Extension/Example.Extension.csproj b/src/test/Example.Extension/Example.Extension.csproj
index 1dde5044..1dde5044 100644
--- a/src/test/TestData/Example.Extension/Example.Extension.csproj
+++ b/src/test/Example.Extension/Example.Extension.csproj
diff --git a/src/test/TestData/Example.Extension/ExampleCompilerExtension.cs b/src/test/Example.Extension/ExampleCompilerExtension.cs
index cd9e1fb9..cd9e1fb9 100644
--- a/src/test/TestData/Example.Extension/ExampleCompilerExtension.cs
+++ b/src/test/Example.Extension/ExampleCompilerExtension.cs
diff --git a/src/test/TestData/Example.Extension/ExampleExtensionData.cs b/src/test/Example.Extension/ExampleExtensionData.cs
index 724f9eea..724f9eea 100644
--- a/src/test/TestData/Example.Extension/ExampleExtensionData.cs
+++ b/src/test/Example.Extension/ExampleExtensionData.cs
diff --git a/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs b/src/test/Example.Extension/ExampleExtensionFactory.cs
index a081b758..a081b758 100644
--- a/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs
+++ b/src/test/Example.Extension/ExampleExtensionFactory.cs
diff --git a/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs b/src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs
index 6f86e20d..6f86e20d 100644
--- a/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs
+++ b/src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs
diff --git a/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs b/src/test/Example.Extension/ExampleTableDefinitions.cs
index dbd6491b..dbd6491b 100644
--- a/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs
+++ b/src/test/Example.Extension/ExampleTableDefinitions.cs
diff --git a/src/test/TestData/Example.Extension/ExampleTuple.cs b/src/test/Example.Extension/ExampleTuple.cs
index 0fc0d82c..0fc0d82c 100644
--- a/src/test/TestData/Example.Extension/ExampleTuple.cs
+++ b/src/test/Example.Extension/ExampleTuple.cs
diff --git a/src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs b/src/test/Example.Extension/ExampleTupleDefinitions.cs
index 4775b827..4775b827 100644
--- a/src/test/TestData/Example.Extension/ExampleTupleDefinitions.cs
+++ b/src/test/Example.Extension/ExampleTupleDefinitions.cs
diff --git a/src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
index f00a5102..f00a5102 100644
--- a/src/test/TestData/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
+++ b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
diff --git a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs b/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs
deleted file mode 100644
index 8fd69414..00000000
--- a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs
+++ /dev/null
@@ -1,33 +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 WixToolsetTest.BuildTasks
4{
5 using System.Collections;
6 using System.Text;
7 using Microsoft.Build.Framework;
8
9 internal class FakeBuildEngine : IBuildEngine
10 {
11 private StringBuilder output = new StringBuilder();
12
13 public int ColumnNumberOfTaskNode => 0;
14
15 public bool ContinueOnError => false;
16
17 public int LineNumberOfTaskNode => 0;
18
19 public string ProjectFileOfTaskNode => "fake_wix.targets";
20
21 public string Output => this.output.ToString();
22
23 public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => throw new System.NotImplementedException();
24
25 public void LogCustomEvent(CustomBuildEventArgs e) => this.output.AppendLine(e.Message);
26
27 public void LogErrorEvent(BuildErrorEventArgs e) => this.output.AppendLine(e.Message);
28
29 public void LogMessageEvent(BuildMessageEventArgs e) => this.output.AppendLine(e.Message);
30
31 public void LogWarningEvent(BuildWarningEventArgs e) => this.output.AppendLine(e.Message);
32 }
33}
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
deleted file mode 100644
index a27928d5..00000000
--- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
+++ /dev/null
@@ -1,64 +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 WixToolsetTest.BuildTasks
4{
5 using System.IO;
6 using System.Linq;
7 using Microsoft.Build.Utilities;
8 using WixBuildTools.TestSupport;
9 using WixToolset.BuildTasks;
10 using WixToolset.Data;
11 using WixToolset.Data.Tuples;
12 using Xunit;
13
14 public partial class MsbuildFixture
15 {
16 [Fact]
17 public void CanBuildSimpleMsiPackage()
18 {
19 var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
20
21 using (var fs = new DisposableFileSystem())
22 {
23 var baseFolder = fs.GetFolder();
24 var intermediateFolder = Path.Combine(baseFolder, "obj");
25
26 var engine = new FakeBuildEngine();
27
28 var task = new DoIt
29 {
30 BuildEngine = engine,
31 SourceFiles = new[]
32 {
33 new TaskItem(Path.Combine(folder, "Package.wxs")),
34 new TaskItem(Path.Combine(folder, "PackageComponents.wxs")),
35 },
36 LocalizationFiles = new[]
37 {
38 new TaskItem(Path.Combine(folder, "Package.en-us.wxl")),
39 },
40 BindInputPaths = new[]
41 {
42 new TaskItem(Path.Combine(folder, "data")),
43 },
44 IntermediateDirectory = new TaskItem(intermediateFolder),
45 OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")),
46 };
47
48 var result = task.Execute();
49 Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}");
50
51 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
53 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab")));
54
55 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir"));
56 var section = intermediate.Sections.Single();
57
58 var wixFile = section.Tuples.OfType<WixFileTuple>().Single();
59 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
60 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
61 }
62 }
63 }
64}
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj
deleted file mode 100644
index e04ea43d..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj
+++ /dev/null
@@ -1,57 +0,0 @@
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 <ProductVersion>0.9</ProductVersion>
7 <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid>
8 <OutputName>MsiPackage</OutputName>
9 <OutputType>Package</OutputType>
10 <Name>MsiPackage</Name>
11 <RootNamespace>MsiPackage</RootNamespace>
12 <Cultures>en-US,en;de-DE</Cultures>
13 </PropertyGroup>
14
15 <PropertyGroup>
16 <WixTargetsPath>..\..\..\..\..\..\build\Release\publish\net461\wix.targets</WixTargetsPath>
17 </PropertyGroup>
18
19 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
20 <PlatformName>$(Platform)</PlatformName>
21 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
22 <DefineConstants>Debug</DefineConstants>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
25 <PlatformName>$(Platform)</PlatformName>
26 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
27 </PropertyGroup>
28 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
29 <PlatformName>$(Platform)</PlatformName>
30 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
31 <DefineConstants>Debug</DefineConstants>
32 </PropertyGroup>
33 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
34 <PlatformName>$(Platform)</PlatformName>
35 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
36 </PropertyGroup>
37
38 <ItemGroup>
39 <Compile Include="Package.wxs" />
40 <Compile Include="PackageComponents.wxs" />
41 </ItemGroup>
42
43 <ItemGroup>
44 <EmbeddedResource Include="Package.en-us.wxl" />
45 <EmbeddedResource Include="Package.de-de.wxl" />
46 </ItemGroup>
47
48 <ItemGroup>
49 <BindInputPaths Include="data" />
50 </ItemGroup>
51
52 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
53 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " />
54 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
55 <Error Text="WiX Toolset build tools (v3.11 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
56 </Target>
57</Project>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl
deleted file mode 100644
index 23493ace..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl
+++ /dev/null
@@ -1,11 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="de-DE">
7
8 <String Id="DowngradeError">German DowngradeError</String>
9 <String Id="FeatureTitle">German FeatureTitle</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl
deleted file mode 100644
index 38c12ac1..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl
+++ /dev/null
@@ -1,11 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 <String Id="FeatureTitle">MsiPackage</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs
deleted file mode 100644
index d5a5a40d..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs
+++ /dev/null
@@ -1,21 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
5
6 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7 <MediaTemplate />
8
9 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
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/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs
deleted file mode 100644
index e26c4509..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs
+++ /dev/null
@@ -1,10 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Source="test.txt" />
7 </Component>
8 </ComponentGroup>
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt
deleted file mode 100644
index cd0db0e1..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt
+++ /dev/null
@@ -1 +0,0 @@
1This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln
deleted file mode 100644
index 2c88704e..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln
+++ /dev/null
@@ -1,31 +0,0 @@
1
2Microsoft Visual Studio Solution File, Format Version 12.00
3# Visual Studio 15
4VisualStudioVersion = 15.0.26730.8
5MinimumVisualStudioVersion = 10.0.40219.1
6Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}"
7EndProject
8Global
9 GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 Debug|x64 = Debug|x64
11 Debug|x86 = Debug|x86
12 Release|x64 = Release|x64
13 Release|x86 = Release|x86
14 EndGlobalSection
15 GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64
17 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64
18 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86
19 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86
20 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64
21 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64
22 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86
23 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86
24 EndGlobalSection
25 GlobalSection(SolutionProperties) = preSolution
26 HideSolutionNode = FALSE
27 EndGlobalSection
28 GlobalSection(ExtensibilityGlobals) = postSolution
29 SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5}
30 EndGlobalSection
31EndGlobal
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
deleted file mode 100644
index 31c3ec9c..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
+++ /dev/null
@@ -1,55 +0,0 @@
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 <ProductVersion>0.9</ProductVersion>
7 <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid>
8 <OutputName>MsiPackage</OutputName>
9 <OutputType>Package</OutputType>
10 <Name>MsiPackage</Name>
11 <RootNamespace>MsiPackage</RootNamespace>
12 </PropertyGroup>
13
14 <PropertyGroup>
15 <WixTargetsPath>..\..\..\..\..\..\build\Release\publish\wix.targets</WixTargetsPath>
16 </PropertyGroup>
17
18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
19 <PlatformName>$(Platform)</PlatformName>
20 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
21 <DefineConstants>Debug</DefineConstants>
22 </PropertyGroup>
23 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
24 <PlatformName>$(Platform)</PlatformName>
25 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
28 <PlatformName>$(Platform)</PlatformName>
29 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 <DefineConstants>Debug</DefineConstants>
31 </PropertyGroup>
32 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
33 <PlatformName>$(Platform)</PlatformName>
34 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
35 </PropertyGroup>
36
37 <ItemGroup>
38 <Compile Include="Package.wxs" />
39 <Compile Include="PackageComponents.wxs" />
40 </ItemGroup>
41
42 <ItemGroup>
43 <EmbeddedResource Include="Package.en-us.wxl" />
44 </ItemGroup>
45
46 <ItemGroup>
47 <BindInputPaths Include="data" />
48 </ItemGroup>
49
50 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
51 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " />
52 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
53 <Error Text="WiX Toolset build tools (v3.11 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
54 </Target>
55</Project> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl
deleted file mode 100644
index 38c12ac1..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl
+++ /dev/null
@@ -1,11 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 <String Id="FeatureTitle">MsiPackage</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs
deleted file mode 100644
index d5a5a40d..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs
+++ /dev/null
@@ -1,21 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
5
6 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7 <MediaTemplate />
8
9 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
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/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs
deleted file mode 100644
index e26c4509..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs
+++ /dev/null
@@ -1,10 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Source="test.txt" />
7 </Component>
8 </ComponentGroup>
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt
deleted file mode 100644
index cd0db0e1..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt
+++ /dev/null
@@ -1 +0,0 @@
1This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln
deleted file mode 100644
index 2c88704e..00000000
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln
+++ /dev/null
@@ -1,31 +0,0 @@
1
2Microsoft Visual Studio Solution File, Format Version 12.00
3# Visual Studio 15
4VisualStudioVersion = 15.0.26730.8
5MinimumVisualStudioVersion = 10.0.40219.1
6Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}"
7EndProject
8Global
9 GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 Debug|x64 = Debug|x64
11 Debug|x86 = Debug|x86
12 Release|x64 = Release|x64
13 Release|x86 = Release|x86
14 EndGlobalSection
15 GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64
17 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64
18 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86
19 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86
20 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64
21 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64
22 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86
23 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86
24 EndGlobalSection
25 GlobalSection(SolutionProperties) = preSolution
26 HideSolutionNode = FALSE
27 EndGlobalSection
28 GlobalSection(ExtensibilityGlobals) = postSolution
29 SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5}
30 EndGlobalSection
31EndGlobal
diff --git a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
deleted file mode 100644
index 5ec5b7fd..00000000
--- a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
+++ /dev/null
@@ -1,32 +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 <TargetFramework>net461</TargetFramework>
7 <IsPackable>false</IsPackable>
8 <DebugType>embedded</DebugType>
9 </PropertyGroup>
10
11 <ItemGroup>
12 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
13 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
14 <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
15 <Content Include="TestData\SimpleMsiPackage\MsiPackage\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
16 </ItemGroup>
17
18 <ItemGroup>
19 <ProjectReference Include="..\..\WixToolset.BuildTasks\WixToolset.BuildTasks.csproj" />
20 </ItemGroup>
21
22 <ItemGroup>
23 <PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" PrivateAssets="All" />
24 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
25 </ItemGroup>
26
27 <ItemGroup>
28 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
29 <PackageReference Include="xunit" Version="2.3.1" />
30 <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
31 </ItemGroup>
32</Project>
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
index 5de61368..cc631c22 100644
--- a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
@@ -8,6 +8,7 @@ namespace WixToolsetTest.CoreIntegration
8 using Example.Extension; 8 using Example.Extension;
9 using WixBuildTools.TestSupport; 9 using WixBuildTools.TestSupport;
10 using WixToolset.Core; 10 using WixToolset.Core;
11 using WixToolset.Core.TestPackage;
11 using WixToolset.Data; 12 using WixToolset.Data;
12 using WixToolset.Data.Tuples; 13 using WixToolset.Data.Tuples;
13 using Xunit; 14 using Xunit;
@@ -37,8 +38,7 @@ namespace WixToolsetTest.CoreIntegration
37 { 38 {
38 var intermediateFolder = fs.GetFolder(); 39 var intermediateFolder = fs.GetFolder();
39 40
40 var program = new Program(); 41 var result = WixRunner.Execute(new[]
41 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
42 { 42 {
43 "build", 43 "build",
44 Path.Combine(folder, "Package.wxs"), 44 Path.Combine(folder, "Package.wxs"),
@@ -48,7 +48,7 @@ namespace WixToolsetTest.CoreIntegration
48 "-bindpath", Path.Combine(folder, "data"), 48 "-bindpath", Path.Combine(folder, "data"),
49 "-intermediateFolder", intermediateFolder, 49 "-intermediateFolder", intermediateFolder,
50 "-o", Path.Combine(intermediateFolder, @"bin\extest.msi") 50 "-o", Path.Combine(intermediateFolder, @"bin\extest.msi")
51 }); 51 }, out var messages);
52 52
53 Assert.Equal(0, result); 53 Assert.Equal(0, result);
54 54
@@ -80,8 +80,7 @@ namespace WixToolsetTest.CoreIntegration
80 { 80 {
81 var intermediateFolder = fs.GetFolder(); 81 var intermediateFolder = fs.GetFolder();
82 82
83 var program = new Program(); 83 var result = WixRunner.Execute(new[]
84 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
85 { 84 {
86 "build", 85 "build",
87 Path.Combine(folder, "Package.wxs"), 86 Path.Combine(folder, "Package.wxs"),
@@ -92,7 +91,7 @@ namespace WixToolsetTest.CoreIntegration
92 "-intermediateFolder", intermediateFolder, 91 "-intermediateFolder", intermediateFolder,
93 "-example", "test", 92 "-example", "test",
94 "-o", Path.Combine(intermediateFolder, @"bin\extest.msi") 93 "-o", Path.Combine(intermediateFolder, @"bin\extest.msi")
95 }); 94 }, out var messages);
96 95
97 Assert.Equal(0, result); 96 Assert.Equal(0, result);
98 97
@@ -107,8 +106,7 @@ namespace WixToolsetTest.CoreIntegration
107 106
108 private static void Build(string[] args) 107 private static void Build(string[] args)
109 { 108 {
110 var program = new Program(); 109 var result = WixRunner.Execute(args, out var messages);
111 var result = program.Run(new WixToolsetServiceProvider(), null, args);
112 Assert.Equal(0, result); 110 Assert.Equal(0, result);
113 } 111 }
114 } 112 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
index 5a3071c7..7a10f71e 100644
--- a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
@@ -5,13 +5,13 @@ namespace WixToolsetTest.CoreIntegration
5 using System.IO; 5 using System.IO;
6 using System.Linq; 6 using System.Linq;
7 using WixBuildTools.TestSupport; 7 using WixBuildTools.TestSupport;
8 using WixToolset.Core; 8 using WixToolset.Core.TestPackage;
9 using WixToolset.Data; 9 using WixToolset.Data;
10 using WixToolset.Data.Tuples; 10 using WixToolset.Data.Tuples;
11 using WixToolset.Data.WindowsInstaller; 11 using WixToolset.Data.WindowsInstaller;
12 using Xunit; 12 using Xunit;
13 13
14 public class ProgramFixture 14 public class MsiFixture
15 { 15 {
16 [Fact] 16 [Fact]
17 public void CanBuildSingleFile() 17 public void CanBuildSingleFile()
@@ -23,8 +23,7 @@ namespace WixToolsetTest.CoreIntegration
23 var baseFolder = fs.GetFolder(); 23 var baseFolder = fs.GetFolder();
24 var intermediateFolder = Path.Combine(baseFolder, "obj"); 24 var intermediateFolder = Path.Combine(baseFolder, "obj");
25 25
26 var program = new Program(); 26 var result = WixRunner.Execute(new[]
27 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
28 { 27 {
29 "build", 28 "build",
30 Path.Combine(folder, "Package.wxs"), 29 Path.Combine(folder, "Package.wxs"),
@@ -33,8 +32,7 @@ namespace WixToolsetTest.CoreIntegration
33 "-bindpath", Path.Combine(folder, "data"), 32 "-bindpath", Path.Combine(folder, "data"),
34 "-intermediateFolder", intermediateFolder, 33 "-intermediateFolder", intermediateFolder,
35 "-o", Path.Combine(baseFolder, @"bin\test.msi") 34 "-o", Path.Combine(baseFolder, @"bin\test.msi")
36 }); 35 }, out var messages);
37
38 Assert.Equal(0, result); 36 Assert.Equal(0, result);
39 37
40 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); 38 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
@@ -59,8 +57,7 @@ namespace WixToolsetTest.CoreIntegration
59 { 57 {
60 var intermediateFolder = fs.GetFolder(); 58 var intermediateFolder = fs.GetFolder();
61 59
62 var program = new Program(); 60 var result = WixRunner.Execute(new[]
63 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
64 { 61 {
65 "build", 62 "build",
66 Path.Combine(folder, "Package.wxs"), 63 Path.Combine(folder, "Package.wxs"),
@@ -69,7 +66,7 @@ namespace WixToolsetTest.CoreIntegration
69 "-bindpath", Path.Combine(folder, "data"), 66 "-bindpath", Path.Combine(folder, "data"),
70 "-intermediateFolder", intermediateFolder, 67 "-intermediateFolder", intermediateFolder,
71 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 68 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
72 }); 69 }, out var messages);
73 70
74 Assert.Equal(0, result); 71 Assert.Equal(0, result);
75 72
@@ -95,8 +92,7 @@ namespace WixToolsetTest.CoreIntegration
95 { 92 {
96 var intermediateFolder = fs.GetFolder(); 93 var intermediateFolder = fs.GetFolder();
97 94
98 var program = new Program(); 95 var result = WixRunner.Execute(new[]
99 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
100 { 96 {
101 "build", 97 "build",
102 Path.Combine(folder, "Package.wxs"), 98 Path.Combine(folder, "Package.wxs"),
@@ -106,7 +102,7 @@ namespace WixToolsetTest.CoreIntegration
106 "-bindpath", Path.Combine(folder, "data"), 102 "-bindpath", Path.Combine(folder, "data"),
107 "-intermediateFolder", intermediateFolder, 103 "-intermediateFolder", intermediateFolder,
108 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 104 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
109 }); 105 }, out var messages);
110 106
111 Assert.Equal(0, result); 107 Assert.Equal(0, result);
112 108
@@ -125,8 +121,7 @@ namespace WixToolsetTest.CoreIntegration
125 { 121 {
126 var intermediateFolder = fs.GetFolder(); 122 var intermediateFolder = fs.GetFolder();
127 123
128 var program = new Program(); 124 var result = WixRunner.Execute(new[]
129 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
130 { 125 {
131 "build", 126 "build",
132 Path.Combine(folder, "Package.wxs"), 127 Path.Combine(folder, "Package.wxs"),
@@ -136,7 +131,7 @@ namespace WixToolsetTest.CoreIntegration
136 "-bindpath", Path.Combine(folder, "data"), 131 "-bindpath", Path.Combine(folder, "data"),
137 "-intermediateFolder", intermediateFolder, 132 "-intermediateFolder", intermediateFolder,
138 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 133 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
139 }); 134 }, out var messages);
140 135
141 Assert.Equal(0, result); 136 Assert.Equal(0, result);
142 137
@@ -155,8 +150,7 @@ namespace WixToolsetTest.CoreIntegration
155 { 150 {
156 var intermediateFolder = fs.GetFolder(); 151 var intermediateFolder = fs.GetFolder();
157 152
158 var program = new Program(); 153 var result = WixRunner.Execute(new[]
159 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
160 { 154 {
161 "build", 155 "build",
162 Path.Combine(folder, "Package.wxs"), 156 Path.Combine(folder, "Package.wxs"),
@@ -166,7 +160,7 @@ namespace WixToolsetTest.CoreIntegration
166 "-bindpath", Path.Combine(folder, "data"), 160 "-bindpath", Path.Combine(folder, "data"),
167 "-intermediateFolder", intermediateFolder, 161 "-intermediateFolder", intermediateFolder,
168 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 162 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
169 }); 163 }, out var messages);
170 164
171 Assert.Equal(0, result); 165 Assert.Equal(0, result);
172 166
@@ -185,8 +179,7 @@ namespace WixToolsetTest.CoreIntegration
185 { 179 {
186 var intermediateFolder = fs.GetFolder(); 180 var intermediateFolder = fs.GetFolder();
187 181
188 var program = new Program(); 182 var result = WixRunner.Execute(new[]
189 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
190 { 183 {
191 "build", 184 "build",
192 Path.Combine(folder, "Package.wxs"), 185 Path.Combine(folder, "Package.wxs"),
@@ -196,7 +189,7 @@ namespace WixToolsetTest.CoreIntegration
196 "-bindpath", Path.Combine(folder, "data"), 189 "-bindpath", Path.Combine(folder, "data"),
197 "-intermediateFolder", intermediateFolder, 190 "-intermediateFolder", intermediateFolder,
198 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 191 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
199 }); 192 }, out var messages);
200 193
201 Assert.Equal(0, result); 194 Assert.Equal(0, result);
202 195
@@ -221,8 +214,7 @@ namespace WixToolsetTest.CoreIntegration
221 { 214 {
222 var intermediateFolder = fs.GetFolder(); 215 var intermediateFolder = fs.GetFolder();
223 216
224 var program = new Program(); 217 var result = WixRunner.Execute(new[]
225 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
226 { 218 {
227 "build", 219 "build",
228 Path.Combine(folder, "Module.wxs"), 220 Path.Combine(folder, "Module.wxs"),
@@ -230,7 +222,7 @@ namespace WixToolsetTest.CoreIntegration
230 "-bindpath", Path.Combine(folder, "data"), 222 "-bindpath", Path.Combine(folder, "data"),
231 "-intermediateFolder", intermediateFolder, 223 "-intermediateFolder", intermediateFolder,
232 "-o", Path.Combine(intermediateFolder, @"bin\test.msm") 224 "-o", Path.Combine(intermediateFolder, @"bin\test.msm")
233 }); 225 }, out var messages);
234 226
235 Assert.Equal(0, result); 227 Assert.Equal(0, result);
236 228
@@ -255,8 +247,7 @@ namespace WixToolsetTest.CoreIntegration
255 { 247 {
256 var intermediateFolder = fs.GetFolder(); 248 var intermediateFolder = fs.GetFolder();
257 249
258 var program = new Program(); 250 var result = WixRunner.Execute(new[]
259 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
260 { 251 {
261 "build", 252 "build",
262 Path.Combine(folder, "Package.wxs"), 253 Path.Combine(folder, "Package.wxs"),
@@ -265,7 +256,7 @@ namespace WixToolsetTest.CoreIntegration
265 "-bindpath", Path.Combine(folder, "data"), 256 "-bindpath", Path.Combine(folder, "data"),
266 "-intermediateFolder", intermediateFolder, 257 "-intermediateFolder", intermediateFolder,
267 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 258 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
268 }); 259 }, out var messages);
269 260
270 Assert.Equal(0, result); 261 Assert.Equal(0, result);
271 262
@@ -292,8 +283,7 @@ namespace WixToolsetTest.CoreIntegration
292 var baseFolder = fs.GetFolder(); 283 var baseFolder = fs.GetFolder();
293 var intermediateFolder = Path.Combine(baseFolder, "obj"); 284 var intermediateFolder = Path.Combine(baseFolder, "obj");
294 285
295 var program = new Program(); 286 var result = WixRunner.Execute(new[]
296 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
297 { 287 {
298 "build", 288 "build",
299 Path.Combine(folder, "Package.wxs"), 289 Path.Combine(folder, "Package.wxs"),
@@ -302,7 +292,7 @@ namespace WixToolsetTest.CoreIntegration
302 "-bindpath", Path.Combine(folder, "data"), 292 "-bindpath", Path.Combine(folder, "data"),
303 "-intermediateFolder", intermediateFolder, 293 "-intermediateFolder", intermediateFolder,
304 "-o", Path.Combine(baseFolder, @"bin\test.wixipl") 294 "-o", Path.Combine(baseFolder, @"bin\test.wixipl")
305 }); 295 }, out var messages);
306 296
307 Assert.Equal(0, result); 297 Assert.Equal(0, result);
308 298
@@ -324,8 +314,7 @@ namespace WixToolsetTest.CoreIntegration
324 var baseFolder = fs.GetFolder(); 314 var baseFolder = fs.GetFolder();
325 var intermediateFolder = Path.Combine(baseFolder, "obj"); 315 var intermediateFolder = Path.Combine(baseFolder, "obj");
326 316
327 var program = new Program(); 317 var result = WixRunner.Execute(new[]
328 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
329 { 318 {
330 "build", 319 "build",
331 Path.Combine(folder, "Package.wxs"), 320 Path.Combine(folder, "Package.wxs"),
@@ -334,7 +323,7 @@ namespace WixToolsetTest.CoreIntegration
334 "-bindpath", Path.Combine(folder, "data"), 323 "-bindpath", Path.Combine(folder, "data"),
335 "-intermediateFolder", intermediateFolder, 324 "-intermediateFolder", intermediateFolder,
336 "-o", Path.Combine(baseFolder, @"bin\test.wixlib") 325 "-o", Path.Combine(baseFolder, @"bin\test.wixlib")
337 }); 326 }, out var messages);
338 327
339 Assert.Equal(0, result); 328 Assert.Equal(0, result);
340 329
@@ -357,8 +346,7 @@ namespace WixToolsetTest.CoreIntegration
357 var baseFolder = fs.GetFolder(); 346 var baseFolder = fs.GetFolder();
358 var intermediateFolder = Path.Combine(baseFolder, "obj"); 347 var intermediateFolder = Path.Combine(baseFolder, "obj");
359 348
360 var program = new Program(); 349 var result = WixRunner.Execute(new[]
361 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
362 { 350 {
363 "build", 351 "build",
364 Path.Combine(folder, "Package.wxs"), 352 Path.Combine(folder, "Package.wxs"),
@@ -368,7 +356,7 @@ namespace WixToolsetTest.CoreIntegration
368 "-intermediateFolder", intermediateFolder, 356 "-intermediateFolder", intermediateFolder,
369 "-o", Path.Combine(baseFolder, @"bin\test.msi"), 357 "-o", Path.Combine(baseFolder, @"bin\test.msi"),
370 "-i", bindpath, 358 "-i", bindpath,
371 }); 359 }, out var messages);
372 360
373 Assert.Equal(0, result); 361 Assert.Equal(0, result);
374 362
@@ -395,8 +383,7 @@ namespace WixToolsetTest.CoreIntegration
395 var baseFolder = fs.GetFolder(); 383 var baseFolder = fs.GetFolder();
396 var intermediateFolder = Path.Combine(baseFolder, "obj"); 384 var intermediateFolder = Path.Combine(baseFolder, "obj");
397 385
398 var program = new Program(); 386 var result = WixRunner.Execute(new[]
399 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
400 { 387 {
401 "build", 388 "build",
402 Path.Combine(folder, "Package.wxs"), 389 Path.Combine(folder, "Package.wxs"),
@@ -405,7 +392,7 @@ namespace WixToolsetTest.CoreIntegration
405 "-bindpath", Path.Combine(folder, "data"), 392 "-bindpath", Path.Combine(folder, "data"),
406 "-intermediateFolder", intermediateFolder, 393 "-intermediateFolder", intermediateFolder,
407 "-o", Path.Combine(baseFolder, @"bin\test.msi") 394 "-o", Path.Combine(baseFolder, @"bin\test.msi")
408 }); 395 }, out var messages);
409 396
410 Assert.Equal(0, result); 397 Assert.Equal(0, result);
411 398
@@ -434,8 +421,7 @@ namespace WixToolsetTest.CoreIntegration
434 { 421 {
435 var intermediateFolder = fs.GetFolder(); 422 var intermediateFolder = fs.GetFolder();
436 423
437 var program = new Program(); 424 var result = WixRunner.Execute(new[]
438 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
439 { 425 {
440 "build", 426 "build",
441 Path.Combine(folder, "Package.wxs"), 427 Path.Combine(folder, "Package.wxs"),
@@ -444,7 +430,7 @@ namespace WixToolsetTest.CoreIntegration
444 "-bindpath", Path.Combine(folder, "data"), 430 "-bindpath", Path.Combine(folder, "data"),
445 "-intermediateFolder", intermediateFolder, 431 "-intermediateFolder", intermediateFolder,
446 "-o", Path.Combine(intermediateFolder, @"bin\test.msi") 432 "-o", Path.Combine(intermediateFolder, @"bin\test.msi")
447 }); 433 }, out var messages);
448 434
449 Assert.Equal(0, result); 435 Assert.Equal(0, result);
450 436
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 5f1fb3d3..71e7dd68 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -52,8 +52,11 @@
52 </ItemGroup> 52 </ItemGroup>
53 53
54 <ItemGroup> 54 <ItemGroup>
55 <ProjectReference Include="..\..\wix\wix.csproj" /> 55 <ProjectReference Include="..\..\WixToolset.Core\WixToolset.Core.csproj" />
56 <ProjectReference Include="..\TestData\Example.Extension\Example.Extension.csproj" /> 56 <ProjectReference Include="..\..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
57 <ProjectReference Include="..\..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
58 <ProjectReference Include="..\..\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" />
59 <ProjectReference Include="..\Example.Extension\Example.Extension.csproj" />
57 </ItemGroup> 60 </ItemGroup>
58 61
59 <ItemGroup> 62 <ItemGroup>
diff --git a/src/test/WixToolsetTest.LightIntegration/LightFixture.cs b/src/test/WixToolsetTest.LightIntegration/LightFixture.cs
deleted file mode 100644
index 21c10be9..00000000
--- a/src/test/WixToolsetTest.LightIntegration/LightFixture.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 WixToolsetTest.LightIntegration
4{
5 using System.IO;
6 using System.Linq;
7 using WixToolset.Core;
8 using WixToolset.Tools;
9 using WixToolsetTest.LightIntegration.Utility;
10 using Xunit;
11
12 public class LightFixture
13 {
14 [Fact]
15 public void CanBuildFromWixout()
16 {
17 var folder = TestData.Get(@"TestData\Wixout");
18
19 using (var fs = new DisposableFileSystem())
20 {
21 var baseFolder = fs.GetFolder();
22 var intermediateFolder = Path.Combine(baseFolder, "obj");
23
24 var program = new Light();
25 var result = program.Run(new WixToolsetServiceProvider(), null, new[]
26 {
27 Path.Combine(folder, "test.wixout"),
28 "-loc", Path.Combine(folder, "Package.en-us.wxl"),
29 "-b", Path.Combine(folder, "data"),
30 "-intermediateFolder", intermediateFolder,
31 "-o", Path.Combine(baseFolder, @"bin\test.msi")
32 });
33
34 Assert.Equal(0, result);
35
36 var binFolder = Path.Combine(baseFolder, @"bin\");
37 var builtFiles = Directory.GetFiles(binFolder, "*", SearchOption.AllDirectories);
38
39 Assert.Equal(new[]{
40 "MsiPackage\\test.txt",
41 "test.msi",
42 "test.wir",
43 "test.wixpdb",
44 }, builtFiles.Select(f => f.Substring(binFolder.Length)).OrderBy(s => s).ToArray());
45 }
46 }
47 }
48}
diff --git a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/Package.en-us.wxl b/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/Package.en-us.wxl
deleted file mode 100644
index 38c12ac1..00000000
--- a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/Package.en-us.wxl
+++ /dev/null
@@ -1,11 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 <String Id="FeatureTitle">MsiPackage</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/data/test.txt b/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/data/test.txt
deleted file mode 100644
index cd0db0e1..00000000
--- a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/data/test.txt
+++ /dev/null
@@ -1 +0,0 @@
1This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/test.wixout b/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/test.wixout
deleted file mode 100644
index 009b625f..00000000
--- a/src/test/WixToolsetTest.LightIntegration/TestData/Wixout/test.wixout
+++ /dev/null
Binary files differ
diff --git a/src/test/WixToolsetTest.LightIntegration/Utility/DisposableFileSystem.cs b/src/test/WixToolsetTest.LightIntegration/Utility/DisposableFileSystem.cs
deleted file mode 100644
index 3b8c0e19..00000000
--- a/src/test/WixToolsetTest.LightIntegration/Utility/DisposableFileSystem.cs
+++ /dev/null
@@ -1,86 +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 WixToolsetTest.LightIntegration.Utility
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8
9 public class DisposableFileSystem : IDisposable
10 {
11 protected bool Disposed { get; private set; }
12
13 private List<string> CleanupPaths { get; } = new List<string>();
14
15 protected string GetFile(bool create = false)
16 {
17 var path = Path.GetTempFileName();
18
19 if (!create)
20 {
21 File.Delete(path);
22 }
23
24 this.CleanupPaths.Add(path);
25
26 return path;
27 }
28
29 public string GetFolder(bool create = false)
30 {
31 var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
32
33 if (create)
34 {
35 Directory.CreateDirectory(path);
36 }
37
38 this.CleanupPaths.Add(path);
39
40 return path;
41 }
42
43
44 #region // IDisposable
45
46 public void Dispose()
47 {
48 this.Dispose(true);
49 GC.SuppressFinalize(this);
50 }
51
52 protected virtual void Dispose(bool disposing)
53 {
54 if (this.Disposed)
55 {
56 return;
57 }
58
59 if (disposing)
60 {
61 foreach (var path in this.CleanupPaths)
62 {
63 try
64 {
65 if (File.Exists(path))
66 {
67 File.Delete(path);
68 }
69 else if (Directory.Exists(path))
70 {
71 Directory.Delete(path, true);
72 }
73 }
74 catch
75 {
76 // Best effort delete, so ignore any failures.
77 }
78 }
79 }
80
81 this.Disposed = true;
82 }
83
84 #endregion
85 }
86}
diff --git a/src/test/WixToolsetTest.LightIntegration/Utility/TestData.cs b/src/test/WixToolsetTest.LightIntegration/Utility/TestData.cs
deleted file mode 100644
index c13e9d6d..00000000
--- a/src/test/WixToolsetTest.LightIntegration/Utility/TestData.cs
+++ /dev/null
@@ -1,17 +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 WixToolsetTest.LightIntegration.Utility
4{
5 using System;
6 using System.IO;
7
8 public class TestData
9 {
10 public static string LocalPath => Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);
11
12 public static string Get(params string[] paths)
13 {
14 return Path.Combine(LocalPath, Path.Combine(paths));
15 }
16 }
17}
diff --git a/src/test/WixToolsetTest.LightIntegration/WixToolsetTest.LightIntegration.csproj b/src/test/WixToolsetTest.LightIntegration/WixToolsetTest.LightIntegration.csproj
deleted file mode 100644
index 59068682..00000000
--- a/src/test/WixToolsetTest.LightIntegration/WixToolsetTest.LightIntegration.csproj
+++ /dev/null
@@ -1,30 +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 <TargetFramework>net461</TargetFramework>
7 <IsPackable>false</IsPackable>
8 <DebugType>embedded</DebugType>
9 </PropertyGroup>
10
11 <ItemGroup>
12 <Content Include="TestData\Wixout\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
13 <Content Include="TestData\Wixout\Package.en-us.wxl">
14 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
15 </Content>
16 <Content Include="TestData\Wixout\test.wixout">
17 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
18 </Content>
19 </ItemGroup>
20
21 <ItemGroup>
22 <ProjectReference Include="..\..\light\light.csproj" />
23 </ItemGroup>
24
25 <ItemGroup>
26 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
27 <PackageReference Include="xunit" Version="2.3.1" />
28 <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
29 </ItemGroup>
30</Project>
diff --git a/src/wix/Program.cs b/src/wix/Program.cs
deleted file mode 100644
index aefc6be8..00000000
--- a/src/wix/Program.cs
+++ /dev/null
@@ -1,122 +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.Core
4{
5 using System;
6 using System.Globalization;
7 using System.Text;
8 using System.Threading;
9 using WixToolset.Data;
10 using WixToolset.Extensibility;
11 using WixToolset.Extensibility.Services;
12
13 /// <summary>
14 /// Wix Toolset Command-Line Interface.
15 /// </summary>
16 public sealed class Program
17 {
18 /// <summary>
19 /// The main entry point for wix command-line interface.
20 /// </summary>
21 /// <param name="args">Commandline arguments for the application.</param>
22 /// <returns>Returns the application error code.</returns>
23 [MTAThread]
24 public static int Main(string[] args)
25 {
26 var serviceProvider = new WixToolsetServiceProvider();
27
28 var listener = new ConsoleMessageListener("WIX", "wix.exe");
29
30 var program = new Program();
31 return program.Run(serviceProvider, listener, args);
32 }
33
34 /// <summary>
35 /// Executes the wix command-line interface.
36 /// </summary>
37 /// <param name="serviceProvider">Service provider to use throughout this execution.</param>
38 /// <param name="args">Command-line arguments to execute.</param>
39 /// <returns>Returns the application error code.</returns>
40 public int Run(IServiceProvider serviceProvider, IMessageListener listener, string[] args)
41 {
42 var messaging = serviceProvider.GetService<IMessaging>();
43 messaging.SetListener(listener);
44
45 var arguments = serviceProvider.GetService<ICommandLineArguments>();
46 arguments.Populate(args);
47
48 var context = serviceProvider.GetService<ICommandLineContext>();
49 context.Messaging = messaging;
50 context.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
51 context.Arguments = arguments;
52
53 var commandLine = serviceProvider.GetService<ICommandLine>();
54 var command = commandLine.ParseStandardCommandLine(context);
55 return command?.Execute() ?? 1;
56 }
57
58 private static IExtensionManager CreateExtensionManagerWithStandardBackends(IServiceProvider serviceProvider, string[] extensions)
59 {
60 var extensionManager = serviceProvider.GetService<IExtensionManager>();
61
62 foreach (var type in new[] { typeof(WixToolset.Core.Burn.WixToolsetStandardBackend), typeof(WixToolset.Core.WindowsInstaller.WixToolsetStandardBackend) })
63 {
64 extensionManager.Add(type.Assembly);
65 }
66
67 foreach (var extension in extensions)
68 {
69 extensionManager.Load(extension);
70 }
71
72 return extensionManager;
73 }
74
75 private class ConsoleMessageListener : IMessageListener
76 {
77 public ConsoleMessageListener(string shortName, string longName)
78 {
79 this.ShortAppName = shortName;
80 this.LongAppName = longName;
81
82 PrepareConsoleForLocalization();
83 }
84
85 public string LongAppName { get; }
86
87 public string ShortAppName { get; }
88
89 public void Write(Message message)
90 {
91 var filename = message.SourceLineNumbers?.FileName ?? this.LongAppName;
92 var line = message.SourceLineNumbers?.LineNumber ?? -1;
93 var type = message.Level.ToString().ToLowerInvariant();
94 var output = message.Level >= MessageLevel.Warning ? Console.Out : Console.Error;
95
96 if (line > 0)
97 {
98 filename = String.Concat(filename, "(", line, ")");
99 }
100
101 output.WriteLine("{0} : {1} {2}{3:0000}: {4}", filename, type, this.ShortAppName, message.Id, message.ToString());
102 }
103
104 public void Write(string message)
105 {
106 Console.Out.WriteLine(message);
107 }
108
109 private static void PrepareConsoleForLocalization()
110 {
111 Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture();
112
113 if (Console.OutputEncoding.CodePage != Encoding.UTF8.CodePage &&
114 Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage &&
115 Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage)
116 {
117 Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
118 }
119 }
120 }
121 }
122}
diff --git a/src/wix/wix.cmd b/src/wix/wix.cmd
deleted file mode 100644
index a0064ed7..00000000
--- a/src/wix/wix.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
1@setlocal
2@set _D=%~dpn0.dll
3@dotnet %_D% %* \ No newline at end of file
diff --git a/src/wix/wix.csproj b/src/wix/wix.csproj
deleted file mode 100644
index 989486e8..00000000
--- a/src/wix/wix.csproj
+++ /dev/null
@@ -1,30 +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 <TargetFramework>netcoreapp2.1</TargetFramework>
7 <OutputType>Exe</OutputType>
8 <Description>Compiler</Description>
9 <Title>WiX Toolset Compiler</Title>
10 <DebugType>embedded</DebugType>
11 <PublishRepositoryUrl>true</PublishRepositoryUrl>
12 </PropertyGroup>
13
14 <!--
15 <ItemGroup>
16 <Content Include="wix.cmd" CopyToOutputDirectory="PreserveNewest" />
17 </ItemGroup>
18 -->
19
20 <ItemGroup>
21 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" />
22 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
23 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
24 </ItemGroup>
25
26 <ItemGroup>
27 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All"/>
28 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
29 </ItemGroup>
30</Project>