diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-12-19 12:06:58 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-12-30 12:51:23 -0800 |
| commit | 91259637be1eccd149093eb49c7ff68826d1d331 (patch) | |
| tree | ccb25b69b2e9017ff894c9fd7e98a11842f62b0e | |
| parent | 4cd4828e6225a2ff5e81002a7f6f7401570b21c4 (diff) | |
| download | wix-91259637be1eccd149093eb49c7ff68826d1d331.tar.gz wix-91259637be1eccd149093eb49c7ff68826d1d331.tar.bz2 wix-91259637be1eccd149093eb49c7ff68826d1d331.zip | |
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.
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs | 271 | ||||
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstantsAndBindPaths.cs | 269 | ||||
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs | 145 | ||||
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/UpdateProjectReferenceMetadata.cs | 95 | ||||
| -rw-r--r-- | src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj | 4 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/Sdk/Sdk.props | 16 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/Sdk/Sdk.targets | 13 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj | 2 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props | 7 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets | 10 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.harvest.targets | 14 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.props | 53 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.signing.targets | 16 | ||||
| -rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.targets | 881 |
14 files changed, 852 insertions, 944 deletions
diff --git a/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs b/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs deleted file mode 100644 index 7cda6b01..00000000 --- a/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstants.cs +++ /dev/null | |||
| @@ -1,271 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 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 | } | ||
diff --git a/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstantsAndBindPaths.cs b/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstantsAndBindPaths.cs new file mode 100644 index 00000000..af4bbd0c --- /dev/null +++ b/src/wix/WixToolset.BuildTasks/CreateProjectReferenceDefineConstantsAndBindPaths.cs | |||
| @@ -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 | } | ||
diff --git a/src/wix/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs b/src/wix/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs deleted file mode 100644 index a5f76618..00000000 --- a/src/wix/WixToolset.BuildTasks/GenerateCompileWithObjectPath.cs +++ /dev/null | |||
| @@ -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 | } | ||
diff --git a/src/wix/WixToolset.BuildTasks/UpdateProjectReferenceMetadata.cs b/src/wix/WixToolset.BuildTasks/UpdateProjectReferenceMetadata.cs new file mode 100644 index 00000000..4de948ba --- /dev/null +++ b/src/wix/WixToolset.BuildTasks/UpdateProjectReferenceMetadata.cs | |||
| @@ -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 | } | ||
diff --git a/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj b/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj index b35e68d2..56c7b016 100644 --- a/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj +++ b/src/wix/WixToolset.BuildTasks/WixToolset.BuildTasks.csproj | |||
| @@ -15,17 +15,15 @@ | |||
| 15 | 15 | ||
| 16 | <ItemGroup> | 16 | <ItemGroup> |
| 17 | <PackageReference Include="WixToolset.Dtf.WindowsInstaller" /> | 17 | <PackageReference Include="WixToolset.Dtf.WindowsInstaller" /> |
| 18 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> | ||
| 18 | </ItemGroup> | 19 | </ItemGroup> |
| 19 | 20 | ||
| 20 | <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" > | 21 | <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" > |
| 21 | <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" /> | 22 | <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" /> |
| 22 | <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" /> | 23 | <ProjectReference Include="..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" /> |
| 23 | <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" /> | 24 | <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" /> |
| 24 | |||
| 25 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> | ||
| 26 | </ItemGroup> | 25 | </ItemGroup> |
| 27 | 26 | ||
| 28 | <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' "> | 27 | <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' "> |
| 29 | <PackageReference Include="Microsoft.Build.Tasks.Core" /> | ||
| 30 | </ItemGroup> | 28 | </ItemGroup> |
| 31 | </Project> | 29 | </Project> |
diff --git a/src/wix/WixToolset.Sdk/Sdk/Sdk.props b/src/wix/WixToolset.Sdk/Sdk/Sdk.props index c517a1cf..b293f911 100644 --- a/src/wix/WixToolset.Sdk/Sdk/Sdk.props +++ b/src/wix/WixToolset.Sdk/Sdk/Sdk.props | |||
| @@ -1,23 +1,17 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 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 | <!-- 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 | ||
| 3 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> | 4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 4 | <PropertyGroup> | 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> | ||
| 6 | </PropertyGroup> | 8 | </PropertyGroup> |
| 7 | 9 | ||
| 8 | <PropertyGroup> | 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> | ||
| 14 | <EnableDefaultItems Condition=" '$(EnableDefaultItems)' == '' ">true</EnableDefaultItems> | 11 | <EnableDefaultItems Condition=" '$(EnableDefaultItems)' == '' ">true</EnableDefaultItems> |
| 15 | <EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">true</EnableDefaultCompileItems> | 12 | <EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">true</EnableDefaultCompileItems> |
| 16 | <EnableDefaultEmbeddedResourceItems Condition=" '$(EnableDefaultEmbeddedResourceItems)' == '' ">true</EnableDefaultEmbeddedResourceItems> | 13 | <EnableDefaultEmbeddedResourceItems Condition=" '$(EnableDefaultEmbeddedResourceItems)' == '' ">true</EnableDefaultEmbeddedResourceItems> |
| 17 | </PropertyGroup> | 14 | </PropertyGroup> |
| 18 | 15 | ||
| 19 | <ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' "> | 16 | <Import Project="$(WixPropsPath)" Condition=" '$(WixPropsPath)' != '' and Exists('$(WixPropsPath)')" /> |
| 20 | <Compile Include="**/*.wxs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultCompileItems)' == 'true' " /> | ||
| 21 | <EmbeddedResource Include="**/*.wxl" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " /> | ||
| 22 | </ItemGroup> | ||
| 23 | </Project> | 17 | </Project> |
diff --git a/src/wix/WixToolset.Sdk/Sdk/Sdk.targets b/src/wix/WixToolset.Sdk/Sdk/Sdk.targets index e21cf5c6..3940d6d5 100644 --- a/src/wix/WixToolset.Sdk/Sdk/Sdk.targets +++ b/src/wix/WixToolset.Sdk/Sdk/Sdk.targets | |||
| @@ -1,15 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 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 | <!-- 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 | ||
| 3 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> | 4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 4 | <PropertyGroup> | ||
| 5 | <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
| 6 | </PropertyGroup> | ||
| 7 | |||
| 8 | <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' and Exists('$(WixTargetsPath)')" /> | 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> | ||
| 15 | </Project> | 6 | </Project> |
diff --git a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj index e25ebaa8..33fdc7b2 100644 --- a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj +++ b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj | |||
| @@ -13,9 +13,11 @@ | |||
| 13 | 13 | ||
| 14 | <ItemGroup> | 14 | <ItemGroup> |
| 15 | <Content Include="build\$(MSBuildThisFileName).props" CopyToOutputDirectory="PreserveNewest" /> | 15 | <Content Include="build\$(MSBuildThisFileName).props" CopyToOutputDirectory="PreserveNewest" /> |
| 16 | <Content Include="build\$(MSBuildThisFileName).targets" CopyToOutputDirectory="PreserveNewest" /> | ||
| 16 | <Content Include="tools\wix.ca.targets" CopyToOutputDirectory="PreserveNewest" /> | 17 | <Content Include="tools\wix.ca.targets" CopyToOutputDirectory="PreserveNewest" /> |
| 17 | <Content Include="tools\wix.harvest.targets" CopyToOutputDirectory="PreserveNewest" /> | 18 | <Content Include="tools\wix.harvest.targets" CopyToOutputDirectory="PreserveNewest" /> |
| 18 | <Content Include="tools\wix.signing.targets" CopyToOutputDirectory="PreserveNewest" /> | 19 | <Content Include="tools\wix.signing.targets" CopyToOutputDirectory="PreserveNewest" /> |
| 20 | <Content Include="tools\wix.props" CopyToOutputDirectory="PreserveNewest" /> | ||
| 19 | <Content Include="tools\wix.targets" CopyToOutputDirectory="PreserveNewest" /> | 21 | <Content Include="tools\wix.targets" CopyToOutputDirectory="PreserveNewest" /> |
| 20 | <Content Include="Sdk\Sdk.props" CopyToOutputDirectory="PreserveNewest" /> | 22 | <Content Include="Sdk\Sdk.props" CopyToOutputDirectory="PreserveNewest" /> |
| 21 | <Content Include="Sdk\Sdk.targets" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="Sdk\Sdk.targets" CopyToOutputDirectory="PreserveNewest" /> |
diff --git a/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props b/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props index b453361b..e70d4024 100644 --- a/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props +++ b/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.props | |||
| @@ -1,8 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 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. --> | 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 | ||
| 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> | 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> | ||
| 7 | </PropertyGroup> | 8 | </PropertyGroup> |
| 9 | |||
| 10 | <Import Project="$(WixPropsPath)" Condition=" '$(WixPropsPath)' != '' and Exists('$(WixPropsPath)')" /> | ||
| 8 | </Project> | 11 | </Project> |
diff --git a/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets b/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets new file mode 100644 index 00000000..ca722959 --- /dev/null +++ b/src/wix/WixToolset.Sdk/build/WixToolset.Sdk.targets | |||
| @@ -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> | ||
diff --git a/src/wix/WixToolset.Sdk/tools/wix.harvest.targets b/src/wix/WixToolset.Sdk/tools/wix.harvest.targets index f3ec760b..23e4a68e 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.harvest.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.harvest.targets | |||
| @@ -87,6 +87,10 @@ | |||
| 87 | ================================================================================================== | 87 | ================================================================================================== |
| 88 | --> | 88 | --> |
| 89 | <PropertyGroup> | 89 | <PropertyGroup> |
| 90 | <CoreCompileDependsOn> | ||
| 91 | $(CoreCompileDependsOn); | ||
| 92 | Harvest | ||
| 93 | </CoreCompileDependsOn> | ||
| 90 | <HarvestDependsOn> | 94 | <HarvestDependsOn> |
| 91 | ConvertReferences; | 95 | ConvertReferences; |
| 92 | ConvertBundleReferences; | 96 | ConvertBundleReferences; |
| @@ -136,10 +140,6 @@ | |||
| 136 | <HeatProject Include="@(_HeatProjectReference)" /> | 140 | <HeatProject Include="@(_HeatProjectReference)" /> |
| 137 | </ItemGroup> | 141 | </ItemGroup> |
| 138 | 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> | 143 | <ItemGroup> |
| 144 | <!-- Unconditionally generate Compile items so they are always linked in. --> | 144 | <!-- Unconditionally generate Compile items so they are always linked in. --> |
| 145 | <Compile Include="$(HarvestProjectsGeneratedFile)" /> | 145 | <Compile Include="$(HarvestProjectsGeneratedFile)" /> |
| @@ -168,10 +168,6 @@ | |||
| 168 | <HeatProject Include="@(_HeatProjectReference)" /> | 168 | <HeatProject Include="@(_HeatProjectReference)" /> |
| 169 | </ItemGroup> | 169 | </ItemGroup> |
| 170 | 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 | |||
| 175 | <ItemGroup> | 171 | <ItemGroup> |
| 176 | <!-- Unconditionally generate Compile items so they are always linked in. --> | 172 | <!-- Unconditionally generate Compile items so they are always linked in. --> |
| 177 | <Compile Include="$(HarvestProjectsGeneratedFile)" /> | 173 | <Compile Include="$(HarvestProjectsGeneratedFile)" /> |
| @@ -254,7 +250,7 @@ | |||
| 254 | </PropertyGroup> | 250 | </PropertyGroup> |
| 255 | <Target Name="HarvestProjects" | 251 | <Target Name="HarvestProjects" |
| 256 | DependsOnTargets="$(HarvestProjectsDependsOn)" | 252 | DependsOnTargets="$(HarvestProjectsDependsOn)" |
| 257 | Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(MSBuildAllProjects);$(ProjectPath)" | 253 | Inputs="@(_AllHeatProjects);%(_AllHeatProjects.Transforms);$(ProjectPath)" |
| 258 | Outputs="@(_AllHeatProjects -> '%(HeatOutput)')" | 254 | Outputs="@(_AllHeatProjects -> '%(HeatOutput)')" |
| 259 | Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') "> | 255 | Condition=" $(EnableProjectHarvesting) and ('@(HeatProject)' != '' or '@(HarvestProject)' != '') "> |
| 260 | 256 | ||
diff --git a/src/wix/WixToolset.Sdk/tools/wix.props b/src/wix/WixToolset.Sdk/tools/wix.props new file mode 100644 index 00000000..2d88bc10 --- /dev/null +++ b/src/wix/WixToolset.Sdk/tools/wix.props | |||
| @@ -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> | ||
diff --git a/src/wix/WixToolset.Sdk/tools/wix.signing.targets b/src/wix/WixToolset.Sdk/tools/wix.signing.targets index 7c25175f..5a4ea98d 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.signing.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.signing.targets | |||
| @@ -27,31 +27,31 @@ | |||
| 27 | ================================================================================================== | 27 | ================================================================================================== |
| 28 | --> | 28 | --> |
| 29 | <PropertyGroup> | 29 | <PropertyGroup> |
| 30 | <InternalSignDependsOn Condition=" '$(OutputType)' == 'Module' "> | 30 | <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Module' "> |
| 31 | GetMsmsToSign; | 31 | GetMsmsToSign; |
| 32 | InternalSignMsm; | 32 | InternalSignMsm; |
| 33 | </InternalSignDependsOn> | 33 | </_InternalSignDependsOn> |
| 34 | <InternalSignDependsOn Condition=" '$(OutputType)' == 'Package' "> | 34 | <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Package' "> |
| 35 | GetCabsToSign; | 35 | GetCabsToSign; |
| 36 | GetMsiToSign; | 36 | GetMsiToSign; |
| 37 | InternalSignCabs; | 37 | InternalSignCabs; |
| 38 | InscribeMsi; | 38 | InscribeMsi; |
| 39 | InternalSignMsi; | 39 | InternalSignMsi; |
| 40 | </InternalSignDependsOn> | 40 | </_InternalSignDependsOn> |
| 41 | <InternalSignDependsOn Condition=" '$(OutputType)' == 'Bundle' "> | 41 | <_InternalSignDependsOn Condition=" '$(OutputType)' == 'Bundle' "> |
| 42 | GetContainersToSign; | 42 | GetContainersToSign; |
| 43 | InternalSignContainers; | 43 | InternalSignContainers; |
| 44 | InscribeBundleEngine; | 44 | InscribeBundleEngine; |
| 45 | InternalSignBundleEngine; | 45 | InternalSignBundleEngine; |
| 46 | InscribeBundle; | 46 | InscribeBundle; |
| 47 | InternalSignBundle; | 47 | InternalSignBundle; |
| 48 | </InternalSignDependsOn> | 48 | </_InternalSignDependsOn> |
| 49 | 49 | ||
| 50 | <SigningDependsOn> | 50 | <SigningDependsOn> |
| 51 | WixBuild; | 51 | CoreCompile; |
| 52 | CalculateSignTargetFiles; | 52 | CalculateSignTargetFiles; |
| 53 | BeforeSigning; | 53 | BeforeSigning; |
| 54 | $(InternalSignDependsOn); | 54 | $(_InternalSignDependsOn); |
| 55 | AfterSigning | 55 | AfterSigning |
| 56 | </SigningDependsOn> | 56 | </SigningDependsOn> |
| 57 | </PropertyGroup> | 57 | </PropertyGroup> |
diff --git a/src/wix/WixToolset.Sdk/tools/wix.targets b/src/wix/WixToolset.Sdk/tools/wix.targets index 6b15769a..7497a9f8 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.targets | |||
| @@ -1,17 +1,19 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 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. --> | 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 | ||
| 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> | 5 | <PropertyGroup> |
| 6 | <WixTargetsImported>true</WixTargetsImported> | 6 | <WixTargetsImported>true</WixTargetsImported> |
| 7 | </PropertyGroup> | 7 | </PropertyGroup> |
| 8 | 8 | ||
| 9 | <Import Project="wix.props" Condition=" '$(WixPropsImported)' != 'true' " /> | ||
| 10 | |||
| 9 | <!-- | 11 | <!-- |
| 10 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 12 | *********************************************************************************************** |
| 11 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 13 | *********************************************************************************************** |
| 12 | Extension Points | 14 | Extension Points |
| 13 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 15 | *********************************************************************************************** |
| 14 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 16 | *********************************************************************************************** |
| 15 | --> | 17 | --> |
| 16 | 18 | ||
| 17 | <!-- Allow a user-customized targets files to be used as part of the build. --> | 19 | <!-- Allow a user-customized targets files to be used as part of the build. --> |
| @@ -31,21 +33,17 @@ | |||
| 31 | <WixSigningTargetsPath Condition=" '$(WixSigningTargetsPath)' == '' ">$(MSBuildThisFileDirectory)wix.signing.targets</WixSigningTargetsPath> | 33 | <WixSigningTargetsPath Condition=" '$(WixSigningTargetsPath)' == '' ">$(MSBuildThisFileDirectory)wix.signing.targets</WixSigningTargetsPath> |
| 32 | </PropertyGroup> | 34 | </PropertyGroup> |
| 33 | 35 | ||
| 34 | <!-- This makes the project files a dependency of all targets so that things rebuild if they change --> | 36 | <ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' "> |
| 35 | <PropertyGroup> | 37 | <Compile Include="**/*.wxs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultCompileItems)' == 'true' " /> |
| 36 | <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | 38 | <EmbeddedResource Include="**/*.wxl" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " /> |
| 37 | <MSBuildAllProjects Condition="Exists('$(WixHarvestTargetsPath)')">$(MSBuildAllProjects);$(WixHarvestTargetsPath)</MSBuildAllProjects> | 39 | </ItemGroup> |
| 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> | ||
| 42 | 40 | ||
| 43 | <!-- | 41 | <!-- |
| 44 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 42 | *********************************************************************************************** |
| 45 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 43 | *********************************************************************************************** |
| 46 | Declarations for Microsoft.Common.targets | 44 | Declarations for Microsoft.Common.targets |
| 47 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 45 | *********************************************************************************************** |
| 48 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 46 | *********************************************************************************************** |
| 49 | --> | 47 | --> |
| 50 | 48 | ||
| 51 | <PropertyGroup> | 49 | <PropertyGroup> |
| @@ -59,11 +57,16 @@ | |||
| 59 | 57 | ||
| 60 | <!-- Default OutputType to a known WiX Toolset type. --> | 58 | <!-- Default OutputType to a known WiX Toolset type. --> |
| 61 | <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType> | 59 | <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType> |
| 60 | <AvailablePlatforms>x86,x64,ARM,ARM64,AnyCPU</AvailablePlatforms> | ||
| 62 | 61 | ||
| 63 | <!-- Default WixPdbType to a known WiX Toolset type. --> | 62 | <!-- Default WixPdbType to a known WiX Toolset type. --> |
| 64 | <WixPdbType Condition=" '$(WixPdbType)' == '' ">full</WixPdbType> | 63 | <WixPdbType Condition=" '$(WixPdbType)' == '' ">full</WixPdbType> |
| 65 | </PropertyGroup> | 64 | </PropertyGroup> |
| 66 | 65 | ||
| 66 | <PropertyGroup> | ||
| 67 | <_VCLibCurrentVersion>14.0</_VCLibCurrentVersion> | ||
| 68 | </PropertyGroup> | ||
| 69 | |||
| 67 | <!-- | 70 | <!-- |
| 68 | IDE Macros available from both integrated builds and from command line builds. | 71 | IDE Macros available from both integrated builds and from command line builds. |
| 69 | The following properties are 'macros' that are available via IDE for pre and post build steps. | 72 | The following properties are 'macros' that are available via IDE for pre and post build steps. |
| @@ -78,8 +81,34 @@ | |||
| 78 | <TargetExt Condition=" '$(OutputType)' == 'IntermediatePostLink' ">.wixipl</TargetExt> | 81 | <TargetExt Condition=" '$(OutputType)' == 'IntermediatePostLink' ">.wixipl</TargetExt> |
| 79 | </PropertyGroup> | 82 | </PropertyGroup> |
| 80 | 83 | ||
| 84 | <!-- | ||
| 85 | <PropertyGroup> | ||
| 86 | <DefaultContentType Condition="$(DefaultContentType) == ''">Default</DefaultContentType> | ||
| 87 | </PropertyGroup> | ||
| 88 | --> | ||
| 89 | |||
| 81 | <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" /> | 90 | <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" /> |
| 82 | 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 | |||
| 83 | <PropertyGroup> | 112 | <PropertyGroup> |
| 84 | <!-- Default pdb output path to the intermediate output directory --> | 113 | <!-- Default pdb output path to the intermediate output directory --> |
| 85 | <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(TargetDir)</PdbOutputDir> | 114 | <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(TargetDir)</PdbOutputDir> |
| @@ -96,11 +125,11 @@ | |||
| 96 | </PropertyGroup> | 125 | </PropertyGroup> |
| 97 | 126 | ||
| 98 | <!-- | 127 | <!-- |
| 99 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 128 | *********************************************************************************************** |
| 100 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 129 | *********************************************************************************************** |
| 101 | Property Declarations | 130 | Property Declarations |
| 102 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 131 | *********************************************************************************************** |
| 103 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 132 | *********************************************************************************************** |
| 104 | --> | 133 | --> |
| 105 | 134 | ||
| 106 | <!-- These tasks can be used as general-purpose build tasks. --> | 135 | <!-- These tasks can be used as general-purpose build tasks. --> |
| @@ -113,9 +142,13 @@ | |||
| 113 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 142 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
| 114 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 143 | <UsingTask TaskName="CreateItemAvoidingInference" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> |
| 115 | 144 | ||
| 116 | <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | 145 | <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> |
| 117 | <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 146 | <UsingTask TaskName="UpdateProjectReferenceMetadata" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
| 118 | <UsingTask TaskName="CreateProjectReferenceDefineConstants" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 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" /> | ||
| 119 | 152 | ||
| 120 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> | 153 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' == '' " AssemblyFile="$(WixTasksPath)" /> |
| 121 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 154 | <UsingTask TaskName="WixAssignCulture" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
| @@ -125,10 +158,6 @@ | |||
| 125 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> | 158 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath)" Architecture="x86" /> |
| 126 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> | 159 | <UsingTask TaskName="ResolveWixReferences" Condition=" '$(WixTasksPath64)' != '' " AssemblyFile="$(WixTasksPath64)" Architecture="x64" /> |
| 127 | 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 | |||
| 132 | <PropertyGroup> | 161 | <PropertyGroup> |
| 133 | <BindContentsFile Condition=" '$(BindContentsFile)' == '' ">$(MSBuildProjectFile).BindContentsFileList.txt</BindContentsFile> | 162 | <BindContentsFile Condition=" '$(BindContentsFile)' == '' ">$(MSBuildProjectFile).BindContentsFileList.txt</BindContentsFile> |
| 134 | <BindOutputsFile Condition=" '$(BindOutputsFile)' == '' ">$(MSBuildProjectFile).BindOutputsFileList.txt</BindOutputsFile> | 163 | <BindOutputsFile Condition=" '$(BindOutputsFile)' == '' ">$(MSBuildProjectFile).BindOutputsFileList.txt</BindOutputsFile> |
| @@ -144,11 +173,11 @@ | |||
| 144 | </PropertyGroup> | 173 | </PropertyGroup> |
| 145 | 174 | ||
| 146 | <!-- | 175 | <!-- |
| 147 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 176 | *********************************************************************************************** |
| 148 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 177 | *********************************************************************************************** |
| 149 | Default Compiler, Linker, and Librarian Property Declarations | 178 | Default Property Declarations |
| 150 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 179 | *********************************************************************************************** |
| 151 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 180 | *********************************************************************************************** |
| 152 | --> | 181 | --> |
| 153 | 182 | ||
| 154 | <!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup --> | 183 | <!-- If WixExtension was passed in via the command line, then convert it to an ItemGroup --> |
| @@ -208,231 +237,89 @@ | |||
| 208 | </ItemGroup> | 237 | </ItemGroup> |
| 209 | 238 | ||
| 210 | <!-- | 239 | <!-- |
| 211 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 240 | *********************************************************************************************** |
| 212 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 241 | *********************************************************************************************** |
| 213 | Initial Targets | 242 | Resolve References Section |
| 214 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 243 | *********************************************************************************************** |
| 215 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 244 | *********************************************************************************************** |
| 216 | --> | 245 | --> |
| 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 <Import> 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 "$(MSBuildProjectFile)". 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 "$(MSBuildProjectFile)". $(_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 "$(MSBuildProjectFile)". 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 | --> | ||
| 294 | 246 | ||
| 295 | <!-- | 247 | <!-- |
| 296 | ================================================================================================== | 248 | ================================================================================================ |
| 297 | ResolveReferences - OVERRIDE DependsOn | 249 | ResolveReferences - OVERRIDE DependsOn |
| 298 | 250 | ||
| 299 | ================================================================================================== | 251 | ================================================================================================ |
| 300 | --> | 252 | --> |
| 301 | <PropertyGroup> | 253 | <PropertyGroup> |
| 302 | <ResolveReferencesDependsOn> | 254 | <ResolveReferencesDependsOn> |
| 303 | BeforeResolveReferences; | 255 | BeforeResolveReferences; |
| 304 | AssignProjectConfiguration; | 256 | AssignProjectConfiguration; |
| 305 | ResolveProjectReferences; | 257 | ResolveProjectReferences; |
| 258 | FindInvalidProjectReferences; | ||
| 259 | ResolveNativeProjectReferences; | ||
| 260 | _ConvertResolvedProjectReferencesIntoWixConstructs; | ||
| 306 | ResolveWixLibraryReferences; | 261 | ResolveWixLibraryReferences; |
| 307 | ResolveWixExtensionReferences; | 262 | ResolveWixExtensionReferences; |
| 263 | _CreateProjectDefineConstants; | ||
| 308 | AfterResolveReferences | 264 | AfterResolveReferences |
| 309 | </ResolveReferencesDependsOn> | 265 | </ResolveReferencesDependsOn> |
| 310 | </PropertyGroup> | 266 | </PropertyGroup> |
| 311 | 267 | ||
| 312 | <!-- | 268 | <!-- |
| 313 | ================================================================================================ | 269 | ================================================================================================ |
| 314 | ResolveProjectReferences | 270 | _WixUpdateProjectReferenceMetadata |
| 315 | 271 | ||
| 316 | Builds all of the referenced projects to get their outputs. | 272 | Updates project references so they build correctly when referenced by .wixproj. |
| 317 | 273 | ||
| 318 | [IN] | 274 | [IN] |
| 319 | @(NonVCProjectReference) - The list of non-VC project references. | 275 | @(_MSBuildProjectReferenceExistent) - References to projects that exist. |
| 320 | 276 | ||
| 321 | [OUT] | 277 | [OUT] |
| 322 | @(ProjectReferenceWithConfiguration) - The list of non-VC project references. | 278 | @(_MSBuildProjectReferenceExistent) - Updated project references. |
| 323 | @(WixLibProjects) - Paths to any .wixlibs that were built by referenced projects. | 279 | ================================================================================================ |
| 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. | ||
| 374 | --> | 280 | --> |
| 375 | <CreateItem | 281 | <Target |
| 376 | Include="@(_GatheredProjectReferencePaths)" | 282 | Name="_WixUpdateProjectReferenceMetadata" |
| 377 | Condition=" '$(BuildProjectReferences)' == 'wixlib' and '%(Extension)' == '.wixlib' and '$(BuildingInsideVisualStudio)' != 'true' "> | 283 | AfterTargets="_SplitProjectReferencesByFileExistence" |
| 378 | 284 | Condition=" '@(_MSBuildProjectReferenceExistent)' != '' "> | |
| 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' "> | ||
| 390 | 285 | ||
| 391 | <Output TaskParameter="Include" ItemName="_ProjectReferencesToSkip" /> | 286 | <UpdateProjectReferenceMetadata |
| 392 | </CreateItem> | 287 | ProjectReferences="@(_MSBuildProjectReferenceExistent)" |
| 288 | IntermediateFolder="$(IntermediateOutputPath)"> | ||
| 289 | <Output TaskParameter="UpdatedProjectReferences" ItemName="_WixPublishProjectReferences" /> | ||
| 290 | </UpdateProjectReferenceMetadata> | ||
| 393 | 291 | ||
| 394 | <!-- | 292 | <ItemGroup> |
| 395 | Finally, when building only 'wixlib' project references, the list of projects to build are naturally the | 293 | <_MSBuildProjectReferenceExistent Remove='@(_WixPublishProjectReferences)' /> |
| 396 | list of projects *not* being skipped. | 294 | <_MSBuildProjectReferenceExistent Include='@(_WixPublishProjectReferences)' /> |
| 397 | --> | 295 | </ItemGroup> |
| 398 | <CreateItem | ||
| 399 | Include="@(_MSBuildProjectReferenceExistent->'%(FullPath)')" | ||
| 400 | Exclude="@(_ProjectReferencesToSkip)" | ||
| 401 | Condition=" '$(BuildProjectReferences)' == 'wixlib' and '$(BuildingInsideVisualStudio)' != 'true' "> | ||
| 402 | 296 | ||
| 403 | <Output TaskParameter="Include" ItemName="_ProjectReferencesToBuild" /> | 297 | <ItemGroup> |
| 404 | </CreateItem> | 298 | <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.SetTargetFramework)' == ''"> |
| 299 | <SkipGetTargetFrameworkProperties Condition="'$(EnableDynamicPlatformResolution)' != 'true'">true</SkipGetTargetFrameworkProperties> | ||
| 300 | <UndefineProperties>%(_MSBuildProjectReferenceExistent.UndefineProperties);TargetFramework</UndefineProperties> | ||
| 301 | </_MSBuildProjectReferenceExistent> | ||
| 302 | </ItemGroup> | ||
| 303 | </Target> | ||
| 405 | 304 | ||
| 406 | <!-- Display a warning for all projects being skipped. --> | 305 | <!-- |
| 407 | <Warning | 306 | ================================================================================================ |
| 408 | Text="BuildProjectReferences set to '$(BuildProjectReferences)'. Skipping the non-Library project: %(_ProjectReferencesToSkip.Identity)" | 307 | ResolveNativeProjectReferences |
| 409 | Condition=" '@(_ProjectReferencesToSkip)' != '' " /> | ||
| 410 | 308 | ||
| 411 | <Message | 309 | VC project references must build GetNativeTargetPath because neither GetTargetPath nor |
| 412 | Importance="low" | 310 | the return of the default build target return the output for a native .vcxproj. |
| 413 | Text="Project reference to build: %(_ProjectReferencesToBuild.Identity), properties: %(_ProjectReferencesToBuild.Properties)" | ||
| 414 | Condition=" '@(_ProjectReferencesToBuild)' != '' " /> | ||
| 415 | 311 | ||
| 416 | <!-- | 312 | [IN] |
| 417 | Build referenced projects when building from the command line. | 313 | @(_MSBuildProjectReferenceExistent) - References to projects that exist. |
| 418 | 314 | ||
| 419 | The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default target | 315 | [OUT] |
| 420 | is used during a P2P reference. However if a custom build process requires that the referenced | 316 | @(_ResolvedProjectReferencePaths) - Target paths from .vcxproj outputs added. |
| 421 | project has a different target to build it can be specified. | 317 | ================================================================================================ |
| 422 | --> | 318 | --> |
| 423 | <MSBuild | 319 | <Target |
| 424 | Projects="@(_ProjectReferencesToBuild)" | 320 | Name="ResolveNativeProjectReferences" |
| 425 | Targets="$(ProjectReferenceBuildTargets)" | 321 | Condition=" '@(_MSBuildProjectReferenceExistent)' != '' "> |
| 426 | Properties="%(_ProjectReferencesToBuild.SetConfiguration);%(_ProjectReferencesToBuild.SetPlatform)" | ||
| 427 | Condition=" '@(_ProjectReferencesToBuild)' != '' "> | ||
| 428 | |||
| 429 | <Output TaskParameter="TargetOutputs" ItemName="_BuiltProjectReferencePaths" /> | ||
| 430 | </MSBuild> | ||
| 431 | 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 | --> | ||
| 436 | <MSBuild | 323 | <MSBuild |
| 437 | Projects="@(_MSBuildProjectReferenceExistent)" | 324 | Projects="@(_MSBuildProjectReferenceExistent)" |
| 438 | Targets="GetNativeTargetPath" | 325 | Targets="GetNativeTargetPath" |
| @@ -440,98 +327,141 @@ | |||
| 440 | Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' "> | 327 | Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' "> |
| 441 | 328 | ||
| 442 | <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" /> | 329 | <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" /> |
| 443 | <Output TaskParameter="TargetOutputs" ItemName="_MSBuildResolvedProjectReferencePaths" /> | ||
| 444 | </MSBuild> | 330 | </MSBuild> |
| 331 | </Target> | ||
| 445 | 332 | ||
| 446 | <!-- Assign the unique gathered and built project references to the resolved project | 333 | <!-- |
| 447 | reference paths. --> | 334 | ================================================================================================ |
| 448 | <RemoveDuplicates Inputs="@(_GatheredProjectReferencePaths);@(_BuiltProjectReferencePaths)"> | 335 | _ConvertResolvedProjectReferencesIntoWixConstructs |
| 449 | <Output TaskParameter="Filtered" ItemName="_ResolvedProjectReferencePaths" /> | ||
| 450 | <Output TaskParameter="Filtered" ItemName="_MSBuildResolvedProjectReferencePaths" /> | ||
| 451 | </RemoveDuplicates> | ||
| 452 | 336 | ||
| 453 | <!-- Create list of all .wixlib project references. --> | 337 | Converts _ResolvedProjectReferencePaths (which are the outputs of the ProjectReferences that |
| 454 | <CreateItem | 338 | normally would be passed through ResolveAssemblyReferences then be passed to the C# compiler |
| 455 | Include="@(_ResolvedProjectReferencePaths)" | 339 | as references) into the appropriate WiX constructs. For example, references to .wixlibs are |
| 456 | Condition=" '%(Extension)' == '.wixlib' "> | 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> | ||
| 457 | 368 | ||
| 458 | <Output TaskParameter="Include" ItemName="WixLibProjects" /> | 369 | <ItemGroup> |
| 459 | </CreateItem> | 370 | <WixLibrary Include="@(_ResolvedProjectReferencePaths)" Condition=" '%(Extension)' == '.wixlib' " /> |
| 371 | <_ResolvedProjectReferencePaths Remove="@(WixLibrary)" /> | ||
| 372 | </ItemGroup> | ||
| 460 | 373 | ||
| 461 | <Message | 374 | <!-- Convert resolved project references into compiler defines and named and unamed bind paths--> |
| 462 | Importance="low" | 375 | <CreateProjectReferenceDefineConstantsAndBindPaths |
| 463 | Text="Library from referenced projects: %(WixLibProjects.Identity)" | 376 | ResolvedProjectReferences="@(_ResolvedProjectReferencePaths)" |
| 464 | Condition=" '@(WixLibProjects)' != '' " /> | 377 | ProjectConfigurations="$(VSProjectConfigurations)"> |
| 378 | <Output TaskParameter="BindPaths" ItemName="LinkerBindInputPaths" /> | ||
| 379 | <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" /> | ||
| 380 | </CreateProjectReferenceDefineConstantsAndBindPaths> | ||
| 465 | 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> | ||
| 466 | </Target> | 389 | </Target> |
| 467 | 390 | ||
| 468 | <!-- | 391 | <!-- |
| 469 | ================================================================================================ | 392 | ================================================================================================ |
| 470 | ResolveWixLibraryReferences | 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. | ||
| 471 | 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. | ||
| 473 | 404 | ||
| 474 | [IN] | 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. | ||
| 476 | 409 | ||
| 477 | [OUT] | 410 | [OUT] |
| 478 | @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries | 411 | @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries |
| 479 | ================================================================================================ | 412 | ================================================================================================ |
| 480 | --> | 413 | --> |
| 481 | <PropertyGroup> | 414 | <PropertyGroup> |
| 482 | <ResolveWixLibraryReferencesDependsOn></ResolveWixLibraryReferencesDependsOn> | 415 | <ResolveWixLibraryReferencesDependsOn></ResolveWixLibraryReferencesDependsOn> |
| 483 | </PropertyGroup> | 416 | </PropertyGroup> |
| 484 | <Target | 417 | <Target |
| 485 | Name="ResolveWixLibraryReferences" | 418 | Name="ResolveWixLibraryReferences" |
| 486 | DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)" | 419 | DependsOnTargets="$(ResolveWixLibraryReferencesDependsOn)"> |
| 487 | Condition=" '@(WixLibrary)' != ''"> | ||
| 488 | 420 | ||
| 489 | <!-- | 421 | <PropertyGroup> |
| 490 | The WixLibrarySearchPaths property is set to find assemblies in the following order: | 422 | <WixLibrarySearchPaths Condition=" '$(WixLibrarySearchPaths)' == '' "> |
| 491 | 423 | $(ReferencePaths); | |
| 492 | (1) $(ReferencePaths) - the reference paths property, which comes from the .USER file. | 424 | {HintPathFromItem}; |
| 493 | (2) The hintpath from the referenced item itself, indicated by {HintPathFromItem}. | 425 | {RawFileName}; |
| 494 | (3) Treat the reference's Include as if it were a real file name. | 426 | $(WixExtDir) |
| 495 | (4) Path specified by the WixExtDir property. | 427 | </WixLibrarySearchPaths> |
| 496 | --> | 428 | </PropertyGroup> |
| 497 | <CreateProperty Condition=" '$(WixLibrarySearchPaths)' == '' " Value=" | ||
| 498 | $(ReferencePaths); | ||
| 499 | {HintPathFromItem}; | ||
| 500 | {RawFileName}; | ||
| 501 | $(WixExtDir) | ||
| 502 | "> | ||
| 503 | <Output TaskParameter="Value" PropertyName="WixLibrarySearchPaths" /> | ||
| 504 | </CreateProperty> | ||
| 505 | 429 | ||
| 506 | <ResolveWixReferences | 430 | <ResolveWixReferences |
| 507 | WixReferences="@(WixLibrary)" | 431 | WixReferences="@(WixLibrary)" |
| 508 | SearchPaths="$(WixLibrarySearchPaths)" | 432 | SearchPaths="$(WixLibrarySearchPaths)" |
| 509 | SearchFilenameExtensions=".wixlib"> | 433 | SearchFilenameExtensions=".wixlib" |
| 434 | Condition=" '@(WixLibrary)' != ''"> | ||
| 510 | <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixLibraryPaths" /> | 435 | <Output TaskParameter="ResolvedWixReferences" ItemName="_AllResolvedWixLibraryPaths" /> |
| 511 | </ResolveWixReferences> | 436 | </ResolveWixReferences> |
| 512 | 437 | ||
| 513 | <!-- Remove duplicate library items that would cause build errors --> | ||
| 514 | <RemoveDuplicates Inputs="@(_AllResolvedWixLibraryPaths)"> | 438 | <RemoveDuplicates Inputs="@(_AllResolvedWixLibraryPaths)"> |
| 515 | <Output TaskParameter="Filtered" ItemName="_ResolvedWixLibraryPaths" /> | 439 | <Output TaskParameter="Filtered" ItemName="_ResolvedWixLibraryPaths" /> |
| 516 | </RemoveDuplicates> | 440 | </RemoveDuplicates> |
| 517 | |||
| 518 | </Target> | 441 | </Target> |
| 519 | 442 | ||
| 520 | <!-- | 443 | <!-- |
| 521 | ================================================================================================== | 444 | ================================================================================================ |
| 522 | ResolveWixExtensionReferences | 445 | ResolveWixExtensionReferences |
| 523 | 446 | ||
| 524 | Resolves WiX extension references to full paths. Any properties you use | 447 | Resolves WiX extension references to full paths. Any properties you use |
| 525 | to resolve paths to extensions must be defined before importing this | 448 | to resolve paths to extensions must be defined before importing this |
| 526 | file or the extensions will be automatically resolved to $(WixExtDir). | 449 | file or the extensions will be automatically resolved to $(WixExtDir). |
| 527 | 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 | |||
| 528 | [IN] | 458 | [IN] |
| 529 | @(WixExtension) - WixExtension item group | 459 | @(WixExtension) - WixExtension item group |
| 530 | 460 | ||
| 531 | [OUT] | 461 | [OUT] |
| 532 | @(_ResolvedWixExtensionPaths) - Item group with full paths to extensions | 462 | @(_ResolvedWixExtensionPaths) - Item group with full paths to extensions |
| 533 | ================================================================================================== | 463 | ================================================================================================ |
| 534 | --> | 464 | --> |
| 535 | <PropertyGroup> | 465 | <PropertyGroup> |
| 536 | <ResolveWixExtensionReferencesDependsOn></ResolveWixExtensionReferencesDependsOn> | 466 | <ResolveWixExtensionReferencesDependsOn></ResolveWixExtensionReferencesDependsOn> |
| 537 | </PropertyGroup> | 467 | </PropertyGroup> |
| @@ -540,14 +470,6 @@ | |||
| 540 | DependsOnTargets="$(ResolveWixExtensionReferencesDependsOn)" | 470 | DependsOnTargets="$(ResolveWixExtensionReferencesDependsOn)" |
| 541 | Condition=" '@(WixExtension)' != ''"> | 471 | Condition=" '@(WixExtension)' != ''"> |
| 542 | 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 | --> | ||
| 551 | <CreateProperty Condition=" '$(WixExtensionSearchPaths)' == '' " Value=" | 473 | <CreateProperty Condition=" '$(WixExtensionSearchPaths)' == '' " Value=" |
| 552 | $(ReferencePaths); | 474 | $(ReferencePaths); |
| 553 | {HintPathFromItem}; | 475 | {HintPathFromItem}; |
| @@ -571,81 +493,146 @@ | |||
| 571 | </Target> | 493 | </Target> |
| 572 | 494 | ||
| 573 | <!-- | 495 | <!-- |
| 574 | ================================================================================================ | 496 | *********************************************************************************************** |
| 575 | GetTargetPath - OVERRIDE DependsOn | 497 | *********************************************************************************************** |
| 498 | PrepareResources Section | ||
| 499 | *********************************************************************************************** | ||
| 500 | *********************************************************************************************** | ||
| 501 | --> | ||
| 576 | 502 | ||
| 577 | This stand-alone target returns the name of the build product (i.e. MSI, MSM) that would be | 503 | <!-- |
| 578 | produced if we built this project. | 504 | ================================================================================================ |
| 579 | ================================================================================================ | 505 | AssignTargetPaths - OVERRIDE Target |
| 580 | --> | ||
| 581 | <PropertyGroup> | ||
| 582 | <GetTargetPathDependsOn>AssignTargetPaths</GetTargetPathDependsOn> | ||
| 583 | </PropertyGroup> | ||
| 584 | 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> | ||
| 585 | 557 | ||
| 586 | <!-- | 558 | <!-- |
| 587 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 559 | ================================================================================================ |
| 588 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 560 | CreateManifestResourceNames |
| 589 | WixBuild Targets | 561 | |
| 590 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 562 | Converts the EmbeddedResource into _WixLocalizationFile to disable satellite assembly |
| 591 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 563 | generation in common targets. |
| 592 | --> | 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> | ||
| 593 | 578 | ||
| 594 | <!-- | 579 | <!-- |
| 595 | ================================================================================================== | 580 | ================================================================================================ |
| 596 | WixBuild | 581 | GetTargetPath - OVERRIDE DependsOn |
| 597 | ================================================================================================== | 582 | |
| 598 | --> | 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 | --> | ||
| 599 | <PropertyGroup> | 587 | <PropertyGroup> |
| 600 | <WixBuildDependsOn> | 588 | <GetTargetPathDependsOn>$(GetTargetPathDependsOn);AssignTargetPaths</GetTargetPathDependsOn> |
| 601 | ResolveReferences; | 589 | </PropertyGroup> |
| 602 | BeforeCompile; | ||
| 603 | _TimeStampBeforeCompile; | ||
| 604 | 590 | ||
| 605 | CalculateDefineConstants; | 591 | <!-- |
| 606 | Harvest; | 592 | *********************************************************************************************** |
| 593 | *********************************************************************************************** | ||
| 594 | Compile Section | ||
| 595 | *********************************************************************************************** | ||
| 596 | *********************************************************************************************** | ||
| 597 | --> | ||
| 607 | 598 | ||
| 608 | GenerateCompileWithObjectPath; | 599 | <!-- |
| 600 | ================================================================================================ | ||
| 601 | CoreCompile | ||
| 609 | 602 | ||
| 603 | ================================================================================================ | ||
| 604 | --> | ||
| 605 | <PropertyGroup> | ||
| 606 | <CoreCompileDependsOn> | ||
| 610 | AssignTargetPaths; | 607 | AssignTargetPaths; |
| 611 | ReadPreviousBindInputsAndBuiltOutputs; | 608 | ReadPreviousBindInputsAndBuiltOutputs; |
| 612 | 609 | _CreateProjectDefineConstants; | |
| 613 | CoreWixBuild; | 610 | $(CoreCompileDependsOn) |
| 614 | 611 | </CoreCompileDependsOn> | |
| 615 | UpdateLinkFileWrites; | ||
| 616 | _TimeStampAfterCompile; | ||
| 617 | AfterCompile | ||
| 618 | </WixBuildDependsOn> | ||
| 619 | </PropertyGroup> | 612 | </PropertyGroup> |
| 620 | <Target | 613 | <Target |
| 621 | Name="WixBuild" | 614 | Name="CoreCompile" |
| 622 | DependsOnTargets="$(WixBuildDependsOn)" /> | ||
| 623 | |||
| 624 | <Target | ||
| 625 | Name="CoreWixBuild" | ||
| 626 | Inputs="@(Compile); | 615 | Inputs="@(Compile); |
| 627 | @(Content); | 616 | @(Content); |
| 628 | @(EmbeddedResource); | 617 | @(_WixLocalizationFile); |
| 629 | @(WixObject); | 618 | @(WixObject); |
| 630 | @(_ResolvedProjectReferencePaths); | 619 | @(_WixReferencedProjectOutputs); |
| 631 | @(_ResolvedWixLibraryPaths); | 620 | @(_ResolvedWixLibraryPaths); |
| 632 | @(_ResolvedWixExtensionPaths); | 621 | @(_ResolvedWixExtensionPaths); |
| 633 | @(_BindInputs); | 622 | @(_BindInputs)" |
| 634 | $(MSBuildAllProjects)" | ||
| 635 | Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)" | 623 | Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)" |
| 624 | DependsOnTargets="$(CoreCompileDependsOn)" | ||
| 636 | Condition=" '@(Compile)' != '' "> | 625 | Condition=" '@(Compile)' != '' "> |
| 637 | 626 | ||
| 638 | <PropertyGroup> | 627 | <PropertyGroup> |
| 639 | <!--<OutputFile>$([System.IO.Path]::GetFullPath($(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)))</OutputFile>--> | ||
| 640 | <OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(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>--> | ||
| 642 | <PdbOutputFile>$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName)</PdbOutputFile> | 629 | <PdbOutputFile>$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName)</PdbOutputFile> |
| 643 | </PropertyGroup> | 630 | </PropertyGroup> |
| 644 | 631 | ||
| 645 | <WixBuild | 632 | <WixBuild |
| 646 | SourceFiles="@(_CompileWithObjectPath)" | 633 | SourceFiles="@(Compile)" |
| 647 | LibraryFiles="@(WixLibProjects);@(_ResolvedWixLibraryPaths)" | 634 | LibraryFiles="@(WixLibProjects);@(_ResolvedWixLibraryPaths)" |
| 648 | LocalizationFiles="@(EmbeddedResource)" | 635 | LocalizationFiles="@(_WixLocalizationFile)" |
| 649 | 636 | ||
| 650 | Cultures="%(CultureGroup.Identity)" | 637 | Cultures="%(CultureGroup.Identity)" |
| 651 | 638 | ||
| @@ -699,28 +686,19 @@ | |||
| 699 | --> | 686 | --> |
| 700 | </Target> | 687 | </Target> |
| 701 | 688 | ||
| 702 | |||
| 703 | <!-- | 689 | <!-- |
| 704 | ================================================================================================== | 690 | ================================================================================================ |
| 705 | CalculateDefineConstants | 691 | _CreateProjectDefineConstants |
| 706 | |||
| 707 | Adds project references to the constants passed into the compiler. | ||
| 708 | 692 | ||
| 709 | [IN] | 693 | Adds properties as define constants passed into the compiler. |
| 710 | @(_ResolvedProjectReferencePaths) - paths to projects' outputs | 694 | ================================================================================================ |
| 711 | $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE | 695 | --> |
| 712 | |||
| 713 | [OUT] | ||
| 714 | $(ProjectReferenceDefineConstants) - the list of referenced project variables to be passed into the compiler | ||
| 715 | ================================================================================================== | ||
| 716 | --> | ||
| 717 | <PropertyGroup> | 696 | <PropertyGroup> |
| 718 | <CalculateDefineConstantsDependsOn>ResolveReferences</CalculateDefineConstantsDependsOn> | 697 | <_CreateProjectDefineConstantsDependsOn></_CreateProjectDefineConstantsDependsOn> |
| 719 | </PropertyGroup> | 698 | </PropertyGroup> |
| 720 | <Target | 699 | <Target |
| 721 | Name="CalculateDefineConstants" | 700 | Name="_CreateProjectDefineConstants" |
| 722 | DependsOnTargets="$(CalculateDefineConstantsDependsOn)" | 701 | DependsOnTargets="$(_CreateProjectDefineConstantsDependsOn)"> |
| 723 | Condition=" '@(_ResolvedProjectReferencePaths)' != '' "> | ||
| 724 | 702 | ||
| 725 | <PropertyGroup> | 703 | <PropertyGroup> |
| 726 | <ProjectDefineConstants> | 704 | <ProjectDefineConstants> |
| @@ -748,100 +726,11 @@ | |||
| 748 | <SolutionDefineConstants Condition=" '$(SolutionName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionName=$(SolutionName)</SolutionDefineConstants> | 726 | <SolutionDefineConstants Condition=" '$(SolutionName)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionName=$(SolutionName)</SolutionDefineConstants> |
| 749 | <SolutionDefineConstants Condition=" '$(SolutionPath)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionPath=$(SolutionPath)</SolutionDefineConstants> | 727 | <SolutionDefineConstants Condition=" '$(SolutionPath)'!='*Undefined*' ">$(SolutionDefineConstants);SolutionPath=$(SolutionPath)</SolutionDefineConstants> |
| 750 | </PropertyGroup> | 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> | ||
| 840 | </Target> | 729 | </Target> |
| 841 | 730 | ||
| 842 | <!-- | 731 | <!-- |
| 843 | ================================================================================================ | 732 | ================================================================================================ |
| 844 | ReadPreviousBindInputsAndBuiltOutputs | 733 | ReadPreviousBindInputsAndBuiltOutputs |
| 845 | 734 | ||
| 846 | Reads a previous build's Bind contents and built outputs file into @(_BindInputs) and | 735 | Reads a previous build's Bind contents and built outputs file into @(_BindInputs) and |
| 847 | @(_BindBuiltOutputs) respectively. | 736 | @(_BindBuiltOutputs) respectively. |
| @@ -860,8 +749,8 @@ | |||
| 860 | @(_BindInputs) - the content files required to bind (i.e. the Binary/@SourceFile and File/@Source files). | 749 | @(_BindInputs) - the content files required to bind (i.e. the Binary/@SourceFile and File/@Source files). |
| 861 | @(_BindBuiltOutputs) - the previously built .msi, .msm, .pcp, .exe .wixpdb, .cabs, etc. | 750 | @(_BindBuiltOutputs) - the previously built .msi, .msm, .pcp, .exe .wixpdb, .cabs, etc. |
| 862 | Does not include content copied to output folder. | 751 | Does not include content copied to output folder. |
| 863 | ================================================================================================ | 752 | ================================================================================================ |
| 864 | --> | 753 | --> |
| 865 | <Target | 754 | <Target |
| 866 | Name="ReadPreviousBindInputsAndBuiltOutputs"> | 755 | Name="ReadPreviousBindInputsAndBuiltOutputs"> |
| 867 | 756 | ||
| @@ -878,26 +767,27 @@ | |||
| 878 | </Target> | 767 | </Target> |
| 879 | 768 | ||
| 880 | <!-- | 769 | <!-- |
| 881 | ================================================================================================ | 770 | ================================================================================================ |
| 882 | UpdateLinkFileWrites | 771 | UpdateFileWritesWithBindInformation |
| 883 | 772 | ||
| 884 | Reads the bind outputs file(s) output generated during WixBuild to correctly set the @(FileWrites) | 773 | Reads the bind outputs file(s) output generated during WixBuild to correctly set the @(FileWrites) |
| 885 | item. Most targets have it easy because they can do a static mapping from inputs to the outputs. | 774 | item. Most targets have it easy because they can do a static mapping from inputs to the outputs. |
| 886 | However, the WixBuild target outputs are determined after a rather complex calculation we call | 775 | However, the WixBuild target outputs are determined after a rather complex calculation we call |
| 887 | linking and binding! | 776 | linking and binding! |
| 888 | 777 | ||
| 889 | This target runs independently after Link to ensure that @(FileWrites) is updated even if the | 778 | This is an "after target" of CoreCompile to ensure it always runs, even if compiler was up to date. It |
| 890 | "WixBuild" task fails. | 779 | reads the outputs file generated during the CoreCompile target. |
| 891 | 780 | ||
| 892 | [IN] | 781 | [IN] |
| 893 | Path to bind outputs file(s). | 782 | Path to bind outputs file(s). |
| 894 | 783 | ||
| 895 | [OUT] | 784 | [OUT] |
| 896 | @(FileWrites) updated with outputs from bind. | 785 | @(FileWrites) updated with outputs from bind. |
| 897 | ================================================================================================ | 786 | ================================================================================================ |
| 898 | --> | 787 | --> |
| 899 | <Target | 788 | <Target |
| 900 | Name="UpdateLinkFileWrites"> | 789 | Name="UpdateFileWritesWithBindInformation" |
| 790 | AfterTargets="CoreCompile"> | ||
| 901 | 791 | ||
| 902 | <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"> | 792 | <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"> |
| 903 | <Output TaskParameter="Lines" ItemName="FileWrites"/> | 793 | <Output TaskParameter="Lines" ItemName="FileWrites"/> |
| @@ -913,19 +803,30 @@ | |||
| 913 | </Target> | 803 | </Target> |
| 914 | 804 | ||
| 915 | <!-- | 805 | <!-- |
| 916 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 806 | *********************************************************************************************** |
| 917 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 807 | *********************************************************************************************** |
| 918 | AllProjectOutputGroups Section | 808 | AllProjectOutputGroups Section |
| 919 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 809 | *********************************************************************************************** |
| 920 | ////////////////////////////////////////////////////////////////////////////////////////////////// | 810 | *********************************************************************************************** |
| 921 | --> | 811 | --> |
| 922 | 812 | ||
| 923 | <!-- | 813 | <!-- |
| 924 | ================================================================================================== | 814 | ================================================================================================ |
| 925 | AllProjectOutputGroups - OVERRIDE Target | 815 | AllProjectOutputGroups - OVERRIDE Target |
| 926 | 816 | ||
| 927 | ================================================================================================== | 817 | The targets below drive output groups, which provide generic information about a |
| 928 | --> | 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 | --> | ||
| 929 | <Target | 830 | <Target |
| 930 | Name="AllProjectOutputGroups" | 831 | Name="AllProjectOutputGroups" |
| 931 | DependsOnTargets=" | 832 | DependsOnTargets=" |
| @@ -935,9 +836,9 @@ | |||
| 935 | ContentFilesProjectOutputGroup" /> | 836 | ContentFilesProjectOutputGroup" /> |
| 936 | 837 | ||
| 937 | <!-- | 838 | <!-- |
| 938 | This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE. | 839 | 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. | 840 | Reading an item is faster than invoking a target. |
| 940 | --> | 841 | --> |
| 941 | <ItemGroup> | 842 | <ItemGroup> |
| 942 | <BuiltProjectOutputGroupKeyOutput Include="$(TargetPath)"> | 843 | <BuiltProjectOutputGroupKeyOutput Include="$(TargetPath)"> |
| 943 | <IsKeyOutput>true</IsKeyOutput> | 844 | <IsKeyOutput>true</IsKeyOutput> |
| @@ -947,10 +848,10 @@ | |||
| 947 | </ItemGroup> | 848 | </ItemGroup> |
| 948 | 849 | ||
| 949 | <!-- | 850 | <!-- |
| 950 | ================================================================================================== | 851 | ================================================================================================ |
| 951 | BuiltProjectOutputGroup - OVERRIDE Target | 852 | BuiltProjectOutputGroup - OVERRIDE Target |
| 952 | ================================================================================================== | 853 | ================================================================================================ |
| 953 | --> | 854 | --> |
| 954 | <PropertyGroup> | 855 | <PropertyGroup> |
| 955 | <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</BuiltProjectOutputGroupDependsOn> | 856 | <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</BuiltProjectOutputGroupDependsOn> |
| 956 | </PropertyGroup> | 857 | </PropertyGroup> |
| @@ -961,7 +862,7 @@ | |||
| 961 | 862 | ||
| 962 | <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below --> | 863 | <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below --> |
| 963 | 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. --> |
| 965 | <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"> | 866 | <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)"> |
| 966 | <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/> | 867 | <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/> |
| 967 | </ReadLinesFromFile> | 868 | </ReadLinesFromFile> |
| @@ -981,12 +882,12 @@ | |||
| 981 | </Target> | 882 | </Target> |
| 982 | 883 | ||
| 983 | <!-- | 884 | <!-- |
| 984 | ================================================================================================== | 885 | ================================================================================================ |
| 985 | DebugSymbolsProjectOutputGroup | 886 | DebugSymbolsProjectOutputGroup - OVERRIDE Target |
| 986 | 887 | ||
| 987 | Populates the Debug Symbols project output group. | 888 | Populates the Debug Symbols project output group. |
| 988 | ================================================================================================== | 889 | ================================================================================================ |
| 989 | --> | 890 | --> |
| 990 | <PropertyGroup> | 891 | <PropertyGroup> |
| 991 | <DebugSymbolsProjectOutputGroupDependsOn>AssignTargetPaths</DebugSymbolsProjectOutputGroupDependsOn> | 892 | <DebugSymbolsProjectOutputGroupDependsOn>AssignTargetPaths</DebugSymbolsProjectOutputGroupDependsOn> |
| 992 | </PropertyGroup> | 893 | </PropertyGroup> |
| @@ -1001,20 +902,29 @@ | |||
| 1001 | </ItemGroup> | 902 | </ItemGroup> |
| 1002 | </Target> | 903 | </Target> |
| 1003 | 904 | ||
| 905 | <!-- | ||
| 906 | *********************************************************************************************** | ||
| 907 | *********************************************************************************************** | ||
| 908 | PrepareForRun Section | ||
| 909 | *********************************************************************************************** | ||
| 910 | *********************************************************************************************** | ||
| 911 | --> | ||
| 1004 | 912 | ||
| 1005 | <!-- | 913 | <!-- |
| 1006 | ================================================================================================== | 914 | ================================================================================================ |
| 1007 | CopyFilesToOutputDirectory - OVERRIDE Target | 915 | CopyFilesToOutputDirectory - OVERRIDE Target |
| 1008 | 916 | ||
| 1009 | Copy all build outputs, satellites and other necessary files to the final directory. | 917 | Copy all build outputs, satellites and other necessary files to the final directory. |
| 1010 | ============================================================ | 918 | ================================================================================================ |
| 1011 | --> | 919 | --> |
| 1012 | <Target | 920 | <Target |
| 1013 | Name="CopyFilesToOutputDirectory"> | 921 | Name="CopyFilesToOutputDirectory"> |
| 1014 | 922 | ||
| 1015 | <PropertyGroup> | 923 | <PropertyGroup> |
| 1016 | <!-- By default we're using hard links to copy to the output directory, disabling this could slow the build significantly --> | 924 | <!-- By default we're using hard links to copy to the output directory, disabling this could slow the build significantly --> |
| 1017 | <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition=" '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == '' ">true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible> | 925 | <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition=" '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == '' ">true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible> |
| 926 | <CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)' == ''">false</CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible> | ||
| 927 | <ErrorIfLinkFailsForCopyFilesToOutputDirectory Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(ErrorIfLinkFailsForCopyFilesToOutputDirectory)' == ''">false</ErrorIfLinkFailsForCopyFilesToOutputDirectory> | ||
| 1018 | </PropertyGroup> | 928 | </PropertyGroup> |
| 1019 | 929 | ||
| 1020 | <PropertyGroup> | 930 | <PropertyGroup> |
| @@ -1041,16 +951,15 @@ | |||
| 1041 | Retries="$(CopyRetryCount)" | 951 | Retries="$(CopyRetryCount)" |
| 1042 | RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" | 952 | RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" |
| 1043 | UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)" | 953 | UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)" |
| 1044 | Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'" | 954 | UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)" |
| 1045 | > | 955 | ErrorIfLinkFails="$(ErrorIfLinkFailsForCopyFilesToOutputDirectory)" |
| 956 | Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"> | ||
| 1046 | 957 | ||
| 1047 | <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/> | 958 | <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/> |
| 1048 | <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> | 959 | <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
| 1049 | |||
| 1050 | </Copy> | 960 | </Copy> |
| 1051 | 961 | ||
| 1052 | <Message Importance="High" Text="$(MSBuildProjectName) -> $(TargetPath)" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" /> | 962 | <Message Importance="High" Text="$(MSBuildProjectName) -> $(TargetPath)" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" /> |
| 1053 | <!--<Message Importance="High" Text="$(MSBuildProjectName) -> @(MainAssembly->'%(FullPath)')" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />--> | ||
| 1054 | 963 | ||
| 1055 | <!-- Copy the debug information file (.pdb), if any | 964 | <!-- Copy the debug information file (.pdb), if any |
| 1056 | <Copy | 965 | <Copy |
| @@ -1069,11 +978,15 @@ | |||
| 1069 | --> | 978 | --> |
| 1070 | </Target> | 979 | </Target> |
| 1071 | 980 | ||
| 1072 | |||
| 1073 | <Import Project="$(WixHarvestTargetsPath)" Condition=" '$(WixHarvestTargetsPath)' != '' and Exists('$(WixHarvestTargetsPath)')" /> | 981 | <Import Project="$(WixHarvestTargetsPath)" Condition=" '$(WixHarvestTargetsPath)' != '' and Exists('$(WixHarvestTargetsPath)')" /> |
| 1074 | <Import Project="$(WixSigningTargetsPath)" Condition=" '$(WixSigningTargetsPath)' != '' and Exists('$(WixSigningTargetsPath)')" /> | 982 | <Import Project="$(WixSigningTargetsPath)" Condition=" '$(WixSigningTargetsPath)' != '' and Exists('$(WixSigningTargetsPath)')" /> |
| 1075 | 983 | ||
| 1076 | <!-- Extension point: Define CustomAfterWixTargets to a .targets file that you want to include after this file. --> | 984 | <!-- Extension point: Define CustomAfterWixTargets to a .targets file that you want to include after this file. --> |
| 1077 | <Import Project="$(CustomAfterWixTargets)" Condition=" '$(CustomAfterWixTargets)' != '' and Exists('$(CustomAfterWixTargets)')" /> | 985 | <Import Project="$(CustomAfterWixTargets)" Condition=" '$(CustomAfterWixTargets)' != '' and Exists('$(CustomAfterWixTargets)')" /> |
| 1078 | 986 | ||
| 987 | <PropertyGroup> | ||
| 988 | <DefaultItemExcludes Condition=" '$(BaseOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseOutputPath)**</DefaultItemExcludes> | ||
| 989 | <DefaultItemExcludes Condition=" '$(BaseIntermediateOutputPath)' != '' ">$(DefaultItemExcludes);$(BaseIntermediateOutputPath)**</DefaultItemExcludes> | ||
| 990 | <DefaultExcludesInProjectFolder>$(DefaultItemExcludesInProjectFolder);**/.*/**</DefaultExcludesInProjectFolder> | ||
| 991 | </PropertyGroup> | ||
| 1079 | </Project> | 992 | </Project> |
