diff --git a/src/wix/WixToolset.Core/Compiler_Module.cs b/src/wix/WixToolset.Core/Compiler_Module.cs
index 7e3a2a0ee..0a547ad72 100644
--- a/src/wix/WixToolset.Core/Compiler_Module.cs
+++ b/src/wix/WixToolset.Core/Compiler_Module.cs
@@ -25,6 +25,7 @@ private void ParseModuleElement(XElement node)
string moduleId = null;
string version = null;
var setCodepage = false;
+ var setComments = false;
var setPackageName = false;
var setKeywords = false;
var ignoredForMergeModules = false;
@@ -206,7 +207,7 @@ private void ParseModuleElement(XElement node)
this.ParseSubstitutionElement(child);
break;
case "SummaryInformation":
- this.ParseSummaryInformationElement(child, ref setCodepage, ref setPackageName, ref setKeywords, ref ignoredForMergeModules);
+ this.ParseSummaryInformationElement(child, ref setCodepage, ref setComments, ref setPackageName, ref setKeywords, ref ignoredForMergeModules);
break;
case "UI":
this.ParseUIElement(child);
@@ -274,11 +275,14 @@ private void ParseModuleElement(XElement node)
Value = "0"
});
- this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
+ if (!setComments)
{
- PropertyId = SummaryInformationType.Comments,
- Value = String.Format(CultureInfo.InvariantCulture, "This merge module contains the logic and data required to install {0}.", this.activeName)
- });
+ this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
+ {
+ PropertyId = SummaryInformationType.Comments,
+ Value = String.Format(CultureInfo.InvariantCulture, "This merge module contains the logic and data required to install {0}.", this.activeName)
+ });
+ }
this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, this.activeLanguage);
}
diff --git a/src/wix/WixToolset.Core/Compiler_Package.cs b/src/wix/WixToolset.Core/Compiler_Package.cs
index 9c1b316aa..c8a1ae595 100644
--- a/src/wix/WixToolset.Core/Compiler_Package.cs
+++ b/src/wix/WixToolset.Core/Compiler_Package.cs
@@ -37,6 +37,7 @@ private void ParsePackageElement(XElement node)
string version = null;
string symbols = null;
var isCodepageSet = false;
+ var isCommentsSet = false;
var isPackageNameSet = false;
var isKeywordsSet = false;
var isPackageAuthorSet = false;
@@ -190,12 +191,6 @@ private void ParsePackageElement(XElement node)
Value = "Installation Database"
});
- this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
- {
- PropertyId = SummaryInformationType.Comments,
- Value = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName)
- });
-
this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, productLanguage);
this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
@@ -334,7 +329,7 @@ private void ParsePackageElement(XElement node)
this.ParseStandardDirectoryElement(child);
break;
case "SummaryInformation":
- this.ParseSummaryInformationElement(child, ref isCodepageSet, ref isPackageNameSet, ref isKeywordsSet, ref isPackageAuthorSet);
+ this.ParseSummaryInformationElement(child, ref isCodepageSet, ref isCommentsSet, ref isPackageNameSet, ref isKeywordsSet, ref isPackageAuthorSet);
break;
case "SymbolPath":
if (null != symbols)
@@ -383,6 +378,15 @@ private void ParsePackageElement(XElement node)
Codepage = codepage,
});
+ if (!isCommentsSet)
+ {
+ this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
+ {
+ PropertyId = SummaryInformationType.Comments,
+ Value = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName)
+ });
+ }
+
if (!isPackageNameSet)
{
this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
@@ -780,13 +784,15 @@ private YesNoType ParseODBCDataSource(XElement node, string componentId, string
///
/// Element to parse.
///
+ ///
///
///
///
- private void ParseSummaryInformationElement(XElement node, ref bool isCodepageSet, ref bool isPackageNameSet, ref bool isKeywordsSet, ref bool isPackageAuthorSet)
+ private void ParseSummaryInformationElement(XElement node, ref bool isCodepageSet, ref bool isCommentsSet, ref bool isPackageNameSet, ref bool isKeywordsSet, ref bool isPackageAuthorSet)
{
var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
string codepage = null;
+ string comments = null;
string packageName = null;
string keywords = null;
string packageAuthor = null;
@@ -800,6 +806,9 @@ private void ParseSummaryInformationElement(XElement node, ref bool isCodepageSe
case "Codepage":
codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true);
break;
+ case "Comments":
+ comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
+ break;
case "Description":
packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
break;
@@ -838,6 +847,16 @@ private void ParseSummaryInformationElement(XElement node, ref bool isCodepageSe
});
}
+ if (null != comments)
+ {
+ isCommentsSet = true;
+ this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
+ {
+ PropertyId = SummaryInformationType.Comments,
+ Value = comments
+ });
+ }
+
if (null != packageName)
{
isPackageNameSet = true;
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/CommentsFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/CommentsFixture.cs
new file mode 100644
index 000000000..f217c2595
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/CommentsFixture.cs
@@ -0,0 +1,160 @@
+// 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.
+
+namespace WixToolsetTest.CoreIntegration
+{
+ using System.IO;
+ using System.Linq;
+ using WixInternal.Core.TestPackage;
+ using WixInternal.TestSupport;
+ using WixToolset.Data;
+ using WixToolset.Data.Symbols;
+ using WixToolset.Data.WindowsInstaller;
+ using Xunit;
+
+ public class CommentsFixture
+ {
+ [Fact]
+ public void PackageNoSummaryInformation()
+ {
+ var propertyRows = BuildPackageAndQuerySummaryInformation("PackageNoSummaryInformation.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tThis installer database contains the logic and data required to install MsiPackage."
+ }, propertyRows);
+ }
+
+ [Fact]
+ public void PackageDefaultComments()
+ {
+ var propertyRows = BuildPackageAndQuerySummaryInformation("PackageDefault.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tThis installer database contains the logic and data required to install MsiPackage."
+ }, propertyRows);
+ }
+
+ [Fact]
+ public void PackageEmptyCommentsThrows()
+ {
+ var exception = Assert.Throws(() => BuildPackageAndQuerySummaryInformation("PackageEmpty.wxs"));
+ WixAssert.StringEqual("The SummaryInformation/@Comments attribute's value cannot be an empty string. If a value is not required, simply remove the entire attribute.", exception.Message);
+ }
+
+ [Fact]
+ public void PackageCustomComments()
+ {
+ var propertyRows = BuildPackageAndQuerySummaryInformation("PackageCustom.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tExample comments"
+ }, propertyRows);
+ }
+
+ [Fact]
+ public void ModuleNoSummaryInformation()
+ {
+ var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleNoSummaryInformation.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install Module."
+ }, propertyRows);
+ }
+
+ [Fact]
+ public void ModuleDefaultComments()
+ {
+ var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleDefault.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install Module."
+ }, propertyRows);
+ }
+
+ [Fact]
+ public void ModuleEmptyCommentsThrows()
+ {
+ var exception = Assert.Throws(() => BuildModuleAndQuerySummaryInformation("ModuleEmpty.wxs"));
+ WixAssert.StringEqual("The SummaryInformation/@Comments attribute's value cannot be an empty string. If a value is not required, simply remove the entire attribute.", exception.Message);
+ }
+
+ [Fact]
+ public void ModuleCustomComments()
+ {
+ var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleCustom.wxs");
+
+ WixAssert.CompareLineByLine(new[]
+ {
+ "_SummaryInformation:Comments\tExample comments"
+ }, propertyRows);
+ }
+
+ private static string[] BuildPackageAndQuerySummaryInformation(string file)
+ {
+ var folder = TestData.Get("TestData", "Comments");
+
+ using (var fs = new DisposableFileSystem())
+ {
+ var baseFolder = fs.GetFolder();
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
+ var binFolder = Path.Combine(baseFolder, "bin");
+ var msiPath = Path.Combine(binFolder, "test.msi");
+
+ var result = WixRunner.Execute(new[]
+ {
+ "build",
+ Path.Combine(folder, file),
+ "-intermediateFolder", intermediateFolder,
+ "-bindpath", folder,
+ "-o", msiPath,
+ });
+
+ if(result.ExitCode != 0)
+ {
+ throw new WixException(result.Messages.First());
+ }
+
+ return Query.QueryDatabase(msiPath, new[] { "Property", "_SummaryInformation" })
+ .Where(s => s.StartsWith("_SummaryInformation:Comments"))
+ .OrderBy(s => s)
+ .ToArray();
+ }
+ }
+
+ private static string[] BuildModuleAndQuerySummaryInformation(string file)
+ {
+ var folder = TestData.Get("TestData", "Comments");
+
+ using (var fs = new DisposableFileSystem())
+ {
+ var baseFolder = fs.GetFolder();
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
+ var binFolder = Path.Combine(baseFolder, "bin");
+ var msmPath = Path.Combine(binFolder, "test.msm");
+
+ var result = WixRunner.Execute(new[]
+ {
+ "build",
+ Path.Combine(folder, file),
+ "-intermediateFolder", intermediateFolder,
+ "-bindpath", Path.Combine(folder, "data"),
+ "-o", msmPath,
+ });
+
+ if (result.ExitCode != 0)
+ {
+ throw new WixException(result.Messages.First());
+ }
+
+ return Query.QueryDatabase(msmPath, new[] { "Property", "_SummaryInformation" })
+ .Where(s => s.StartsWith("_SummaryInformation:Comments"))
+ .OrderBy(s => s)
+ .ToArray();
+ }
+ }
+ }
+}
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleCustom.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleCustom.wxs
new file mode 100644
index 000000000..238d63972
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleCustom.wxs
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleDefault.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleDefault.wxs
new file mode 100644
index 000000000..a6b77d4a7
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleDefault.wxs
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleEmpty.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleEmpty.wxs
new file mode 100644
index 000000000..c84618942
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleEmpty.wxs
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleNoSummaryInformation.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleNoSummaryInformation.wxs
new file mode 100644
index 000000000..88fe540d9
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleNoSummaryInformation.wxs
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageCustom.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageCustom.wxs
new file mode 100644
index 000000000..384e35457
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageCustom.wxs
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageDefault.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageDefault.wxs
new file mode 100644
index 000000000..655a17e04
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageDefault.wxs
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageEmpty.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageEmpty.wxs
new file mode 100644
index 000000000..07d0ccaf6
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageEmpty.wxs
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageNoSummaryInformation.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageNoSummaryInformation.wxs
new file mode 100644
index 000000000..f2337b391
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageNoSummaryInformation.wxs
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/data/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/data/test.txt
new file mode 100644
index 000000000..cd0db0e19
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/data/test.txt
@@ -0,0 +1 @@
+This is test.txt.
\ No newline at end of file