@joebigelow / wix-1 / commits / 91259637

Significant rewrite of wix.targets to improve compatibility

This is still a work in progress but the wix.targets are now much more compatible with other project systems. The focus has been on removing customizations to leverage MS.Common.targets.

Rob Mensching committed Dec 19, 2021 at 12:06 UTC 91259637be1eccd149093eb49c7ff68826d1d331
14 files changed +852 -944
src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs deleted
-271
@@ -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 -
3 -namespace 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 -}
src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstantsAndBindPaths.cs new
+269
@@ -0,0 +1,269 @@
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 +
3 +namespace WixToolset.BuildTasks
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.IO;
8 + using System.Linq;
9 + using Microsoft.Build.Framework;
10 + using Microsoft.Build.Utilities;
11 +
12 + /// <summary>
13 + /// MSBuild task to create a list of preprocessor defines and bind paths from resolved
14 + /// project references.
15 + /// </summary>
16 + public sealed class CreateProjectReferenceDefineConstantsAndBindPaths : Task
17 + {
18 + private static readonly string DirectorySeparatorString = Path.DirectorySeparatorChar.ToString();
19 +
20 + [Required]
21 + public ITaskItem[] ResolvedProjectReferences { get; set; }
22 +
23 + public ITaskItem[] ProjectConfigurations { get; set; }
24 +
25 + [Output]
26 + public ITaskItem[] BindPaths { get; private set; }
27 +
28 + [Output]
29 + public ITaskItem[] DefineConstants { get; private set; }
30 +
31 + public override bool Execute()
32 + {
33 + var bindPaths = new Dictionary<string, List<ITaskItem>>(StringComparer.OrdinalIgnoreCase);
34 + var defineConstants = new Dictionary<string, string>();
35 +
36 + foreach (var resolvedReference in this.ResolvedProjectReferences)
37 + {
38 + this.AddBindPathsForResolvedReference(bindPaths, resolvedReference);
39 +
40 + this.AddDefineConstantsForResolvedReference(defineConstants, resolvedReference);
41 + }
42 +
43 + this.BindPaths = bindPaths.Values.SelectMany(bp => bp).ToArray();
44 + this.DefineConstants = defineConstants.Select(define => new TaskItem(define.Key + "=" + define.Value)).ToArray();
45 +
46 + return true;
47 + }
48 +
49 + private void AddBindPathsForResolvedReference(Dictionary<string, List<ITaskItem>> bindPathByPaths, ITaskItem resolvedReference)
50 + {
51 + // If the BindName was not explicitly provided, try to use the source project's filename
52 + // as the bind name.
53 + var name = resolvedReference.GetMetadata("BindName");
54 + if (String.IsNullOrWhiteSpace(name))
55 + {
56 + var projectPath = resolvedReference.GetMetadata("MSBuildSourceProjectFile");
57 + name = String.IsNullOrWhiteSpace(projectPath) ? String.Empty : Path.GetFileNameWithoutExtension(projectPath);
58 + }
59 +
60 + var path = resolvedReference.GetMetadata("BindPath");
61 + if (String.IsNullOrWhiteSpace(path))
62 + {
63 + path = Path.GetDirectoryName(resolvedReference.GetMetadata("FullPath"));
64 + }
65 +
66 + if (!bindPathByPaths.TryGetValue(path, out var bindPathsForPath) ||
67 + !bindPathsForPath.Any(bp => bp.GetMetadata("BindName").Equals(name, StringComparison.OrdinalIgnoreCase)))
68 + {
69 + if (bindPathsForPath == null)
70 + {
71 + bindPathsForPath = new List<ITaskItem>
72 + {
73 + new TaskItem(path)
74 + };
75 +
76 + bindPathByPaths.Add(path, bindPathsForPath);
77 + }
78 +
79 + if (!String.IsNullOrWhiteSpace(name))
80 + {
81 + var metadata = new Dictionary<string, string> { ["BindName"] = name };
82 + bindPathsForPath.Add(new TaskItem(path, metadata));
83 + }
84 + }
85 + }
86 +
87 + private void AddDefineConstantsForResolvedReference(Dictionary<string, string> defineConstants, ITaskItem resolvedReference)
88 + {
89 + var configuration = resolvedReference.GetMetadata("Configuration");
90 + var fullConfiguration = resolvedReference.GetMetadata("FullConfiguration");
91 + var platform = resolvedReference.GetMetadata("Platform");
92 +
93 + var projectPath = resolvedReference.GetMetadata("MSBuildSourceProjectFile");
94 + var projectDir = Path.GetDirectoryName(projectPath) + Path.DirectorySeparatorChar;
95 + var projectExt = Path.GetExtension(projectPath);
96 + var projectFileName = Path.GetFileName(projectPath);
97 + var projectName = Path.GetFileNameWithoutExtension(projectPath);
98 +
99 + var referenceName = ToolsCommon.GetIdentifierFromName(ToolsCommon.GetMetadataOrDefault(resolvedReference, "Name", projectName));
100 +
101 + var targetPath = resolvedReference.GetMetadata("FullPath");
102 + var targetDir = Path.GetDirectoryName(targetPath) + Path.DirectorySeparatorChar;
103 + var targetExt = Path.GetExtension(targetPath);
104 + var targetFileName = Path.GetFileName(targetPath);
105 + var targetName = Path.GetFileNameWithoutExtension(targetPath);
106 +
107 + // If there is no configuration metadata on the project reference task item,
108 + // check for any additional configuration data provided in the optional task property.
109 + if (String.IsNullOrWhiteSpace(fullConfiguration))
110 + {
111 + fullConfiguration = this.FindProjectConfiguration(projectName);
112 + if (!String.IsNullOrWhiteSpace(fullConfiguration))
113 + {
114 + var typeAndPlatform = fullConfiguration.Split('|');
115 + configuration = typeAndPlatform[0];
116 + platform = (typeAndPlatform.Length > 1 ? typeAndPlatform[1] : String.Empty);
117 + }
118 + }
119 +
120 + // write out the platform/configuration defines
121 + defineConstants[referenceName + ".Configuration"] = configuration;
122 + defineConstants[referenceName + ".FullConfiguration"] = fullConfiguration;
123 + defineConstants[referenceName + ".Platform"] = platform;
124 +
125 + // write out the ProjectX defines
126 + defineConstants[referenceName + ".ProjectDir"] = projectDir;
127 + defineConstants[referenceName + ".ProjectExt"] = projectExt;
128 + defineConstants[referenceName + ".ProjectFileName"] = projectFileName;
129 + defineConstants[referenceName + ".ProjectName"] = projectName;
130 + defineConstants[referenceName + ".ProjectPath"] = projectPath;
131 +
132 + // write out the TargetX defines
133 + var targetDirDefine = referenceName + ".TargetDir";
134 + if (defineConstants.ContainsKey(targetDirDefine))
135 + {
136 + //if target dir was already defined, redefine it as the common root shared by multiple references from the same project
137 + var commonDir = FindCommonRoot(targetDir, defineConstants[targetDirDefine]);
138 + if (!String.IsNullOrEmpty(commonDir))
139 + {
140 + targetDir = commonDir;
141 + }
142 + }
143 + defineConstants[targetDirDefine] = CreateProjectReferenceDefineConstantsAndBindPaths.EnsureEndsWithBackslash(targetDir);
144 +
145 + defineConstants[referenceName + ".TargetExt"] = targetExt;
146 + defineConstants[referenceName + ".TargetFileName"] = targetFileName;
147 + defineConstants[referenceName + ".TargetName"] = targetName;
148 +
149 + // If target path was already defined, append to it creating a list of multiple references from the same project
150 + var targetPathDefine = referenceName + ".TargetPath";
151 + if (defineConstants.TryGetValue(targetPathDefine, out var oldTargetPath))
152 + {
153 + if (!targetPath.Equals(oldTargetPath, StringComparison.OrdinalIgnoreCase))
154 + {
155 + defineConstants[targetPathDefine] += ";" + targetPath;
156 + }
157 +
158 + // If there was only one targetpath we need to create its culture specific define
159 + if (!oldTargetPath.Contains(";"))
160 + {
161 + var oldSubFolder = FindSubfolder(oldTargetPath, targetDir, targetFileName);
162 + if (!String.IsNullOrEmpty(oldSubFolder))
163 + {
164 + defineConstants[referenceName + "." + oldSubFolder.Replace('\\', '_') + ".TargetPath"] = oldTargetPath;
165 + }
166 + }
167 +
168 + // Create a culture specific define
169 + var subFolder = FindSubfolder(targetPath, targetDir, targetFileName);
170 + if (!String.IsNullOrEmpty(subFolder))
171 + {
172 + defineConstants[referenceName + "." + subFolder.Replace('\\', '_') + ".TargetPath"] = targetPath;
173 + }
174 + }
175 + else
176 + {
177 + defineConstants[targetPathDefine] = targetPath;
178 + }
179 + }
180 +
181 + /// <summary>
182 + /// Look through the configuration data in the ProjectConfigurations property
183 + /// to find the configuration for a project, if available.
184 + /// </summary>
185 + /// <param name="projectName">Name of the project that is being searched for.</param>
186 + /// <returns>Full configuration spec, for example "Release|Win32".</returns>
187 + private string FindProjectConfiguration(string projectName)
188 + {
189 + var configuration = String.Empty;
190 +
191 + if (this.ProjectConfigurations != null)
192 + {
193 + foreach (var configItem in this.ProjectConfigurations)
194 + {
195 + var configProject = configItem.ItemSpec;
196 + if (configProject.Length > projectName.Length &&
197 + configProject.StartsWith(projectName) &&
198 + configProject[projectName.Length] == '=')
199 + {
200 + configuration = configProject.Substring(projectName.Length + 1);
201 + break;
202 + }
203 + }
204 + }
205 +
206 + return configuration;
207 + }
208 +
209 + /// <summary>
210 + /// Finds the common root between two paths
211 + /// </summary>
212 + /// <param name="path1"></param>
213 + /// <param name="path2"></param>
214 + /// <returns>common root on success, empty string on failure</returns>
215 + private static string FindCommonRoot(string path1, string path2)
216 + {
217 + path1 = path1.TrimEnd(Path.DirectorySeparatorChar);
218 + path2 = path2.TrimEnd(Path.DirectorySeparatorChar);
219 +
220 + while (!String.IsNullOrEmpty(path1))
221 + {
222 + for (var searchPath = path2; !String.IsNullOrEmpty(searchPath); searchPath = Path.GetDirectoryName(searchPath))
223 + {
224 + if (path1.Equals(searchPath, StringComparison.OrdinalIgnoreCase))
225 + {
226 + return searchPath;
227 + }
228 + }
229 +
230 + path1 = Path.GetDirectoryName(path1);
231 + }
232 +
233 + return path1;
234 + }
235 +
236 + /// <summary>
237 + /// Finds the subfolder of a path, excluding a root and filename.
238 + /// </summary>
239 + /// <param name="path">Path to examine</param>
240 + /// <param name="rootPath">Root that must be present </param>
241 + /// <param name="fileName"></param>
242 + /// <returns></returns>
243 + private static string FindSubfolder(string path, string rootPath, string fileName)
244 + {
245 + if (Path.GetFileName(path).Equals(fileName, StringComparison.OrdinalIgnoreCase))
246 + {
247 + path = Path.GetDirectoryName(path);
248 + }
249 +
250 + if (path.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase))
251 + {
252 + // cut out the root and return the subpath
253 + return path.Substring(rootPath.Length).Trim(Path.DirectorySeparatorChar);
254 + }
255 +
256 + return String.Empty;
257 + }
258 +
259 + private static string EnsureEndsWithBackslash(string dir)
260 + {
261 + if (!dir.EndsWith(DirectorySeparatorString))
262 + {
263 + dir += Path.DirectorySeparatorChar;
264 + }
265 +
266 + return dir;
267 + }
268 + }
269 +}
src/wix/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs deleted
-145
@@ -1,145 +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 -namespace WixToolset.BuildTasks
4 -{
5 - using System;
6 - using System.Diagnostics.CodeAnalysis;
7 - using System.Globalization;
8 - using System.IO;
9 - using System.Security.Cryptography;
10 - using System.Text;
11 - using Microsoft.Build.Framework;
12 - using Microsoft.Build.Utilities;
13 -
14 - /// <summary>
15 - /// This task generates metadata on the for compile output objects.
16 - /// </summary>
17 - public class GenerateCompileWithObjectPath : Task
18 - {
19 - /// <summary>
20 - /// The list of files to generate outputs for.
21 - /// </summary>
22 - [Required]
23 - public ITaskItem[] Compile
24 - {
25 - get;
26 - set;
27 - }
28 -
29 - /// <summary>
30 - /// The list of files with ObjectPath metadata.
31 - /// </summary>
32 - [Output]
33 - public ITaskItem[] CompileWithObjectPath
34 - {
35 - get;
36 - private set;
37 - }
38 -
39 - /// <summary>
40 - /// The folder under which all ObjectPaths should reside.
41 - /// </summary>
42 - [Required]
43 - public string IntermediateOutputPath
44 - {
45 - get;
46 - set;
47 - }
48 -
49 - /// <summary>
50 - /// Generate an identifier by hashing data from the row.
51 - /// </summary>
52 - /// <param name="prefix">Three letter or less prefix for generated row identifier.</param>
53 - /// <param name="args">Information to hash.</param>
54 - /// <returns>The generated identifier.</returns>
55 - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")]
56 - public static string GenerateIdentifier(string prefix, params string[] args)
57 - {
58 - string stringData = String.Join("|", args);
59 - byte[] data = Encoding.Unicode.GetBytes(stringData);
60 -
61 - // hash the data
62 - byte[] hash;
63 -
64 - using (SHA1 sha1 = new SHA1CryptoServiceProvider())
65 - {
66 - hash = sha1.ComputeHash(data);
67 - }
68 -
69 - // build up the identifier
70 - StringBuilder identifier = new StringBuilder(35, 35);
71 - identifier.Append(prefix);
72 -
73 - // hard coded to 16 as that is the most bytes that can be used to meet the length requirements. SHA1 is 20 bytes.
74 - for (int i = 0; i < 16; i++)
75 - {
76 - identifier.Append(hash[i].ToString("X2", CultureInfo.InvariantCulture.NumberFormat));
77 - }
78 -
79 - return identifier.ToString();
80 - }
81 -
82 - /// <summary>
83 - /// Gets the full path of the directory in which the file is found.
84 - /// </summary>
85 - /// <param name='file'>The file from which to extract the directory.</param>
86 - /// <returns>The generated identifier.</returns>
87 - private static string GetDirectory(ITaskItem file)
88 - {
89 - return file.GetMetadata("RootDir") + file.GetMetadata("Directory");
90 - }
91 -
92 - /// <summary>
93 - /// Sets the object path to use for the file.
94 - /// </summary>
95 - /// <param name='file'>The file on which to set the ObjectPath metadata.</param>
96 - /// <remarks>
97 - /// For the same input path it will return the same ObjectPath. Case is not ignored, however that isn't a problem.
98 - /// </remarks>
99 - private void SetObjectPath(ITaskItem file)
100 - {
101 - // If the source file is in the project directory or in the intermediate directory, use the intermediate directory.
102 - if (string.IsNullOrEmpty(file.GetMetadata("RelativeDir")) || string.Compare(file.GetMetadata("RelativeDir"), this.IntermediateOutputPath, StringComparison.OrdinalIgnoreCase) == 0)
103 - {
104 - file.SetMetadata("ObjectPath", this.IntermediateOutputPath);
105 - }
106 - // 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.
107 - else
108 - {
109 - file.SetMetadata("ObjectPath", Path.Combine(this.IntermediateOutputPath, GenerateIdentifier("pth", GetDirectory(file))) + Path.DirectorySeparatorChar);
110 - }
111 - }
112 -
113 - /// <summary>
114 - /// Gets a complete list of external cabs referenced by the given installer database file.
115 - /// </summary>
116 - /// <returns>True upon completion of the task execution.</returns>
117 - public override bool Execute()
118 - {
119 - if (string.IsNullOrEmpty(this.IntermediateOutputPath))
120 - {
121 - this.Log.LogError("IntermediateOutputPath parameter is required and cannot be empty");
122 - return false;
123 - }
124 -
125 - if (this.Compile == null || this.Compile.Length == 0)
126 - {
127 - return true;
128 - }
129 -
130 - this.CompileWithObjectPath = new ITaskItem[this.Compile.Length];
131 - for (int i = 0; i < this.Compile.Length; ++i)
132 - {
133 - this.CompileWithObjectPath[i] = new TaskItem(this.Compile[i].ItemSpec, this.Compile[i].CloneCustomMetadata());
134 -
135 - // Do not overwrite the ObjectPath metadata if it already was set.
136 - if (string.IsNullOrEmpty(this.CompileWithObjectPath[i].GetMetadata("ObjectPath")))
137 - {
138 - this.SetObjectPath(this.CompileWithObjectPath[i]);
139 - }
140 - }
141 -
142 - return true;
143 - }
144 - }
145 -}
src/wix/WixToolset.BuildTasks/UpdateProjectReferenceMetadata.cs new
+95
@@ -0,0 +1,95 @@
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 +
3 +namespace WixToolset.BuildTasks
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.IO;
8 + using Microsoft.Build.Framework;
9 + using Microsoft.Build.Utilities;
10 +
11 + /// <summary>
12 + /// This task adds publish metadata to the appropriate project references.
13 + /// </summary>
14 + public class UpdateProjectReferenceMetadata : Task
15 + {
16 + /// <summary>
17 + /// The list of project references that exist.
18 + /// </summary>
19 + [Required]
20 + public ITaskItem[] ProjectReferences { get; set; }
21 +
22 + [Required]
23 + public string IntermediateFolder { get; set; }
24 +
25 + [Output]
26 + public ITaskItem[] UpdatedProjectReferences { get; private set; }
27 +
28 + /// <summary>
29 + /// Finds all project references requesting publishing and updates them to publish instead of build.
30 + /// </summary>
31 + /// <returns>True upon completion of the task execution.</returns>
32 + public override bool Execute()
33 + {
34 + var publishProjectReferences = new List<ITaskItem>();
35 + var intermediateFolder = Path.GetFullPath(this.IntermediateFolder);
36 +
37 + foreach (var projectReference in this.ProjectReferences)
38 + {
39 + var publish = projectReference.GetMetadata("Publish");
40 + var publishDir = projectReference.GetMetadata("PublishDir");
41 +
42 + if (publish.Equals("true", StringComparison.OrdinalIgnoreCase) ||
43 + (String.IsNullOrWhiteSpace(publish) && !String.IsNullOrWhiteSpace(publishDir)))
44 + {
45 + publishDir = String.IsNullOrWhiteSpace(publishDir) ? this.CalculatePublishDirFromProjectReference(projectReference, intermediateFolder) : Path.GetFullPath(publishDir);
46 +
47 + this.AddPublishPropertiesToProjectReference(projectReference, publishDir);
48 +
49 + publishProjectReferences.Add(projectReference);
50 + }
51 + }
52 +
53 + this.UpdatedProjectReferences = publishProjectReferences.ToArray();
54 +
55 + return true;
56 + }
57 +
58 + private string CalculatePublishDirFromProjectReference(ITaskItem projectReference, string intermediateFolder)
59 + {
60 + var publishDir = Path.Combine("publish", Path.GetFileNameWithoutExtension(projectReference.ItemSpec));
61 +
62 + return Path.Combine(intermediateFolder, publishDir);
63 + }
64 +
65 + private void AddPublishPropertiesToProjectReference(ITaskItem projectReference, string publishDir)
66 + {
67 + var additionalProperties = projectReference.GetMetadata("AdditionalProperties");
68 + if (!String.IsNullOrWhiteSpace(additionalProperties))
69 + {
70 + additionalProperties += ";";
71 + }
72 +
73 + additionalProperties += "PublishDir=" + publishDir;
74 +
75 + var bindPath = ToolsCommon.GetMetadataOrDefault(projectReference, "BindPath", publishDir);
76 +
77 + var publishTargets = projectReference.GetMetadata("PublishTargets");
78 + if (String.IsNullOrWhiteSpace(publishTargets))
79 + {
80 + publishTargets = "Publish;GetTargetPath";
81 + }
82 + else if (!publishTargets.EndsWith(";GetTargetsPath", StringComparison.OrdinalIgnoreCase))
83 + {
84 + publishTargets += ";GetTargetsPath";
85 + }
86 +
87 + projectReference.SetMetadata("AdditionalProperties", additionalProperties);
88 + projectReference.SetMetadata("BindPath", bindPath);
89 + projectReference.SetMetadata("Targets", publishTargets);
90 +
91 + this.Log.LogMessage(MessageImportance.Low, "Adding publish metadata to project reference {0} Targets {1}, BindPath {2}, AdditionalProperties: {3}",
92 + projectReference.ItemSpec, projectReference.GetMetadata("Targets"), projectReference.GetMetadata("BindPath"), projectReference.GetMetadata("AdditionalProperties"));
93 + }
94 + }
95 +}
src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj
+1 -3
@@ -15,17 +15,15 @@
15
16 <ItemGroup>
17 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" />
18 + <PackageReference Include="Microsoft.Build.Tasks.Core" />
19 </ItemGroup>
20
21 <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" >
22 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" />
23 <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
24 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
24 -
25 - <PackageReference Include="Microsoft.Build.Tasks.Core" />
25 </ItemGroup>
26
27 <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' ">
29 - <PackageReference Include="Microsoft.Build.Tasks.Core" />
28 </ItemGroup>
29 </Project>
src/wix/WixToolset.Sdk/Sdk/Sdk.props
+5 -11
@@ -1,23 +1,17 @@
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
3 -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <PropertyGroup>
5 - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
6 + <WixPropsPath Condition=" '$(WixPropsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.props'))</WixPropsPath>
7 + <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.targets'))</WixTargetsPath>
8 </PropertyGroup>
9
10 <PropertyGroup>
9 - <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\tools\wix.targets'))</WixTargetsPath>
10 - </PropertyGroup>
11 -
12 - <PropertyGroup>
13 - <TargetFrameworkMoniker Condition=" '$(TargetFrameworkMoniker)' == '' ">.NETFramework,Version=v4.8</TargetFrameworkMoniker>
11 <EnableDefaultItems Condition=" '$(EnableDefaultItems)' == '' ">true</EnableDefaultItems>
12 <EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">true</EnableDefaultCompileItems>
13 <EnableDefaultEmbeddedResourceItems Condition=" '$(EnableDefaultEmbeddedResourceItems)' == '' ">true</EnableDefaultEmbeddedResourceItems>
14 </PropertyGroup>
15
19 - <ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' ">
20 - <Compile Include="**/*.wxs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
21 - <EmbeddedResource Include="**/*.wxl" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " />
22 - </ItemGroup>
16 + <Import Project="$(WixPropsPath)" Condition=" '$(WixPropsPath)' != '' and Exists('$(WixPropsPath)')" />
17 </Project>
src/wix/WixToolset.Sdk/Sdk/Sdk.targets
+2 -11
@@ -1,15 +1,6 @@
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
3 -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
4 - <PropertyGroup>
5 - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
6 - </PropertyGroup>
7 -
4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' and Exists('$(WixTargetsPath)')" />
9 -
10 - <PropertyGroup>
11 - <DefaultItemExcludes Condition=" '$(BaseOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseOutputPath)**</DefaultItemExcludes>
12 - <DefaultItemExcludes Condition=" '$(BaseIntermediateOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseIntermediateOutputPath)**</DefaultItemExcludes>
13 - <DefaultExcludesInProjectFolder>$(DefaultItemExcludesInProjectFolder);**/.*/**</DefaultExcludesInProjectFolder>
14 - </PropertyGroup>
6 </Project>
src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj
+2
@@ -13,9 +13,11 @@
13
14 <ItemGroup>
15 <Content Include="build\$(MSBuildThisFileName).props" CopyToOutputDirectory="PreserveNewest" />
16 + <Content Include="build\$(MSBuildThisFileName).targets" CopyToOutputDirectory="PreserveNewest" />
17 <Content Include="tools\wix.ca.targets" CopyToOutputDirectory="PreserveNewest" />
18 <Content Include="tools\wix.harvest.targets" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="tools\wix.signing.targets" CopyToOutputDirectory="PreserveNewest" />
20 + <Content Include="tools\wix.props" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="tools\wix.targets" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="Sdk\Sdk.props" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="Sdk\Sdk.targets" CopyToOutputDirectory="PreserveNewest" />
src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props
+5 -2
@@ -1,8 +1,11 @@
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">
4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <PropertyGroup>
6 - <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\tools\wix.targets'))</WixTargetsPath>
6 + <WixPropsPath Condition=" '$(WixPropsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.props'))</WixPropsPath>
7 + <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.targets'))</WixTargetsPath>
8 </PropertyGroup>
9 +
10 + <Import Project="$(WixPropsPath)" Condition=" '$(WixPropsPath)' != '' and Exists('$(WixPropsPath)')" />
11 </Project>
src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets new
+10
@@ -0,0 +1,10 @@
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">
5 + <PropertyGroup>
6 + <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), '..\tools\wix.targets'))</WixTargetsPath>
7 + </PropertyGroup>
8 +
9 + <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' and Exists('$(WixTargetsPath)')" />
10 +</Project>
src/wix/WixToolset.Sdk/tools/wix.harvest.targets
+5 -9
@@ -87,6 +87,10 @@
87 ==================================================================================================
88 -->
89 <PropertyGroup>
90 + <CoreCompileDependsOn>
91 + $(CoreCompileDependsOn);
92 + Harvest
93 + </CoreCompileDependsOn>
94 <HarvestDependsOn>
95 ConvertReferences;
96 ConvertBundleReferences;
@@ -136,10 +140,6 @@
140 <HeatProject Include="@(_HeatProjectReference)" />
141 </ItemGroup>
142
139 - <Error
140 - Text="The following files are deprecated and should be removed from your project(s): @(Compile->'%(Identity)', ', ')"
141 - Condition=" '%(Compile.GenerateComponentGroups)' != '' " />
142 -
143 <ItemGroup>
144 <!-- Unconditionally generate Compile items so they are always linked in. -->
145 <Compile Include="$(HarvestProjectsGeneratedFile)" />
@@ -168,10 +168,6 @@
168 <HeatProject Include="@(_HeatProjectReference)" />
169 </ItemGroup>
170
171 - <Error
172 - Text="The following files are deprecated and should be removed from your project(s): @(Compile->'%(Identity)', ', ')"
173 - Condition=" '%(Compile.GenerateComponentGroups)' != '' " />
174 -
171 <ItemGroup>
172 <!-- Unconditionally generate Compile items so they are always linked in. -->
173 <Compile Include="$(HarvestProjectsGeneratedFile)" />
@@ -254,7 +250,7 @@
250 </PropertyGroup>
251 <Target Name="HarvestProjects"
252 DependsOnTargets="$(HarvestProjectsDependsOn)"
257 - Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(MSBuildAllProjects);$(ProjectPath)"
253 + Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(ProjectPath)"
254 Outputs="@(_AllHeatProjects -> '%(HeatOutput)')"
255 Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') ">
256
src/wix/WixToolset.Sdk/tools/wix.props new
+53
@@ -0,0 +1,53 @@
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">
5 + <PropertyGroup>
6 + <WixPropsImported>true</WixPropsImported>
7 + </PropertyGroup>
8 +
9 + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
10 +
11 + <PropertyGroup>
12 + <ProjectTypeGuids>B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0</ProjectTypeGuids>
13 + <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
14 + <DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
15 + </PropertyGroup>
16 +
17 + <!-- NuGet properties -->
18 + <PropertyGroup>
19 + <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
20 + <ProjectAssetsFile Condition="'$(ProjectAssetsFile)' == ''">$(MSBuildProjectExtensionsPath)/project.assets.json</ProjectAssetsFile>
21 + <ProjectAssetsFile>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(ProjectAssetsFile)))</ProjectAssetsFile>
22 +
23 + <ResolveNuGetPackages>false</ResolveNuGetPackages>
24 + <UseTargetPlatformAsNuGetTargetMoniker>false</UseTargetPlatformAsNuGetTargetMoniker>
25 + </PropertyGroup>
26 +
27 + <PropertyGroup>
28 + <TargetFramework>native</TargetFramework>
29 + <TargetFrameworkVersion>v0.0</TargetFrameworkVersion>
30 + <TargetFrameworkMoniker>native,Version=v0.0</TargetFrameworkMoniker>
31 + </PropertyGroup>
32 +
33 + <PropertyGroup>
34 + <NoWarn>$(NoWarn);NU1702</NoWarn>
35 + </PropertyGroup>
36 +
37 + <PropertyGroup>
38 + <AssetTargetFallback>$(AssetTargetFallback);net6.0-windows;net6.0;net5.0-windows;net5.0;netcoreapp3.1;netcoreapp3.0;netcoreapp2.0;net462;net47;net471;net472;net48;native</AssetTargetFallback>
39 + </PropertyGroup>
40 +
41 + <PropertyGroup>
42 + <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
43 + </PropertyGroup>
44 +
45 + <ItemDefinitionGroup>
46 + <ProjectReference>
47 + <Private>false</Private>
48 + </ProjectReference>
49 + <None>
50 + <CopyToOutputDirectory>Never</CopyToOutputDirectory>
51 + </None>
52 + </ItemDefinitionGroup>
53 +</Project>
src/wix/WixToolset.Sdk/tools/wix.signing.targets
+8 -8
@@ -27,31 +27,31 @@
27 ==================================================================================================
28 -->
29 <PropertyGroup>
30 - <InternalSignDependsOn Condition=" '$(OutputType)' == 'Module' ">
30 + <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Module' ">
31 GetMsmsToSign;
32 InternalSignMsm;
33 - </InternalSignDependsOn>
34 - <InternalSignDependsOn Condition=" '$(OutputType)' == 'Package' ">
33 + </_InternalSignDependsOn>
34 + <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Package' ">
35 GetCabsToSign;
36 GetMsiToSign;
37 InternalSignCabs;
38 InscribeMsi;
39 InternalSignMsi;
40 - </InternalSignDependsOn>
41 - <InternalSignDependsOn Condition=" '$(OutputType)' == 'Bundle' ">
40 + </_InternalSignDependsOn>
41 + <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Bundle' ">
42 GetContainersToSign;
43 InternalSignContainers;
44 InscribeBundleEngine;
45 InternalSignBundleEngine;
46 InscribeBundle;
47 InternalSignBundle;
48 - </InternalSignDependsOn>
48 + </_InternalSignDependsOn>
49
50 <SigningDependsOn>
51 - WixBuild;
51 + CoreCompile;
52 CalculateSignTargetFiles;
53 BeforeSigning;
54 - $(InternalSignDependsOn);
54 + $(_InternalSignDependsOn);
55 AfterSigning
56 </SigningDependsOn>
57 </PropertyGroup>
src/wix/WixToolset.Sdk/tools/wix.targets
+397 -484
@@ -1,17 +1,19 @@
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" InitialTargets="_CheckRequiredProperties" DefaultTargets="Build">
4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
5 <PropertyGroup>
6 <WixTargetsImported>true</WixTargetsImported>
7 </PropertyGroup>
8
9 + <Import Project="wix.props" Condition=" '$(WixPropsImported)' != 'true' " />
10 +
11 <!--
10 - //////////////////////////////////////////////////////////////////////////////////////////////////
11 - //////////////////////////////////////////////////////////////////////////////////////////////////
12 - Extension Points
13 - //////////////////////////////////////////////////////////////////////////////////////////////////
14 - //////////////////////////////////////////////////////////////////////////////////////////////////
12 + ***********************************************************************************************
13 + ***********************************************************************************************
14 + Extension Points
15 + ***********************************************************************************************
16 + ***********************************************************************************************
17 -->
18
19 <!-- Allow a user-customized targets files to be used as part of the build. -->
@@ -31,21 +33,17 @@
33 <WixSigningTargetsPath Condition=" '$(WixSigningTargetsPath)' == '' ">$(MSBuildThisFileDirectory)wix.signing.targets</WixSigningTargetsPath>
34 </PropertyGroup>
35
34 - <!-- This makes the project files a dependency of all targets so that things rebuild if they change -->
35 - <PropertyGroup>
36 - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
37 - <MSBuildAllProjects Condition="Exists('$(WixHarvestTargetsPath)')">$(MSBuildAllProjects);$(WixHarvestTargetsPath)</MSBuildAllProjects>
38 - <MSBuildAllProjects Condition="Exists('$(WixSigningTargetsPath)')">$(MSBuildAllProjects);$(WixSigningTargetsPath)</MSBuildAllProjects>
39 - <MSBuildAllProjects Condition="Exists('$(CustomBeforeWixTargets)')">$(MSBuildAllProjects);$(CustomBeforeWixTargets)</MSBuildAllProjects>
40 - <MSBuildAllProjects Condition="Exists('$(CustomAfterWixTargets)')">$(MSBuildAllProjects);$(CustomAfterWixTargets)</MSBuildAllProjects>
41 - </PropertyGroup>
36 + <ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' ">
37 + <Compile Include="**/*.wxs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
38 + <EmbeddedResource Include="**/*.wxl" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " />
39 + </ItemGroup>
40
41 <!--
44 - //////////////////////////////////////////////////////////////////////////////////////////////////
45 - //////////////////////////////////////////////////////////////////////////////////////////////////
46 - Declarations for Microsoft.Common.targets
47 - //////////////////////////////////////////////////////////////////////////////////////////////////
48 - //////////////////////////////////////////////////////////////////////////////////////////////////
42 + ***********************************************************************************************
43 + ***********************************************************************************************
44 + Declarations for Microsoft.Common.targets
45 + ***********************************************************************************************
46 + ***********************************************************************************************
47 -->
48
49 <PropertyGroup>
@@ -59,11 +57,16 @@
57
58 <!-- Default OutputType to a known WiX Toolset type. -->
59 <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
60 + <AvailablePlatforms>x86,x64,ARM,ARM64,AnyCPU</AvailablePlatforms>
61
62 <!-- Default WixPdbType to a known WiX Toolset type. -->
63 <WixPdbType Condition=" '$(WixPdbType)' == '' ">full</WixPdbType>
64 </PropertyGroup>
65
66 + <PropertyGroup>
67 + <_VCLibCurrentVersion>14.0</_VCLibCurrentVersion>
68 + </PropertyGroup>
69 +
70 <!--
71 IDE Macros available from both integrated builds and from command line builds.
72 The following properties are 'macros' that are available via IDE for pre and post build steps.
@@ -78,8 +81,34 @@
81 <TargetExt Condition=" '$(OutputType)' == 'IntermediatePostLink' ">.wixipl</TargetExt>
82 </PropertyGroup>
83
84 +<!--
85 + <PropertyGroup>
86 + <DefaultContentType Condition="$(DefaultContentType) == ''">Default</DefaultContentType>
87 + </PropertyGroup>
88 +-->
89 +
90 <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
91
92 + <!-- This will override some targets that get defined in Microsoft.Common so this needs to be imported after -->
93 + <Import Condition="Exists('$(DisableNetFrameworkResolutionTargets)') and '$(SkipImportDisableNetFrameworkResolutionTargets)' != 'true'" Project="$(DisableNetFrameworkResolutionTargets)" />
94 + <!-- being Import that mimics the above line where DisableNetFrameworkResolutionTargets == Microsoft.NET.DisableStandardFrameworkResolution.targets -->
95 + <Target Name="GetReferenceAssemblyPaths" />
96 + <Target Name="GetFrameworkPaths" />
97 +
98 + <PropertyGroup>
99 + <_TargetFrameworkDirectories />
100 + <FrameworkPathOverride />
101 + <TargetFrameworkDirectory />
102 +
103 + <NoStdLib>true</NoStdLib>
104 + </PropertyGroup>
105 + <!-- end DisableNetFrameworkResolutionTargets == Microsoft.NET.DisableStandardFrameworkResolution.targets -->
106 +
107 + <PropertyGroup>
108 + <!-- We don't target any frameworks, so clear what the Microsoft.Common.targets set -->
109 + <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
110 + </PropertyGroup>
111 +
112 <PropertyGroup>
113 <!-- Default pdb output path to the intermediate output directory -->
114 <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(TargetDir)</PdbOutputDir>
@@ -96,11 +125,11 @@
125 </PropertyGroup>
126
127 <!--
99 - //////////////////////////////////////////////////////////////////////////////////////////////////
100 - //////////////////////////////////////////////////////////////////////////////////////////////////
101 - Property Declarations
102 - //////////////////////////////////////////////////////////////////////////////////////////////////
103 - //////////////////////////////////////////////////////////////////////////////////////////////////
128 + ***********************************************************************************************
129 + ***********************************************************************************************
130 + Property Declarations
131 + ***********************************************************************************************
132 + ***********************************************************************************************
133 -->
134
135 <!-- These tasks can be used as general-purpose build tasks. -->
@@ -113,9 +142,13 @@
142 <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
143 <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
144
116 - <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" />
117 - <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
118 - <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
145 + <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" />
146 + <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
147 + <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
148 +
149 + <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" />
150 + <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
151 + <UsingTask TaskName="CreateProjectReferenceDefineConstantsAndBindPaths" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
152
153 <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" />
154 <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
@@ -125,10 +158,6 @@
158 <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
159 <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
160
128 - <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" />
129 - <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" />
130 - <UsingTask TaskName="GenerateCompileWithObjectPath" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" />
131 -
161 <PropertyGroup>
162 <BindContentsFile Condition=" '$(BindContentsFile)' == '' ">$(MSBuildProjectFile).BindContentsFileList.txt</BindContentsFile>
163 <BindOutputsFile Condition=" '$(BindOutputsFile)' == '' ">$(MSBuildProjectFile).BindOutputsFileList.txt</BindOutputsFile>
@@ -144,11 +173,11 @@
173 </PropertyGroup>
174
175 <!--
147 - //////////////////////////////////////////////////////////////////////////////////////////////////
148 - //////////////////////////////////////////////////////////////////////////////////////////////////
149 - Default Compiler, Linker, and Librarian Property Declarations
150 - //////////////////////////////////////////////////////////////////////////////////////////////////
151 - //////////////////////////////////////////////////////////////////////////////////////////////////
176 + ***********************************************************************************************
177 + ***********************************************************************************************
178 + Default Property Declarations
179 + ***********************************************************************************************
180 + ***********************************************************************************************
181 -->
182
183 <!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup -->
@@ -208,231 +237,89 @@
237 </ItemGroup>
238
239 <!--
211 - //////////////////////////////////////////////////////////////////////////////////////////////////
212 - //////////////////////////////////////////////////////////////////////////////////////////////////
213 - Initial Targets
214 - //////////////////////////////////////////////////////////////////////////////////////////////////
215 - //////////////////////////////////////////////////////////////////////////////////////////////////
216 - -->
217 -
218 - <!--
219 - ==================================================================================================
220 - _CheckRequiredProperties
221 -
222 - Checks properties that must be set in the main project file or on the command line before
223 - using this .TARGETS file.
224 -
225 - [IN]
226 - $(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension)
227 - $(OutputType) - Possible values are 'Package', 'PatchCreation', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'
228 - ==================================================================================================
229 - -->
230 - <PropertyGroup>
231 - <_PleaseSetThisInProjectFile>Please set this in the project file before the &lt;Import&gt; of the wix.targets file.</_PleaseSetThisInProjectFile>
232 - <_OutputTypeDescription>Possible values are: 'Package', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'. $(_PleaseSetThisInProjectFile)</_OutputTypeDescription>
233 - </PropertyGroup>
234 - <Target Name="_CheckRequiredProperties">
235 -
236 - <Error
237 - Code="WIX100"
238 - Condition=" '$(OutputName)' == '' "
239 - 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)" />
240 -
241 - <Error
242 - Code="WIX101"
243 - Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'PatchCreation' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' and '$(OutputType)' != 'Bundle' and '$(OutputType)' != 'IntermediatePostLink' "
244 - Text="The OutputType property '$(OutputType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. $(_OutputTypeDescription)" />
245 -
246 - <Error
247 - Code="WIX102"
248 - Condition=" '$(WixPdbType)' != 'none' and '$(WixPdbType)' != 'full' "
249 - Text="The WixPdbType property '$(WixPdbType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. Supported values are: 'full', 'none'" />
250 -
251 - </Target>
252 -
253 - <!--
254 - //////////////////////////////////////////////////////////////////////////////////////////////////
255 - //////////////////////////////////////////////////////////////////////////////////////////////////
256 - Build Targets
257 - //////////////////////////////////////////////////////////////////////////////////////////////////
258 - //////////////////////////////////////////////////////////////////////////////////////////////////
259 - -->
260 -
261 - <!--
262 - ==================================================================================================
263 - CoreBuild - OVERRIDE DependsOn
264 -
265 - The core build step calls each of the build targets.
266 -
267 - This is where we insert our targets into the build process.
268 - ==================================================================================================
269 - -->
270 - <PropertyGroup>
271 - <CoreBuildDependsOn>
272 - BuildOnlySettings;
273 - PrepareForBuild;
274 - PreBuildEvent;
275 -
276 - WixBuild;
277 - Signing;
278 -
279 - GetTargetPath;
280 - PrepareForRun;
281 - IncrementalClean;
282 - PostBuildEvent
283 - </CoreBuildDependsOn>
284 - </PropertyGroup>
285 -
286 -
287 - <!--
288 - //////////////////////////////////////////////////////////////////////////////////////////////////
289 - //////////////////////////////////////////////////////////////////////////////////////////////////
290 - Resolve References Targets
291 - //////////////////////////////////////////////////////////////////////////////////////////////////
292 - //////////////////////////////////////////////////////////////////////////////////////////////////
293 - -->
240 + ***********************************************************************************************
241 + ***********************************************************************************************
242 + Resolve References Section
243 + ***********************************************************************************************
244 + ***********************************************************************************************
245 + -->
246
247 <!--
296 - ==================================================================================================
297 - ResolveReferences - OVERRIDE DependsOn
248 + ================================================================================================
249 + ResolveReferences - OVERRIDE DependsOn
250
299 - ==================================================================================================
300 - -->
251 + ================================================================================================
252 + -->
253 <PropertyGroup>
254 <ResolveReferencesDependsOn>
255 BeforeResolveReferences;
256 AssignProjectConfiguration;
257 ResolveProjectReferences;
258 + FindInvalidProjectReferences;
259 + ResolveNativeProjectReferences;
260 + _ConvertResolvedProjectReferencesIntoWixConstructs;
261 ResolveWixLibraryReferences;
262 ResolveWixExtensionReferences;
263 + _CreateProjectDefineConstants;
264 AfterResolveReferences
265 </ResolveReferencesDependsOn>
266 </PropertyGroup>
267
268 <!--
313 - ================================================================================================
314 - ResolveProjectReferences
269 + ================================================================================================
270 + _WixUpdateProjectReferenceMetadata
271
316 - Builds all of the referenced projects to get their outputs.
272 + Updates project references so they build correctly when referenced by .wixproj.
273
274 [IN]
319 - @(NonVCProjectReference) - The list of non-VC project references.
275 + @(_MSBuildProjectReferenceExistent) - References to projects that exist.
276
277 [OUT]
322 - @(ProjectReferenceWithConfiguration) - The list of non-VC project references.
323 - @(WixLibProjects) - Paths to any .wixlibs that were built by referenced projects.
324 - ================================================================================================
325 - -->
326 - <Target
327 - Name="ResolveProjectReferences"
328 - DependsOnTargets="AssignProjectConfiguration;_SplitProjectReferencesByFileExistence"
329 - Condition=" '@(ProjectReferenceWithConfiguration)' != '' ">
330 -
331 - <!-- Issue a warning for each non-existent project. -->
332 - <Warning
333 - Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
334 - Condition=" '@(_MSBuildProjectReferenceNonexistent)' != '' " />
335 -
336 - <!--
337 - When building this project from the IDE or when building a .sln from the command line or
338 - when only building .wixlib project references, gather the referenced build outputs. The
339 - code that builds the .sln will already have built the project, so there's no need to do
340 - it again here and when building only .wixlib project references we'll use the results to
341 - determine which projects to build.
342 -
343 - The ContinueOnError setting is here so that, during project load, as much information as
344 - possible will be passed to the compilers.
345 - -->
346 - <MSBuild
347 - Projects="@(_MSBuildProjectReferenceExistent)"
348 - Targets="%(_MSBuildProjectReferenceExistent.Targets);GetTargetPath"
349 - Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
350 - Condition="('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '@(_MSBuildProjectReferenceExistent)' != '' "
351 - ContinueOnError="!$(BuildingProject)">
352 -
353 - <Output TaskParameter="TargetOutputs" ItemName="_GatheredProjectReferencePaths" />
354 - </MSBuild>
355 -
356 - <!--
357 - Determine which project references should be built. Note: we will not build any project references
358 - if building in the IDE because it builds project references directly.
359 -
360 - If BuildProjectReferences is 'true' (the default) then take all MSBuild project references that exist
361 - on disk and add them to the list of things to build. This is the easy case.
362 - -->
363 - <CreateItem
364 - Include="@(_MSBuildProjectReferenceExistent)"
365 - Condition=" '$(BuildProjectReferences)' == 'true' and '$(BuildingInsideVisualStudio)' != 'true' ">
366 -
367 - <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
368 - </CreateItem>
369 -
370 - <!--
371 - If BuildProjectReferences is 'wixlib' then build only the MSBuild project references that exist and
372 - create a .wixlib file. That requires us to first filter the gathered project references down to only
373 - those that build .wixlibs.
278 + @(_MSBuildProjectReferenceExistent) - Updated project references.
279 + ================================================================================================
280 -->
375 - <CreateItem
376 - Include="@(_GatheredProjectReferencePaths)"
377 - Condition=" '$(BuildProjectReferences)' == 'wixlib' and '%(Extension)' == '.wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
378 -
379 - <Output TaskParameter="Include" ItemName="_ReferencedWixLibPaths" />
380 - </CreateItem>
381 -
382 - <!--
383 - The second step when building only 'wixlib' project references is to create the list of existing MSBuild
384 - project references that do *not* build a .wixlib. These are the projects that will be skipped.
385 - -->
386 - <CreateItem
387 - Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
388 - Exclude="@(_ReferencedWixLibPaths->'%(MSBuildSourceProjectFile)')"
389 - Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
281 + <Target
282 + Name="_WixUpdateProjectReferenceMetadata"
283 + AfterTargets="_SplitProjectReferencesByFileExistence"
284 + Condition=" '@(_MSBuildProjectReferenceExistent)' != '' ">
285
391 - <Output TaskParameter="Include" ItemName="_ProjectReferencesToSkip" />
392 - </CreateItem>
286 + <UpdateProjectReferenceMetadata
287 + ProjectReferences="@(_MSBuildProjectReferenceExistent)"
288 + IntermediateFolder="$(IntermediateOutputPath)">
289 + <Output TaskParameter="UpdatedProjectReferences" ItemName="_WixPublishProjectReferences" />
290 + </UpdateProjectReferenceMetadata>
291
394 - <!--
395 - Finally, when building only 'wixlib' project references, the list of projects to build are naturally the
396 - list of projects *not* being skipped.
397 - -->
398 - <CreateItem
399 - Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')"
400 - Exclude="@(_ProjectReferencesToSkip)"
401 - Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' ">
292 + <ItemGroup>
293 + <_MSBuildProjectReferenceExistent Remove='@(_WixPublishProjectReferences)' />
294 + <_MSBuildProjectReferenceExistent Include='@(_WixPublishProjectReferences)' />
295 + </ItemGroup>
296
403 - <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" />
404 - </CreateItem>
297 + <ItemGroup>
298 + <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.SetTargetFramework)' == ''">
299 + <SkipGetTargetFrameworkProperties Condition="'$(EnableDynamicPlatformResolution)' != 'true'">true</SkipGetTargetFrameworkProperties>
300 + <UndefineProperties>%(_MSBuildProjectReferenceExistent.UndefineProperties);TargetFramework</UndefineProperties>
301 + </_MSBuildProjectReferenceExistent>
302 + </ItemGroup>
303 + </Target>
304
406 - <!-- Display a warning for all projects being skipped. -->
407 - <Warning
408 - Text="BuildProjectReferences set to '$(BuildProjectReferences)'. Skipping the non-Library project: %(_ProjectReferencesToSkip.Identity)"
409 - Condition=" '@(_ProjectReferencesToSkip)' != '' " />
305 + <!--
306 + ================================================================================================
307 + ResolveNativeProjectReferences
308
411 - <Message
412 - Importance="low"
413 - Text="Project reference to build: %(_ProjectReferencesToBuild.Identity), properties: %(_ProjectReferencesToBuild.Properties)"
414 - Condition=" '@(_ProjectReferencesToBuild)' != '' " />
309 + VC project references must build GetNativeTargetPath because neither GetTargetPath nor
310 + the return of the default build target return the output for a native .vcxproj.
311
416 - <!--
417 - Build referenced projects when building from the command line.
312 + [IN]
313 + @(_MSBuildProjectReferenceExistent) - References to projects that exist.
314
419 - The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default target
420 - is used during a P2P reference. However if a custom build process requires that the referenced
421 - project has a different target to build it can be specified.
315 + [OUT]
316 + @(_ResolvedProjectReferencePaths) - Target paths from .vcxproj outputs added.
317 + ================================================================================================
318 -->
423 - <MSBuild
424 - Projects="@(_ProjectReferencesToBuild)"
425 - Targets="$(ProjectReferenceBuildTargets)"
426 - Properties="%(_ProjectReferencesToBuild.SetConfiguration);%(_ProjectReferencesToBuild.SetPlatform)"
427 - Condition=" '@(_ProjectReferencesToBuild)' != '' ">
428 -
429 - <Output TaskParameter="TargetOutputs" ItemName="_BuiltProjectReferencePaths" />
430 - </MSBuild>
319 + <Target
320 + Name="ResolveNativeProjectReferences"
321 + Condition=" '@(_MSBuildProjectReferenceExistent)' != '' ">
322
432 - <!--
433 - VC project references must build GetNativeTargetPath because neither GetTargetPath nor the return of the default build
434 - target return the output for a native .vcxproj.
435 - -->
323 <MSBuild
324 Projects="@(_MSBuildProjectReferenceExistent)"
325 Targets="GetNativeTargetPath"
@@ -440,98 +327,141 @@
327 Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' ">
328
329 <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" />
443 - <Output TaskParameter="TargetOutputs" ItemName="_MSBuildResolvedProjectReferencePaths" />
330 </MSBuild>
331 + </Target>
332
446 - <!-- Assign the unique gathered and built project references to the resolved project
447 - reference paths. -->
448 - <RemoveDuplicates Inputs="@(_GatheredProjectReferencePaths);@(_BuiltProjectReferencePaths)">
449 - <Output TaskParameter="Filtered" ItemName="_ResolvedProjectReferencePaths" />
450 - <Output TaskParameter="Filtered" ItemName="_MSBuildResolvedProjectReferencePaths" />
451 - </RemoveDuplicates>
333 + <!--
334 + ================================================================================================
335 + _ConvertResolvedProjectReferencesIntoWixConstructs
336
453 - <!-- Create list of all .wixlib project references. -->
454 - <CreateItem
455 - Include="@(_ResolvedProjectReferencePaths)"
456 - Condition=" '%(Extension)' == '.wixlib' ">
337 + Converts _ResolvedProjectReferencePaths (which are the outputs of the ProjectReferences that
338 + normally would be passed through ResolveAssemblyReferences then be passed to the C# compiler
339 + as references) into the appropriate WiX constructs. For example, references to .wixlibs are
340 + converted into WixLibrary items. In the end, _ResolvedProjectReferencePaths is emptied to
341 + prevent ResolveAssemblyReferences and other non-sensical targets (from a WiX point of view)
342 + from doing work.
343 +
344 + [IN]
345 + @(_ResolvedProjectReferencePaths) - Resolved project references.
346 + $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE.
347 +
348 + [OUT]
349 + $(ProjectReferenceDefineConstants) - Define constants from project references.
350 + @(LinkerBindInputPaths) - Bind paths from project references.
351 + @(WixLibrary) - Target paths from .vcxproj outputs added.
352 + @(_WixReferencedProjectOutputs) - Copy of _ResolvedProjectReferencePaths for use in up-to-date checks.
353 + @(_ResolvedProjectReferencePaths) - All resolved reference paths emptied.
354 + ================================================================================================
355 + -->
356 + <PropertyGroup>
357 + <_ConvertResolvedProjectReferencesIntoWixConstructs></_ConvertResolvedProjectReferencesIntoWixConstructs>
358 + </PropertyGroup>
359 + <Target
360 + Name="_ConvertResolvedProjectReferencesIntoWixConstructs"
361 + DependsOnTargets="$(_CreateProjectDefineConstantsDependsOn)"
362 + Condition=" '@(_ResolvedProjectReferencePaths)' != '' ">
363 +
364 + <!-- Save all the project reference outputs before we start removing -->
365 + <ItemGroup>
366 + <_WixReferencedProjectOutputs Include="@(_ResolvedProjectReferencePaths)" />
367 + </ItemGroup>
368
458 - <Output TaskParameter="Include" ItemName="WixLibProjects" />
459 - </CreateItem>
369 + <ItemGroup>
370 + <WixLibrary Include="@(_ResolvedProjectReferencePaths)" Condition=" '%(Extension)' == '.wixlib' " />
371 + <_ResolvedProjectReferencePaths Remove="@(WixLibrary)" />
372 + </ItemGroup>
373
461 - <Message
462 - Importance="low"
463 - Text="Library from referenced projects: %(WixLibProjects.Identity)"
464 - Condition=" '@(WixLibProjects)' != '' " />
374 + <!-- Convert resolved project references into compiler defines and named and unamed bind paths-->
375 + <CreateProjectReferenceDefineConstantsAndBindPaths
376 + ResolvedProjectReferences="@(_ResolvedProjectReferencePaths)"
377 + ProjectConfigurations="$(VSProjectConfigurations)">
378 + <Output TaskParameter="BindPaths" ItemName="LinkerBindInputPaths" />
379 + <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" />
380 + </CreateProjectReferenceDefineConstantsAndBindPaths>
381
382 + <!--
383 + Empty the resolved project references to prevent ResolveAssemblyReferences and other C# specific
384 + behavior from kicking in
385 + -->
386 + <ItemGroup>
387 + <_ResolvedProjectReferencePaths Remove="@(_ResolvedProjectReferencePaths)" />
388 + </ItemGroup>
389 </Target>
390
391 <!--
469 - ================================================================================================
470 - ResolveWixLibraryReferences
392 + ================================================================================================
393 + ResolveWixLibraryReferences
394 +
395 + Resolve the library references to full paths by searching using $(WixLibrarySearchPaths) and
396 + including the outputs from any ProjectReferences that output .wixlib.
397
472 - Resolve the library references to full paths.
398 + By default the WixLibrarySearchPaths property is set to find libraries in the following order:
399 +
400 + (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
401 + (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
402 + (3) Treat the reference's Include as if it were a real file name.
403 + (4) Path specified by the WixExtDir property.
404
405 [IN]
475 - @(WixLibrary) - The list of .wixlib files.
406 + @(WixLibrary) - the list of .wixlib files.
407 + @(_ResolvedProjectReferencePaths) - resolved project references.
408 + $(WixLibrarySearchPaths) - optional search paths used to find .wixlibs.
409
410 [OUT]
411 @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries
479 - ================================================================================================
480 - -->
412 + ================================================================================================
413 + -->
414 <PropertyGroup>
415 <ResolveWixLibraryReferencesDependsOn></ResolveWixLibraryReferencesDependsOn>
416 </PropertyGroup>
417 <Target
418 Name="ResolveWixLibraryReferences"
486 - DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)"
487 - Condition=" '@(WixLibrary)' != ''">
419 + DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)">
420
489 - <!--
490 - The WixLibrarySearchPaths property is set to find assemblies in the following order:
491 -
492 - (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
493 - (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
494 - (3) Treat the reference's Include as if it were a real file name.
495 - (4) Path specified by the WixExtDir property.
496 - -->
497 - <CreateProperty Condition=" '$(WixLibrarySearchPaths)' == '' " Value="
498 - $(ReferencePaths);
499 - {HintPathFromItem};
500 - {RawFileName};
501 - $(WixExtDir)
502 - ">
503 - <Output TaskParameter="Value" PropertyName="WixLibrarySearchPaths" />
504 - </CreateProperty>
421 + <PropertyGroup>
422 + <WixLibrarySearchPaths Condition=" '$(WixLibrarySearchPaths)' == '' ">
423 + $(ReferencePaths);
424 + {HintPathFromItem};
425 + {RawFileName};
426 + $(WixExtDir)
427 + </WixLibrarySearchPaths>
428 + </PropertyGroup>
429
430 <ResolveWixReferences
507 - WixReferences="@(WixLibrary)"
508 - SearchPaths="$(WixLibrarySearchPaths)"
509 - SearchFilenameExtensions=".wixlib">
431 + WixReferences="@(WixLibrary)"
432 + SearchPaths="$(WixLibrarySearchPaths)"
433 + SearchFilenameExtensions=".wixlib"
434 + Condition=" '@(WixLibrary)' != ''">
435 <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixLibraryPaths" />
436 </ResolveWixReferences>
437
513 - <!-- Remove duplicate library items that would cause build errors -->
438 <RemoveDuplicates Inputs="@(_AllResolvedWixLibraryPaths)">
439 <Output TaskParameter="Filtered" ItemName="_ResolvedWixLibraryPaths" />
440 </RemoveDuplicates>
517 -
441 </Target>
442
443 <!--
521 - ==================================================================================================
522 - ResolveWixExtensionReferences
444 + ================================================================================================
445 + ResolveWixExtensionReferences
446
447 Resolves WiX extension references to full paths. Any properties you use
448 to resolve paths to extensions must be defined before importing this
449 file or the extensions will be automatically resolved to $(WixExtDir).
450
451 + By default the WixExtensionSearchPaths property is set to find extensions in the following order:
452 +
453 + (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
454 + (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
455 + (3) Treat the reference's Include as if it were a real file name.
456 + (4) Path specified by the WixExtDir property.
457 +
458 [IN]
459 @(WixExtension) - WixExtension item group
460
461 [OUT]
462 @(_ResolvedWixExtensionPaths) - Item group with full paths to extensions
533 - ==================================================================================================
534 - -->
463 + ================================================================================================
464 + -->
465 <PropertyGroup>
466 <ResolveWixExtensionReferencesDependsOn></ResolveWixExtensionReferencesDependsOn>
467 </PropertyGroup>
@@ -540,14 +470,6 @@
470 DependsOnTargets="$(ResolveWixExtensionReferencesDependsOn)"
471 Condition=" '@(WixExtension)' != ''">
472
543 - <!--
544 - The WixExtensionSearchPaths property is set to find assemblies in the following order:
545 -
546 - (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file.
547 - (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
548 - (3) Treat the reference's Include as if it were a real file name.
549 - (4) Path specified by the WixExtDir property.
550 - -->
473 <CreateProperty Condition=" '$(WixExtensionSearchPaths)' == '' " Value="
474 $(ReferencePaths);
475 {HintPathFromItem};
@@ -571,81 +493,146 @@
493 </Target>
494
495 <!--
574 - ================================================================================================
575 - GetTargetPath - OVERRIDE DependsOn
496 + ***********************************************************************************************
497 + ***********************************************************************************************
498 + PrepareResources Section
499 + ***********************************************************************************************
500 + ***********************************************************************************************
501 + -->
502
577 - This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be
578 - produced if we built this project.
579 - ================================================================================================
580 - -->
581 - <PropertyGroup>
582 - <GetTargetPathDependsOn>AssignTargetPaths</GetTargetPathDependsOn>
583 - </PropertyGroup>
503 + <!--
504 + ================================================================================================
505 + AssignTargetPaths - OVERRIDE Target
506
507 + Determines the final list of culture groups to build based on either the Cultures property or
508 + those specified in .wxl files.
509 +
510 + Culture groups specified in the Cultures property must be specified as a semi-colon
511 + delimited list of groups, with comma-delimited cultures within a group.
512 + For example:
513 + <Cultures>en-US,en;en-GB,en</Cultures>
514 + This will build 2 targets, outputing to en-US and en-GB sub-folders. Light will first look
515 + for strings in the first culture (en-US or en-GB) then the second (en).
516 +
517 + Cultures of .wxl files will be used when the Culture property is not set. The culture of a
518 + .wxl file is determined by the Culture attribute in the WixLocalization element in the file
519 +
520 + Sets the OutputFolder metadata on each culture group. In most cases this is the same as the
521 + first culture in the culture group. When the Culture's property is unspecified and no .wxl
522 + files are provided this is the same as the output directory. When the Culture's property
523 + specifies a single culture group and no .wxl files are provided this is the same as the output
524 + directory.
525 +
526 + Updates the TargetPath and TargetPdbPath properties to be used in subsequent targets.
527 +
528 + [IN]
529 + @(EmbeddedResource) - The list of wxl files to use for localization.
530 + $(Cultures) - The list of culture groups to build.
531 +
532 + [OUT]
533 + @(CultureGroup) - The list of culture group strings with OutputFolder metadata
534 + $(TargetPath) - Property list of target link output MSIs/MSMs
535 + $(TargetPdbPath) - Property list of target output pdbs
536 + ================================================================================================
537 + -->
538 + <Target
539 + Name="AssignTargetPaths"
540 + Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
541 +
542 + <WixAssignCulture Cultures="$(Cultures)" Files="@(EmbeddedResource)">
543 + <Output TaskParameter="CultureGroups" ItemName="CultureGroup" />
544 + </WixAssignCulture>
545 +
546 + <!-- Expand the culture groups then put them back into the appropriate property -->
547 + <ItemGroup>
548 + <_CulturedTargetPath Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)" />
549 + <_CulturedTargetPdbPath Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbFileName)" />
550 + </ItemGroup>
551 +
552 + <PropertyGroup>
553 + <TargetPath>@(_CulturedTargetPath)</TargetPath>
554 + <TargetPdbPath>@(_CulturedTargetPdbPath)</TargetPdbPath>
555 + </PropertyGroup>
556 + </Target>
557
558 <!--
587 - //////////////////////////////////////////////////////////////////////////////////////////////////
588 - //////////////////////////////////////////////////////////////////////////////////////////////////
589 - WixBuild Targets
590 - //////////////////////////////////////////////////////////////////////////////////////////////////
591 - //////////////////////////////////////////////////////////////////////////////////////////////////
592 - -->
559 + ================================================================================================
560 + CreateManifestResourceNames
561 +
562 + Converts the EmbeddedResource into _WixLocalizationFile to disable satellite assembly
563 + generation in common targets.
564 + ================================================================================================
565 + -->
566 + <Target
567 + Name="CreateManifestResourceNames"
568 + Condition=" '@(EmbeddedResource)' !='' ">
569 +
570 + <ItemGroup>
571 + <_WixLocalizationFile Include="@(EmbeddedResource)">
572 + <Type>wxl</Type>
573 + </_WixLocalizationFile>
574 +
575 + <EmbeddedResource Remove="@(EmbeddedResource)" />
576 + </ItemGroup>
577 + </Target>
578
579 <!--
595 - ==================================================================================================
596 - WixBuild
597 - ==================================================================================================
598 - -->
580 + ================================================================================================
581 + GetTargetPath - OVERRIDE DependsOn
582 +
583 + This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be
584 + produced if we built this project.
585 + ================================================================================================
586 + -->
587 <PropertyGroup>
600 - <WixBuildDependsOn>
601 - ResolveReferences;
602 - BeforeCompile;
603 - _TimeStampBeforeCompile;
588 + <GetTargetPathDependsOn>$(GetTargetPathDependsOn);AssignTargetPaths</GetTargetPathDependsOn>
589 + </PropertyGroup>
590
605 - CalculateDefineConstants;
606 - Harvest;
591 + <!--
592 + ***********************************************************************************************
593 + ***********************************************************************************************
594 + Compile Section
595 + ***********************************************************************************************
596 + ***********************************************************************************************
597 + -->
598
608 - GenerateCompileWithObjectPath;
599 + <!--
600 + ================================================================================================
601 + CoreCompile
602
603 + ================================================================================================
604 + -->
605 + <PropertyGroup>
606 + <CoreCompileDependsOn>
607 AssignTargetPaths;
608 ReadPreviousBindInputsAndBuiltOutputs;
612 -
613 - CoreWixBuild;
614 -
615 - UpdateLinkFileWrites;
616 - _TimeStampAfterCompile;
617 - AfterCompile
618 - </WixBuildDependsOn>
609 + _CreateProjectDefineConstants;
610 + $(CoreCompileDependsOn)
611 + </CoreCompileDependsOn>
612 </PropertyGroup>
613 <Target
621 - Name="WixBuild"
622 - DependsOnTargets="$(WixBuildDependsOn)" />
623 -
624 - <Target
625 - Name="CoreWixBuild"
614 + Name="CoreCompile"
615 Inputs="@(Compile);
616 @(Content);
628 - @(EmbeddedResource);
617 + @(_WixLocalizationFile);
618 @(WixObject);
630 - @(_ResolvedProjectReferencePaths);
619 + @(_WixReferencedProjectOutputs);
620 @(_ResolvedWixLibraryPaths);
621 @(_ResolvedWixExtensionPaths);
633 - @(_BindInputs);
634 - $(MSBuildAllProjects)"
622 + @(_BindInputs)"
623 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
624 + DependsOnTargets="$(CoreCompileDependsOn)"
625 Condition=" '@(Compile)' != '' ">
626
627 <PropertyGroup>
639 - <!--<OutputFile>$([System.IO.Path]::GetFullPath($(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)))</OutputFile>-->
628 <OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetFileName)))</OutputFile>
641 - <!--<OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)))</OutputFile>-->
629 <PdbOutputFile>$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName)</PdbOutputFile>
630 </PropertyGroup>
631
632 <WixBuild
646 - SourceFiles="@(_CompileWithObjectPath)"
633 + SourceFiles="@(Compile)"
634 LibraryFiles="@(WixLibProjects);@(_ResolvedWixLibraryPaths)"
648 - LocalizationFiles="@(EmbeddedResource)"
635 + LocalizationFiles="@(_WixLocalizationFile)"
636
637 Cultures="%(CultureGroup.Identity)"
638
@@ -699,28 +686,19 @@
686 -->
687 </Target>
688
702 -
689 <!--
704 - ==================================================================================================
705 - CalculateDefineConstants
706 -
707 - Adds project references to the constants passed into the compiler.
690 + ================================================================================================
691 + _CreateProjectDefineConstants
692
709 - [IN]
710 - @(_ResolvedProjectReferencePaths) - paths to projects' outputs
711 - $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE
712 -
713 - [OUT]
714 - $(ProjectReferenceDefineConstants) - the list of referenced project variables to be passed into the compiler
715 - ==================================================================================================
716 - -->
693 + Adds properties as define constants passed into the compiler.
694 + ================================================================================================
695 + -->
696 <PropertyGroup>
718 - <CalculateDefineConstantsDependsOn>ResolveReferences</CalculateDefineConstantsDependsOn>
697 + <_CreateProjectDefineConstantsDependsOn></_CreateProjectDefineConstantsDependsOn>
698 </PropertyGroup>
699 <Target
721 - Name="CalculateDefineConstants"
722 - DependsOnTargets="$(CalculateDefineConstantsDependsOn)"
723 - Condition=" '@(_ResolvedProjectReferencePaths)' != '' ">
700 + Name="_CreateProjectDefineConstants"
701 + DependsOnTargets="$(_CreateProjectDefineConstantsDependsOn)">
702
703 <PropertyGroup>
704 <ProjectDefineConstants>
@@ -748,100 +726,11 @@
726 <SolutionDefineConstants Condition=" '$(SolutionName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionName=$(SolutionName)</SolutionDefineConstants>
727 <SolutionDefineConstants Condition=" '$(SolutionPath)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionPath=$(SolutionPath)</SolutionDefineConstants>
728 </PropertyGroup>
751 -
752 - <CreateProjectReferenceDefineConstants
753 - ProjectReferencePaths="@(_ResolvedProjectReferencePaths)"
754 - ProjectConfigurations="$(VSProjectConfigurations)">
755 -
756 - <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" />
757 - </CreateProjectReferenceDefineConstants>
758 -
759 - <ItemGroup>
760 - <LinkerBindInputPaths Include="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)" />
761 - </ItemGroup>
762 - </Target>
763 -
764 - <!--
765 - ================================================================================================
766 - GenerateCompileWithObjectPath
767 -
768 - Generates metadata on the for compile output objects.
769 -
770 - ================================================================================================
771 - -->
772 - <PropertyGroup>
773 - <GenerateCompileWithObjectPathDependsOn></GenerateCompileWithObjectPathDependsOn>
774 - </PropertyGroup>
775 - <Target
776 - Name="GenerateCompileWithObjectPath"
777 - Condition=" '@(Compile)' != '' ">
778 -
779 - <GenerateCompileWithObjectPath
780 - Compile="@(Compile)"
781 - IntermediateOutputPath="$(IntermediateOutputPath)">
782 - <Output TaskParameter="CompileWithObjectPath" ItemName="_CompileWithObjectPath" />
783 - </GenerateCompileWithObjectPath>
784 - </Target>
785 -
786 - <!--
787 - ================================================================================================
788 - AssignTargetPaths - OVERRIDE Target
789 -
790 - Determines the final list of culture groups to build based on either the Cultures property or
791 - those specified in .wxl files.
792 -
793 - Culture groups specified in the Cultures property must be specified as a semi-colon
794 - delimited list of groups, with comma-delimited cultures within a group.
795 - For example:
796 - <Cultures>en-US,en;en-GB,en</Cultures>
797 - This will build 2 targets, outputing to en-US and en-GB sub-folders. Light will first look
798 - for strings in the first culture (en-US or en-GB) then the second (en).
799 -
800 - Cultures of .wxl files will be used when the Culture property is not set. The culture of a
801 - .wxl file is determined by the Culture attribute in the WixLocalization element in the file
802 -
803 - Sets the OutputFolder metadata on each culture group. In most cases this is the same as the
804 - first culture in the culture group. When the Culture's property is unspecified and no .wxl
805 - files are provided this is the same as the output directory. When the Culture's property
806 - specifies a single culture group and no .wxl files are provided this is the same as the output
807 - directory.
808 -
809 - Updates the TargetPath and TargetPdbPath properties to be used in subsequent targets.
810 -
811 - [IN]
812 - @(EmbeddedResource) - The list of wxl files to use for localization.
813 - $(Cultures) - The list of culture groups to build.
814 -
815 - [OUT]
816 - @(CultureGroup) - The list of culture group strings with OutputFolder metadata
817 - $(TargetPath) - Property list of target link output MSIs/MSMs
818 - $(TargetPdbPath) - Property list of target output pdbs
819 -
820 - ================================================================================================
821 - -->
822 - <Target
823 - Name="AssignTargetPaths"
824 - Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
825 -
826 - <WixAssignCulture Cultures="$(Cultures)" Files="@(EmbeddedResource)">
827 - <Output TaskParameter="CultureGroups" ItemName="CultureGroup" />
828 - </WixAssignCulture>
829 -
830 - <!-- Expand the culture groups then put them back into the appropriate property -->
831 - <ItemGroup>
832 - <_CulturedTargetPath Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)" />
833 - <_CulturedTargetPdbPath Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbFileName)" />
834 - </ItemGroup>
835 -
836 - <PropertyGroup>
837 - <TargetPath>@(_CulturedTargetPath)</TargetPath>
838 - <TargetPdbPath>@(_CulturedTargetPdbPath)</TargetPdbPath>
839 - </PropertyGroup>
729 </Target>
730
731 <!--
843 - ================================================================================================
844 - ReadPreviousBindInputsAndBuiltOutputs
732 + ================================================================================================
733 + ReadPreviousBindInputsAndBuiltOutputs
734
735 Reads a previous build's Bind contents and built outputs file into @(_BindInputs) and
736 @(_BindBuiltOutputs) respectively.
@@ -860,8 +749,8 @@
749 @(_BindInputs) - the content files required to bind (i.e. the Binary/@SourceFile and File/@Source files).
750 @(_BindBuiltOutputs) - the previously built .msi, .msm, .pcp, .exe .wixpdb, .cabs, etc.
751 Does not include content copied to output folder.
863 - ================================================================================================
864 - -->
752 + ================================================================================================
753 + -->
754 <Target
755 Name="ReadPreviousBindInputsAndBuiltOutputs">
756
@@ -878,26 +767,27 @@
767 </Target>
768
769 <!--
881 - ================================================================================================
882 - UpdateLinkFileWrites
770 + ================================================================================================
771 + UpdateFileWritesWithBindInformation
772
773 Reads the bind outputs file(s) output generated during WixBuild to correctly set the @(FileWrites)
774 item. Most targets have it easy because they can do a static mapping from inputs to the outputs.
775 However, the WixBuild target outputs are determined after a rather complex calculation we call
776 linking and binding!
777
889 - This target runs independently after Link to ensure that @(FileWrites) is updated even if the
890 - "WixBuild" task fails.
778 + This is an "after target" of CoreCompile to ensure it always runs, even if compiler was up to date. It
779 + reads the outputs file generated during the CoreCompile target.
780
781 [IN]
782 Path to bind outputs file(s).
783
784 [OUT]
785 @(FileWrites) updated with outputs from bind.
897 - ================================================================================================
898 - -->
786 + ================================================================================================
787 + -->
788 <Target
900 - Name="UpdateLinkFileWrites">
789 + Name="UpdateFileWritesWithBindInformation"
790 + AfterTargets="CoreCompile">
791
792 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)">
793 <Output TaskParameter="Lines" ItemName="FileWrites"/>
@@ -913,19 +803,30 @@
803 </Target>
804
805 <!--
916 - //////////////////////////////////////////////////////////////////////////////////////////////////
917 - //////////////////////////////////////////////////////////////////////////////////////////////////
918 - AllProjectOutputGroups Section
919 - //////////////////////////////////////////////////////////////////////////////////////////////////
920 - //////////////////////////////////////////////////////////////////////////////////////////////////
921 - -->
806 + ***********************************************************************************************
807 + ***********************************************************************************************
808 + AllProjectOutputGroups Section
809 + ***********************************************************************************************
810 + ***********************************************************************************************
811 + -->
812
813 <!--
924 - ==================================================================================================
925 - AllProjectOutputGroups - OVERRIDE Target
814 + ================================================================================================
815 + AllProjectOutputGroups - OVERRIDE Target
816
927 - ==================================================================================================
928 - -->
817 + The targets below drive output groups, which provide generic information about a
818 + project's inputs (e.g., content files, compilation sources, etc.) and built outputs
819 + (e.g., built EXE/MSI, wixpdb, content files, etc.)
820 +
821 + Each target may produce two kinds of items: outputs and dependencies. Outputs are
822 + items from the current project; dependencies are items that are brought into the
823 + current project as a result of referencing other projects or components.
824 +
825 + For both outputs and dependencies, the Include attribute
826 + specifies the location of the output/dependency; it must be a full path. Any number
827 + of additional attributes may be placed on an output/dependency item.
828 + ================================================================================================
829 + -->
830 <Target
831 Name="AllProjectOutputGroups"
832 DependsOnTargets="
@@ -935,9 +836,9 @@
836 ContentFilesProjectOutputGroup" />
837
838 <!--
938 - This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE.
939 - Reading an item is faster than invoking a target.
940 - -->
839 + This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE.
840 + Reading an item is faster than invoking a target.
841 + -->
842 <ItemGroup>
843 <BuiltProjectOutputGroupKeyOutput Include="$(TargetPath)">
844 <IsKeyOutput>true</IsKeyOutput>
@@ -947,10 +848,10 @@
848 </ItemGroup>
849
850 <!--
950 - ==================================================================================================
951 - BuiltProjectOutputGroup - OVERRIDE Target
952 - ==================================================================================================
953 - -->
851 + ================================================================================================
852 + BuiltProjectOutputGroup - OVERRIDE Target
853 + ================================================================================================
854 + -->
855 <PropertyGroup>
856 <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</BuiltProjectOutputGroupDependsOn>
857 </PropertyGroup>
@@ -961,7 +862,7 @@
862
863 <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below -->
864
964 - <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from linker. -->
865 + <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from compiler. -->
866 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)">
867 <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/>
868 </ReadLinesFromFile>
@@ -981,12 +882,12 @@
882 </Target>
883
884 <!--
984 - ==================================================================================================
985 - DebugSymbolsProjectOutputGroup
885 + ================================================================================================
886 + DebugSymbolsProjectOutputGroup - OVERRIDE Target
887
888 Populates the Debug Symbols project output group.
988 - ==================================================================================================
989 - -->
889 + ================================================================================================
890 + -->
891 <PropertyGroup>
892 <DebugSymbolsProjectOutputGroupDependsOn>AssignTargetPaths</DebugSymbolsProjectOutputGroupDependsOn>
893 </PropertyGroup>
@@ -1001,20 +902,29 @@
902 </ItemGroup>
903 </Target>
904
905 + <!--
906 + ***********************************************************************************************
907 + ***********************************************************************************************
908 + PrepareForRun Section
909 + ***********************************************************************************************
910 + ***********************************************************************************************
911 + -->
912
913 <!--
1006 - ==================================================================================================
1007 - CopyFilesToOutputDirectory - OVERRIDE Target
914 + ================================================================================================
915 + CopyFilesToOutputDirectory - OVERRIDE Target
916
1009 - Copy all build outputs, satellites and other necessary files to the final directory.
1010 - ============================================================
1011 - -->
917 + Copy all build outputs, satellites and other necessary files to the final directory.
918 + ================================================================================================
919 + -->
920 <Target
921 Name="CopyFilesToOutputDirectory">
922
923 <PropertyGroup>
924 <!-- By default we're using hard links to copy to the output directory, disabling this could slow the build significantly -->
925 <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition=" '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == '' ">true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>
926 + <CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)' == ''">false</CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible>
927 + <ErrorIfLinkFailsForCopyFilesToOutputDirectory Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(ErrorIfLinkFailsForCopyFilesToOutputDirectory)' == ''">false</ErrorIfLinkFailsForCopyFilesToOutputDirectory>
928 </PropertyGroup>
929
930 <PropertyGroup>
@@ -1041,16 +951,15 @@
951 Retries="$(CopyRetryCount)"
952 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
953 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
1044 - Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
1045 - >
954 + UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
955 + ErrorIfLinkFails="$(ErrorIfLinkFailsForCopyFilesToOutputDirectory)"
956 + Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'">
957
958 <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
959 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
1049 -
960 </Copy>
961
962 <Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(TargetPath)" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />
1053 - <!--<Message Importance="High" Text="$(MSBuildProjectName) -&gt; @(MainAssembly->'%(FullPath)')" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />-->
963
964 <!-- Copy the debug information file (.pdb), if any
965 <Copy
@@ -1069,11 +978,15 @@
978 -->
979 </Target>
980
1072 -
981 <Import Project="$(WixHarvestTargetsPath)" Condition=" '$(WixHarvestTargetsPath)' != '' and Exists('$(WixHarvestTargetsPath)')" />
982 <Import Project="$(WixSigningTargetsPath)" Condition=" '$(WixSigningTargetsPath)' != '' and Exists('$(WixSigningTargetsPath)')" />
983
984 <!-- Extension point: Define CustomAfterWixTargets to a .targets file that you want to include after this file. -->
985 <Import Project="$(CustomAfterWixTargets)" Condition=" '$(CustomAfterWixTargets)' != '' and Exists('$(CustomAfterWixTargets)')" />
986
987 + <PropertyGroup>
988 + <DefaultItemExcludes Condition=" '$(BaseOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseOutputPath)**</DefaultItemExcludes>
989 + <DefaultItemExcludes Condition=" '$(BaseIntermediateOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseIntermediateOutputPath)**</DefaultItemExcludes>
990 + <DefaultExcludesInProjectFolder>$(DefaultItemExcludesInProjectFolder);**/.*/**</DefaultExcludesInProjectFolder>
991 + </PropertyGroup>
992 </Project>