aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler_Package.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Compiler_Package.cs')
-rw-r--r--src/WixToolset.Core/Compiler_Package.cs46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/WixToolset.Core/Compiler_Package.cs b/src/WixToolset.Core/Compiler_Package.cs
index fed08001..afe02f08 100644
--- a/src/WixToolset.Core/Compiler_Package.cs
+++ b/src/WixToolset.Core/Compiler_Package.cs
@@ -5,7 +5,6 @@ namespace WixToolset.Core
5 using System; 5 using System;
6 using System.Collections; 6 using System.Collections;
7 using System.Collections.Generic; 7 using System.Collections.Generic;
8 using System.Diagnostics.CodeAnalysis;
9 using System.Globalization; 8 using System.Globalization;
10 using System.IO; 9 using System.IO;
11 using System.Xml.Linq; 10 using System.Xml.Linq;
@@ -28,10 +27,10 @@ namespace WixToolset.Core
28 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 27 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
29 var compressed = YesNoDefaultType.Default; 28 var compressed = YesNoDefaultType.Default;
30 var sourceBits = 0; 29 var sourceBits = 0;
31 var codepage = 65001; 30 string codepage = null;
32 var productCode = "*"; 31 var productCode = "*";
32 string productLanguage = null;
33 var isPerMachine = true; 33 var isPerMachine = true;
34 string installScope = null;
35 string upgradeCode = null; 34 string upgradeCode = null;
36 string manufacturer = null; 35 string manufacturer = null;
37 string version = null; 36 string version = null;
@@ -53,7 +52,7 @@ namespace WixToolset.Core
53 switch (attrib.Name.LocalName) 52 switch (attrib.Name.LocalName)
54 { 53 {
55 case "Codepage": 54 case "Codepage":
56 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); 55 codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib);
57 break; 56 break;
58 case "Compressed": 57 case "Compressed":
59 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 58 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
@@ -62,7 +61,7 @@ namespace WixToolset.Core
62 msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue); 61 msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
63 break; 62 break;
64 case "Language": 63 case "Language":
65 this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); 64 productLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
66 break; 65 break;
67 case "Manufacturer": 66 case "Manufacturer":
68 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); 67 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters);
@@ -82,7 +81,7 @@ namespace WixToolset.Core
82 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); 81 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true);
83 break; 82 break;
84 case "Scope": 83 case "Scope":
85 installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 84 var installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
86 switch (installScope) 85 switch (installScope)
87 { 86 {
88 case "perMachine": 87 case "perMachine":
@@ -129,11 +128,6 @@ namespace WixToolset.Core
129 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 128 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
130 } 129 }
131 130
132 if (null == this.activeLanguage)
133 {
134 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language"));
135 }
136
137 if (null == manufacturer) 131 if (null == manufacturer)
138 { 132 {
139 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); 133 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer"));
@@ -171,11 +165,11 @@ namespace WixToolset.Core
171 try 165 try
172 { 166 {
173 this.compilingProduct = true; 167 this.compilingProduct = true;
174 this.Core.CreateActiveSection(productCode, SectionType.Product, codepage, this.Context.CompilationId); 168 this.Core.CreateActiveSection(productCode, SectionType.Product, this.Context.CompilationId);
175 169
176 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "Manufacturer"), manufacturer, false, false, false, true); 170 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "Manufacturer"), manufacturer, false, false, false, true);
177 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductCode"), productCode, false, false, false, true); 171 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductCode"), productCode, false, false, false, true);
178 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductLanguage"), this.activeLanguage, false, false, false, true); 172 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductLanguage"), productLanguage, false, false, false, true);
179 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductName"), this.activeName, false, false, false, true); 173 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductName"), this.activeName, false, false, false, true);
180 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductVersion"), version, false, false, false, true); 174 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ProductVersion"), version, false, false, false, true);
181 if (null != upgradeCode) 175 if (null != upgradeCode)
@@ -188,7 +182,7 @@ namespace WixToolset.Core
188 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false); 182 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false);
189 } 183 }
190 184
191 this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform); 185 this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, productLanguage);
192 186
193 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) 187 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
194 { 188 {
@@ -198,7 +192,7 @@ namespace WixToolset.Core
198 192
199 var contextValues = new Dictionary<string, string> 193 var contextValues = new Dictionary<string, string>
200 { 194 {
201 ["ProductLanguage"] = this.activeLanguage, 195 ["ProductLanguage"] = productLanguage,
202 ["ProductVersion"] = version, 196 ["ProductVersion"] = version,
203 ["UpgradeCode"] = upgradeCode 197 ["UpgradeCode"] = upgradeCode
204 }; 198 };
@@ -360,14 +354,17 @@ namespace WixToolset.Core
360 354
361 if (!this.Core.EncounteredError) 355 if (!this.Core.EncounteredError)
362 { 356 {
363 if (!isCodepageSet) 357 this.Core.AddSymbol(new WixPackageSymbol(sourceLineNumbers)
364 { 358 {
365 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) 359 PackageId = productCode,
366 { 360 UpgradeCode = upgradeCode,
367 PropertyId = SummaryInformationType.Codepage, 361 Name = this.activeName,
368 Value = "1252" 362 Language = productLanguage,
369 }); 363 Version = version,
370 } 364 Manufacturer = manufacturer,
365 Attributes = isPerMachine ? WixPackageAttributes.PerMachine : WixPackageAttributes.None,
366 Codepage = codepage,
367 });
371 368
372 if (!isPackageNameSet) 369 if (!isPackageNameSet)
373 { 370 {
@@ -435,7 +432,7 @@ namespace WixToolset.Core
435 } 432 }
436 } 433 }
437 434
438 private void ValidateAndAddCommonSummaryInformationSymbols(SourceLineNumber sourceLineNumbers, int msiVersion, string platform) 435 private void ValidateAndAddCommonSummaryInformationSymbols(SourceLineNumber sourceLineNumbers, int msiVersion, string platform, string language)
439 { 436 {
440 if (String.Equals(platform, "X64", StringComparison.OrdinalIgnoreCase) && 200 > msiVersion) 437 if (String.Equals(platform, "X64", StringComparison.OrdinalIgnoreCase) && 200 > msiVersion)
441 { 438 {
@@ -464,7 +461,7 @@ namespace WixToolset.Core
464 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) 461 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
465 { 462 {
466 PropertyId = SummaryInformationType.PlatformAndLanguage, 463 PropertyId = SummaryInformationType.PlatformAndLanguage,
467 Value = String.Format(CultureInfo.InvariantCulture, "{0};{1}", platform, this.activeLanguage) 464 Value = $"{platform};{language}"
468 }); 465 });
469 466
470 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) 467 this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers)
@@ -478,7 +475,6 @@ namespace WixToolset.Core
478 PropertyId = SummaryInformationType.Security, 475 PropertyId = SummaryInformationType.Security,
479 Value = "2" 476 Value = "2"
480 }); 477 });
481
482 } 478 }
483 479
484 /// <summary> 480 /// <summary>