diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-10-23 17:32:44 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-10-24 19:44:44 -0400 |
| commit | 8b5505cd13367d48bce4ec8a6018e370ed3755b1 (patch) | |
| tree | 97fb50229aff208bce91b160d11ffeee9b1e783a /src/WixToolset.Core | |
| parent | 95188080c8005c01c39bb071459b36f8660bcfcd (diff) | |
| download | wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.tar.gz wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.tar.bz2 wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.zip | |
Reorganize Product/Package to Package/SummaryInformation.
Diffstat (limited to 'src/WixToolset.Core')
| -rw-r--r-- | src/WixToolset.Core/CommandLine/DecompileCommand.cs | 1 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 4 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler_2.cs | 467 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler_Module.cs | 56 |
4 files changed, 256 insertions, 272 deletions
diff --git a/src/WixToolset.Core/CommandLine/DecompileCommand.cs b/src/WixToolset.Core/CommandLine/DecompileCommand.cs index fc77a7b4..bce7a5a4 100644 --- a/src/WixToolset.Core/CommandLine/DecompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/DecompileCommand.cs | |||
| @@ -53,6 +53,7 @@ namespace WixToolset.Core.CommandLine | |||
| 53 | 53 | ||
| 54 | if (!this.Messaging.EncounteredError) | 54 | if (!this.Messaging.EncounteredError) |
| 55 | { | 55 | { |
| 56 | Directory.CreateDirectory(Path.GetDirectoryName(context.OutputPath)); | ||
| 56 | result.Document.Save(context.OutputPath, SaveOptions.OmitDuplicateNamespaces); | 57 | result.Document.Save(context.OutputPath, SaveOptions.OmitDuplicateNamespaces); |
| 57 | } | 58 | } |
| 58 | } | 59 | } |
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index d9c60ef6..a575bb95 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -227,8 +227,8 @@ namespace WixToolset.Core | |||
| 227 | case "PatchCreation": | 227 | case "PatchCreation": |
| 228 | this.ParsePatchCreationElement(child); | 228 | this.ParsePatchCreationElement(child); |
| 229 | break; | 229 | break; |
| 230 | case "Product": | 230 | case "Package": |
| 231 | this.ParseProductElement(child); | 231 | this.ParsePackageElement(child); |
| 232 | break; | 232 | break; |
| 233 | case "Patch": | 233 | case "Patch": |
| 234 | this.ParsePatchElement(child); | 234 | this.ParsePatchElement(child); |
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs index fbad873e..a3bc09b6 100644 --- a/src/WixToolset.Core/Compiler_2.cs +++ b/src/WixToolset.Core/Compiler_2.cs | |||
| @@ -23,15 +23,24 @@ namespace WixToolset.Core | |||
| 23 | /// Parses a product element. | 23 | /// Parses a product element. |
| 24 | /// </summary> | 24 | /// </summary> |
| 25 | /// <param name="node">Element to parse.</param> | 25 | /// <param name="node">Element to parse.</param> |
| 26 | private void ParseProductElement(XElement node) | 26 | private void ParsePackageElement(XElement node) |
| 27 | { | 27 | { |
| 28 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 28 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 29 | var sourceBits = 0; | ||
| 29 | var codepage = 65001; | 30 | var codepage = 65001; |
| 30 | var productCode = "*"; | 31 | var productCode = "*"; |
| 32 | var isPerMachine = true; | ||
| 33 | string installScope = null; | ||
| 31 | string upgradeCode = null; | 34 | string upgradeCode = null; |
| 32 | string manufacturer = null; | 35 | string manufacturer = null; |
| 33 | string version = null; | 36 | string version = null; |
| 34 | string symbols = null; | 37 | string symbols = null; |
| 38 | var isCodepageSet = false; | ||
| 39 | var isPackageNameSet = false; | ||
| 40 | var isKeywordsSet = false; | ||
| 41 | var isPackageAuthorSet = false; | ||
| 42 | |||
| 43 | this.GetDefaultPlatformAndInstallerVersion(out var platform, out var msiVersion); | ||
| 35 | 44 | ||
| 36 | this.activeName = null; | 45 | this.activeName = null; |
| 37 | this.activeLanguage = null; | 46 | this.activeLanguage = null; |
| @@ -42,12 +51,18 @@ namespace WixToolset.Core | |||
| 42 | { | 51 | { |
| 43 | switch (attrib.Name.LocalName) | 52 | switch (attrib.Name.LocalName) |
| 44 | { | 53 | { |
| 45 | case "Id": | ||
| 46 | productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); | ||
| 47 | break; | ||
| 48 | case "Codepage": | 54 | case "Codepage": |
| 49 | codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); | 55 | codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); |
| 50 | break; | 56 | break; |
| 57 | case "Compressed": | ||
| 58 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
| 59 | { | ||
| 60 | sourceBits |= 2; | ||
| 61 | } | ||
| 62 | break; | ||
| 63 | case "InstallerVersion": | ||
| 64 | msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue); | ||
| 65 | break; | ||
| 51 | case "Language": | 66 | case "Language": |
| 52 | this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); | 67 | this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| 53 | break; | 68 | break; |
| @@ -65,6 +80,31 @@ namespace WixToolset.Core | |||
| 65 | this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); | 80 | this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); |
| 66 | } | 81 | } |
| 67 | break; | 82 | break; |
| 83 | case "ProductCode": | ||
| 84 | productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); | ||
| 85 | break; | ||
| 86 | case "Scope": | ||
| 87 | installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 88 | switch (installScope) | ||
| 89 | { | ||
| 90 | case "perMachine": | ||
| 91 | // handled below after we create the section. | ||
| 92 | break; | ||
| 93 | case "perUser": | ||
| 94 | isPerMachine = false; | ||
| 95 | sourceBits |= 8; | ||
| 96 | break; | ||
| 97 | default: | ||
| 98 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser")); | ||
| 99 | break; | ||
| 100 | } | ||
| 101 | break; | ||
| 102 | case "ShortNames": | ||
| 103 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
| 104 | { | ||
| 105 | sourceBits |= 1; | ||
| 106 | } | ||
| 107 | break; | ||
| 68 | case "UpgradeCode": | 108 | case "UpgradeCode": |
| 69 | upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); | 109 | upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); |
| 70 | break; | 110 | break; |
| @@ -140,6 +180,19 @@ namespace WixToolset.Core | |||
| 140 | this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Public, "UpgradeCode"), upgradeCode, false, false, false, true); | 180 | this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Public, "UpgradeCode"), upgradeCode, false, false, false, true); |
| 141 | } | 181 | } |
| 142 | 182 | ||
| 183 | if (isPerMachine) | ||
| 184 | { | ||
| 185 | this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS"), "1", false, false, false, false); | ||
| 186 | } | ||
| 187 | |||
| 188 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform); | ||
| 189 | |||
| 190 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 191 | { | ||
| 192 | PropertyId = SummaryInformationType.WordCount, | ||
| 193 | Value = sourceBits.ToString(CultureInfo.InvariantCulture) | ||
| 194 | }); | ||
| 195 | |||
| 143 | var contextValues = new Dictionary<string, string> | 196 | var contextValues = new Dictionary<string, string> |
| 144 | { | 197 | { |
| 145 | ["ProductLanguage"] = this.activeLanguage, | 198 | ["ProductLanguage"] = this.activeLanguage, |
| @@ -240,9 +293,6 @@ namespace WixToolset.Core | |||
| 240 | case "MediaTemplate": | 293 | case "MediaTemplate": |
| 241 | this.ParseMediaTemplateElement(child, null); | 294 | this.ParseMediaTemplateElement(child, null); |
| 242 | break; | 295 | break; |
| 243 | case "Package": | ||
| 244 | this.ParsePackageElement(child, manufacturer, null); | ||
| 245 | break; | ||
| 246 | case "PackageCertificates": | 296 | case "PackageCertificates": |
| 247 | case "PatchCertificates": | 297 | case "PatchCertificates": |
| 248 | this.ParseCertificatesElement(child); | 298 | this.ParseCertificatesElement(child); |
| @@ -263,6 +313,9 @@ namespace WixToolset.Core | |||
| 263 | string parentName = null; | 313 | string parentName = null; |
| 264 | this.ParseSFPCatalogElement(child, ref parentName); | 314 | this.ParseSFPCatalogElement(child, ref parentName); |
| 265 | break; | 315 | break; |
| 316 | case "SummaryInformation": | ||
| 317 | this.ParseSummaryInformationElement(child, ref isCodepageSet, ref isPackageNameSet, ref isKeywordsSet, ref isPackageAuthorSet); | ||
| 318 | break; | ||
| 266 | case "SymbolPath": | 319 | case "SymbolPath": |
| 267 | if (null != symbols) | 320 | if (null != symbols) |
| 268 | { | 321 | { |
| @@ -298,6 +351,42 @@ namespace WixToolset.Core | |||
| 298 | 351 | ||
| 299 | if (!this.Core.EncounteredError) | 352 | if (!this.Core.EncounteredError) |
| 300 | { | 353 | { |
| 354 | if (!isCodepageSet) | ||
| 355 | { | ||
| 356 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 357 | { | ||
| 358 | PropertyId = SummaryInformationType.Codepage, | ||
| 359 | Value = "1252" | ||
| 360 | }); | ||
| 361 | } | ||
| 362 | |||
| 363 | if (!isPackageNameSet) | ||
| 364 | { | ||
| 365 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 366 | { | ||
| 367 | PropertyId = SummaryInformationType.Subject, | ||
| 368 | Value = this.activeName | ||
| 369 | }); | ||
| 370 | } | ||
| 371 | |||
| 372 | if (!isPackageAuthorSet) | ||
| 373 | { | ||
| 374 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 375 | { | ||
| 376 | PropertyId = SummaryInformationType.Author, | ||
| 377 | Value = manufacturer | ||
| 378 | }); | ||
| 379 | } | ||
| 380 | |||
| 381 | if (!isKeywordsSet) | ||
| 382 | { | ||
| 383 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 384 | { | ||
| 385 | PropertyId = SummaryInformationType.Keywords, | ||
| 386 | Value = "Installer" | ||
| 387 | }); | ||
| 388 | } | ||
| 389 | |||
| 301 | if (null != symbols) | 390 | if (null != symbols) |
| 302 | { | 391 | { |
| 303 | this.Core.AddSymbol(new WixDeltaPatchSymbolPathsSymbol(sourceLineNumbers) | 392 | this.Core.AddSymbol(new WixDeltaPatchSymbolPathsSymbol(sourceLineNumbers) |
| @@ -315,6 +404,74 @@ namespace WixToolset.Core | |||
| 315 | } | 404 | } |
| 316 | } | 405 | } |
| 317 | 406 | ||
| 407 | private void GetDefaultPlatformAndInstallerVersion(out string platform, out int msiVersion) | ||
| 408 | { | ||
| 409 | // Let's default to a modern version of MSI. Users can override, | ||
| 410 | // of course, subject to platform-specific limitations. | ||
| 411 | msiVersion = 500; | ||
| 412 | |||
| 413 | switch (this.CurrentPlatform) | ||
| 414 | { | ||
| 415 | case Platform.X86: | ||
| 416 | platform = "Intel"; | ||
| 417 | break; | ||
| 418 | case Platform.X64: | ||
| 419 | platform = "x64"; | ||
| 420 | break; | ||
| 421 | case Platform.ARM64: | ||
| 422 | platform = "Arm64"; | ||
| 423 | break; | ||
| 424 | default: | ||
| 425 | throw new ArgumentException("Unknown platform enumeration '{0}' encountered.", this.CurrentPlatform.ToString()); | ||
| 426 | } | ||
| 427 | } | ||
| 428 | |||
| 429 | private void ValidateAndAddCommonSummaryInformationSymbols(SourceLineNumber sourceLineNumbers, int msiVersion, string platform) | ||
| 430 | { | ||
| 431 | if (String.Equals(platform, "X64", StringComparison.OrdinalIgnoreCase) && 200 > msiVersion) | ||
| 432 | { | ||
| 433 | msiVersion = 200; | ||
| 434 | this.Core.Write(WarningMessages.RequiresMsi200for64bitPackage(sourceLineNumbers)); | ||
| 435 | } | ||
| 436 | |||
| 437 | if (String.Equals(platform, "Arm64", StringComparison.OrdinalIgnoreCase) && 500 > msiVersion) | ||
| 438 | { | ||
| 439 | msiVersion = 500; | ||
| 440 | this.Core.Write(WarningMessages.RequiresMsi500forArmPackage(sourceLineNumbers)); | ||
| 441 | } | ||
| 442 | |||
| 443 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 444 | { | ||
| 445 | PropertyId = SummaryInformationType.Comments, | ||
| 446 | Value = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName) | ||
| 447 | }); | ||
| 448 | |||
| 449 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 450 | { | ||
| 451 | PropertyId = SummaryInformationType.Title, | ||
| 452 | Value = "Installation Database" | ||
| 453 | }); | ||
| 454 | |||
| 455 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 456 | { | ||
| 457 | PropertyId = SummaryInformationType.PlatformAndLanguage, | ||
| 458 | Value = String.Format(CultureInfo.InvariantCulture, "{0};{1}", platform, this.activeLanguage) | ||
| 459 | }); | ||
| 460 | |||
| 461 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 462 | { | ||
| 463 | PropertyId = SummaryInformationType.WindowsInstallerVersion, | ||
| 464 | Value = msiVersion.ToString(CultureInfo.InvariantCulture) | ||
| 465 | }); | ||
| 466 | |||
| 467 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 468 | { | ||
| 469 | PropertyId = SummaryInformationType.Security, | ||
| 470 | Value = "2" | ||
| 471 | }); | ||
| 472 | |||
| 473 | } | ||
| 474 | |||
| 318 | /// <summary> | 475 | /// <summary> |
| 319 | /// Parses an odbc driver or translator element. | 476 | /// Parses an odbc driver or translator element. |
| 320 | /// </summary> | 477 | /// </summary> |
| @@ -615,40 +772,13 @@ namespace WixToolset.Core | |||
| 615 | /// <param name="node">Element to parse.</param> | 772 | /// <param name="node">Element to parse.</param> |
| 616 | /// <param name="productAuthor">Default package author.</param> | 773 | /// <param name="productAuthor">Default package author.</param> |
| 617 | /// <param name="moduleId">The module guid - this is necessary until Module/@Guid is removed.</param> | 774 | /// <param name="moduleId">The module guid - this is necessary until Module/@Guid is removed.</param> |
| 618 | private void ParsePackageElement(XElement node, string productAuthor, string moduleId) | 775 | private void ParseSummaryInformationElement(XElement node, ref bool isCodepageSet, ref bool isPackageNameSet, ref bool isKeywordsSet, ref bool isPackageAuthorSet) |
| 619 | { | 776 | { |
| 620 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 777 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 621 | var codepage = "1252"; | 778 | string codepage = null; |
| 622 | var comments = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName); | 779 | string packageName = null; |
| 623 | var keywords = "Installer"; | 780 | string keywords = null; |
| 624 | var msiVersion = 100; // lowest released version, really should be specified | 781 | string packageAuthor = null; |
| 625 | var packageAuthor = productAuthor; | ||
| 626 | string packageCode = null; | ||
| 627 | var packageLanguages = this.activeLanguage; | ||
| 628 | var packageName = this.activeName; | ||
| 629 | string platform = null; | ||
| 630 | string platformValue = null; | ||
| 631 | var security = YesNoDefaultType.Default; | ||
| 632 | var sourceBits = (this.compilingModule ? 2 : 0); | ||
| 633 | var installPrivilegeSeen = false; | ||
| 634 | var installScopeSeen = false; | ||
| 635 | |||
| 636 | switch (this.CurrentPlatform) | ||
| 637 | { | ||
| 638 | case Platform.X86: | ||
| 639 | platform = "Intel"; | ||
| 640 | break; | ||
| 641 | case Platform.X64: | ||
| 642 | platform = "x64"; | ||
| 643 | msiVersion = 200; | ||
| 644 | break; | ||
| 645 | case Platform.ARM64: | ||
| 646 | platform = "Arm64"; | ||
| 647 | msiVersion = 500; | ||
| 648 | break; | ||
| 649 | default: | ||
| 650 | throw new ArgumentException("Unknown platform enumeration '{0}' encountered.", this.CurrentPlatform.ToString()); | ||
| 651 | } | ||
| 652 | 782 | ||
| 653 | foreach (var attrib in node.Attributes()) | 783 | foreach (var attrib in node.Attributes()) |
| 654 | { | 784 | { |
| @@ -656,83 +786,15 @@ namespace WixToolset.Core | |||
| 656 | { | 786 | { |
| 657 | switch (attrib.Name.LocalName) | 787 | switch (attrib.Name.LocalName) |
| 658 | { | 788 | { |
| 659 | case "Id": | 789 | case "Codepage": |
| 660 | packageCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, this.compilingProduct); | 790 | codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true); |
| 661 | break; | ||
| 662 | case "AdminImage": | ||
| 663 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
| 664 | { | ||
| 665 | sourceBits |= 4; | ||
| 666 | } | ||
| 667 | break; | ||
| 668 | case "Comments": | ||
| 669 | comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 670 | break; | ||
| 671 | case "Compressed": | ||
| 672 | // merge modules must always be compressed, so this attribute is invalid | ||
| 673 | if (this.compilingModule) | ||
| 674 | { | ||
| 675 | this.Core.Write(WarningMessages.DeprecatedPackageCompressedAttribute(sourceLineNumbers)); | ||
| 676 | // this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Compressed", "Module")); | ||
| 677 | } | ||
| 678 | else if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
| 679 | { | ||
| 680 | sourceBits |= 2; | ||
| 681 | } | ||
| 682 | break; | 791 | break; |
| 683 | case "Description": | 792 | case "Description": |
| 684 | packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 793 | packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 685 | break; | 794 | break; |
| 686 | case "InstallPrivileges": | ||
| 687 | var installPrivileges = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 688 | switch (installPrivileges) | ||
| 689 | { | ||
| 690 | case "elevated": | ||
| 691 | // this is the default setting | ||
| 692 | installPrivilegeSeen = true; | ||
| 693 | break; | ||
| 694 | case "limited": | ||
| 695 | sourceBits |= 8; | ||
| 696 | installPrivilegeSeen = true; | ||
| 697 | break; | ||
| 698 | case "": | ||
| 699 | break; | ||
| 700 | default: | ||
| 701 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installPrivileges, "elevated", "limited")); | ||
| 702 | break; | ||
| 703 | } | ||
| 704 | break; | ||
| 705 | case "InstallScope": | ||
| 706 | var installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 707 | switch (installScope) | ||
| 708 | { | ||
| 709 | case "perMachine": | ||
| 710 | this.Core.AddSymbol(new PropertySymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS")) | ||
| 711 | { | ||
| 712 | Value = "1" | ||
| 713 | }); | ||
| 714 | installScopeSeen = true; | ||
| 715 | break; | ||
| 716 | case "perUser": | ||
| 717 | sourceBits |= 8; | ||
| 718 | installScopeSeen = true; | ||
| 719 | break; | ||
| 720 | case "": | ||
| 721 | break; | ||
| 722 | default: | ||
| 723 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser")); | ||
| 724 | break; | ||
| 725 | } | ||
| 726 | break; | ||
| 727 | case "InstallerVersion": | ||
| 728 | msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue); | ||
| 729 | break; | ||
| 730 | case "Keywords": | 795 | case "Keywords": |
| 731 | keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 796 | keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 732 | break; | 797 | break; |
| 733 | case "Languages": | ||
| 734 | packageLanguages = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 735 | break; | ||
| 736 | case "Manufacturer": | 798 | case "Manufacturer": |
| 737 | packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 799 | packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 738 | if ("PUT-COMPANY-NAME-HERE" == packageAuthor) | 800 | if ("PUT-COMPANY-NAME-HERE" == packageAuthor) |
| @@ -740,56 +802,6 @@ namespace WixToolset.Core | |||
| 740 | this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor)); | 802 | this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor)); |
| 741 | } | 803 | } |
| 742 | break; | 804 | break; |
| 743 | case "Platform": | ||
| 744 | if (null != platformValue) | ||
| 745 | { | ||
| 746 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platforms")); | ||
| 747 | } | ||
| 748 | |||
| 749 | platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 750 | switch (platformValue) | ||
| 751 | { | ||
| 752 | case "intel": | ||
| 753 | this.Core.Write(WarningMessages.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "x86")); | ||
| 754 | goto case "x86"; | ||
| 755 | case "x86": | ||
| 756 | platform = "Intel"; | ||
| 757 | break; | ||
| 758 | case "x64": | ||
| 759 | platform = "x64"; | ||
| 760 | break; | ||
| 761 | case "arm64": | ||
| 762 | platform = "Arm64"; | ||
| 763 | break; | ||
| 764 | case "": | ||
| 765 | break; | ||
| 766 | default: | ||
| 767 | this.Core.Write(ErrorMessages.InvalidPlatformValue(sourceLineNumbers, platformValue)); | ||
| 768 | break; | ||
| 769 | } | ||
| 770 | break; | ||
| 771 | case "Platforms": | ||
| 772 | if (null != platformValue) | ||
| 773 | { | ||
| 774 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); | ||
| 775 | } | ||
| 776 | |||
| 777 | this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); | ||
| 778 | platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 779 | platform = platformValue; | ||
| 780 | break; | ||
| 781 | case "ReadOnly": | ||
| 782 | security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); | ||
| 783 | break; | ||
| 784 | case "ShortNames": | ||
| 785 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
| 786 | { | ||
| 787 | sourceBits |= 1; | ||
| 788 | } | ||
| 789 | break; | ||
| 790 | case "SummaryCodepage": | ||
| 791 | codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true); | ||
| 792 | break; | ||
| 793 | default: | 805 | default: |
| 794 | this.Core.UnexpectedAttribute(node, attrib); | 806 | this.Core.UnexpectedAttribute(node, attrib); |
| 795 | break; | 807 | break; |
| @@ -801,127 +813,50 @@ namespace WixToolset.Core | |||
| 801 | } | 813 | } |
| 802 | } | 814 | } |
| 803 | 815 | ||
| 804 | if (installPrivilegeSeen && installScopeSeen) | 816 | this.Core.ParseForExtensionElements(node); |
| 805 | { | ||
| 806 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "InstallPrivileges", "InstallScope")); | ||
| 807 | } | ||
| 808 | |||
| 809 | if (String.Equals(platform, "X64", StringComparison.OrdinalIgnoreCase) && 200 > msiVersion) | ||
| 810 | { | ||
| 811 | msiVersion = 200; | ||
| 812 | this.Core.Write(WarningMessages.RequiresMsi200for64bitPackage(sourceLineNumbers)); | ||
| 813 | } | ||
| 814 | |||
| 815 | if (String.Equals(platform, "Arm64", StringComparison.OrdinalIgnoreCase) && 500 > msiVersion) | ||
| 816 | { | ||
| 817 | msiVersion = 500; | ||
| 818 | this.Core.Write(WarningMessages.RequiresMsi500forArmPackage(sourceLineNumbers)); | ||
| 819 | } | ||
| 820 | |||
| 821 | if (null == packageAuthor) | ||
| 822 | { | ||
| 823 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Manufacturer")); | ||
| 824 | } | ||
| 825 | 817 | ||
| 826 | if (this.compilingModule) | 818 | if (!this.Core.EncounteredError) |
| 827 | { | 819 | { |
| 828 | if (null == packageCode) | 820 | if (null != codepage) |
| 829 | { | 821 | { |
| 830 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 822 | isCodepageSet = true; |
| 823 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 824 | { | ||
| 825 | PropertyId = SummaryInformationType.Codepage, | ||
| 826 | Value = codepage | ||
| 827 | }); | ||
| 831 | } | 828 | } |
| 832 | 829 | ||
| 833 | // merge modules use the modularization guid as the package code | 830 | if (null != packageName) |
| 834 | if (null != moduleId) | ||
| 835 | { | 831 | { |
| 836 | packageCode = moduleId; | 832 | isPackageNameSet = true; |
| 833 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 834 | { | ||
| 835 | PropertyId = SummaryInformationType.Subject, | ||
| 836 | Value = packageName | ||
| 837 | }); | ||
| 837 | } | 838 | } |
| 838 | 839 | ||
| 839 | // merge modules are always compressed | 840 | if (null != packageAuthor) |
| 840 | sourceBits = 2; | ||
| 841 | } | ||
| 842 | else // product | ||
| 843 | { | ||
| 844 | if (null == packageCode) | ||
| 845 | { | 841 | { |
| 846 | packageCode = "*"; | 842 | isPackageAuthorSet = true; |
| 843 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 844 | { | ||
| 845 | PropertyId = SummaryInformationType.Author, | ||
| 846 | Value = packageAuthor | ||
| 847 | }); | ||
| 847 | } | 848 | } |
| 848 | 849 | ||
| 849 | if ("*" != packageCode) | 850 | if (null != keywords) |
| 850 | { | 851 | { |
| 851 | this.Core.Write(WarningMessages.PackageCodeSet(sourceLineNumbers)); | 852 | isKeywordsSet = true; |
| 853 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 854 | { | ||
| 855 | PropertyId = SummaryInformationType.Keywords, | ||
| 856 | Value = keywords | ||
| 857 | }); | ||
| 852 | } | 858 | } |
| 853 | } | 859 | } |
| 854 | |||
| 855 | this.Core.ParseForExtensionElements(node); | ||
| 856 | |||
| 857 | if (!this.Core.EncounteredError) | ||
| 858 | { | ||
| 859 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 860 | { | ||
| 861 | PropertyId = SummaryInformationType.Codepage, | ||
| 862 | Value = codepage | ||
| 863 | }); | ||
| 864 | |||
| 865 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 866 | { | ||
| 867 | PropertyId = SummaryInformationType.Title, | ||
| 868 | Value = "Installation Database" | ||
| 869 | }); | ||
| 870 | |||
| 871 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 872 | { | ||
| 873 | PropertyId = SummaryInformationType.Subject, | ||
| 874 | Value = packageName | ||
| 875 | }); | ||
| 876 | |||
| 877 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 878 | { | ||
| 879 | PropertyId = SummaryInformationType.Author, | ||
| 880 | Value = packageAuthor | ||
| 881 | }); | ||
| 882 | |||
| 883 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 884 | { | ||
| 885 | PropertyId = SummaryInformationType.Keywords, | ||
| 886 | Value = keywords | ||
| 887 | }); | ||
| 888 | |||
| 889 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 890 | { | ||
| 891 | PropertyId = SummaryInformationType.Comments, | ||
| 892 | Value = comments | ||
| 893 | }); | ||
| 894 | |||
| 895 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 896 | { | ||
| 897 | PropertyId = SummaryInformationType.PlatformAndLanguage, | ||
| 898 | Value = String.Format(CultureInfo.InvariantCulture, "{0};{1}", platform, packageLanguages) | ||
| 899 | }); | ||
| 900 | |||
| 901 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 902 | { | ||
| 903 | PropertyId = SummaryInformationType.PackageCode, | ||
| 904 | Value = packageCode | ||
| 905 | }); | ||
| 906 | |||
| 907 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 908 | { | ||
| 909 | PropertyId = SummaryInformationType.WindowsInstallerVersion, | ||
| 910 | Value = msiVersion.ToString(CultureInfo.InvariantCulture) | ||
| 911 | }); | ||
| 912 | |||
| 913 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 914 | { | ||
| 915 | PropertyId = SummaryInformationType.WordCount, | ||
| 916 | Value = sourceBits.ToString(CultureInfo.InvariantCulture) | ||
| 917 | }); | ||
| 918 | |||
| 919 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 920 | { | ||
| 921 | PropertyId = SummaryInformationType.Security, | ||
| 922 | Value = YesNoDefaultType.No == security ? "0" : YesNoDefaultType.Yes == security ? "4" : "2" | ||
| 923 | }); | ||
| 924 | } | ||
| 925 | } | 860 | } |
| 926 | 861 | ||
| 927 | /// <summary> | 862 | /// <summary> |
diff --git a/src/WixToolset.Core/Compiler_Module.cs b/src/WixToolset.Core/Compiler_Module.cs index 2ecd9113..2f926d82 100644 --- a/src/WixToolset.Core/Compiler_Module.cs +++ b/src/WixToolset.Core/Compiler_Module.cs | |||
| @@ -24,6 +24,12 @@ namespace WixToolset.Core | |||
| 24 | var codepage = 0; | 24 | var codepage = 0; |
| 25 | string moduleId = null; | 25 | string moduleId = null; |
| 26 | string version = null; | 26 | string version = null; |
| 27 | var setCodepage = false; | ||
| 28 | var setPackageName = false; | ||
| 29 | var setKeywords = false; | ||
| 30 | var ignoredForMergeModules = false; | ||
| 31 | |||
| 32 | this.GetDefaultPlatformAndInstallerVersion(out var platform, out var msiVersion); | ||
| 27 | 33 | ||
| 28 | this.activeName = null; | 34 | this.activeName = null; |
| 29 | this.activeLanguage = null; | 35 | this.activeLanguage = null; |
| @@ -50,7 +56,9 @@ namespace WixToolset.Core | |||
| 50 | break; | 56 | break; |
| 51 | case "Guid": | 57 | case "Guid": |
| 52 | moduleId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); | 58 | moduleId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); |
| 53 | this.Core.Write(WarningMessages.DeprecatedModuleGuidAttribute(sourceLineNumbers)); | 59 | break; |
| 60 | case "InstallerVersion": | ||
| 61 | msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue); | ||
| 54 | break; | 62 | break; |
| 55 | case "Language": | 63 | case "Language": |
| 56 | this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); | 64 | this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); |
| @@ -74,6 +82,11 @@ namespace WixToolset.Core | |||
| 74 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 82 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); |
| 75 | } | 83 | } |
| 76 | 84 | ||
| 85 | if (null == moduleId) | ||
| 86 | { | ||
| 87 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Guid")); | ||
| 88 | } | ||
| 89 | |||
| 77 | if (null == this.activeLanguage) | 90 | if (null == this.activeLanguage) |
| 78 | { | 91 | { |
| 79 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); | 92 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Language")); |
| @@ -174,9 +187,6 @@ namespace WixToolset.Core | |||
| 174 | case "IgnoreTable": | 187 | case "IgnoreTable": |
| 175 | this.ParseIgnoreTableElement(child); | 188 | this.ParseIgnoreTableElement(child); |
| 176 | break; | 189 | break; |
| 177 | case "Package": | ||
| 178 | this.ParsePackageElement(child, null, moduleId); | ||
| 179 | break; | ||
| 180 | case "Property": | 190 | case "Property": |
| 181 | this.ParsePropertyElement(child); | 191 | this.ParsePropertyElement(child); |
| 182 | break; | 192 | break; |
| @@ -196,6 +206,9 @@ namespace WixToolset.Core | |||
| 196 | case "Substitution": | 206 | case "Substitution": |
| 197 | this.ParseSubstitutionElement(child); | 207 | this.ParseSubstitutionElement(child); |
| 198 | break; | 208 | break; |
| 209 | case "SummaryInformation": | ||
| 210 | this.ParseSummaryInformationElement(child, ref setCodepage, ref setPackageName, ref setKeywords, ref ignoredForMergeModules); | ||
| 211 | break; | ||
| 199 | case "UI": | 212 | case "UI": |
| 200 | this.ParseUIElement(child); | 213 | this.ParseUIElement(child); |
| 201 | break; | 214 | break; |
| @@ -219,6 +232,33 @@ namespace WixToolset.Core | |||
| 219 | 232 | ||
| 220 | if (!this.Core.EncounteredError) | 233 | if (!this.Core.EncounteredError) |
| 221 | { | 234 | { |
| 235 | if (!setCodepage) | ||
| 236 | { | ||
| 237 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 238 | { | ||
| 239 | PropertyId = SummaryInformationType.Codepage, | ||
| 240 | Value = "1252" | ||
| 241 | }); | ||
| 242 | } | ||
| 243 | |||
| 244 | if (!setPackageName) | ||
| 245 | { | ||
| 246 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 247 | { | ||
| 248 | PropertyId = SummaryInformationType.Subject, | ||
| 249 | Value = this.activeName | ||
| 250 | }); | ||
| 251 | } | ||
| 252 | |||
| 253 | if (!setKeywords) | ||
| 254 | { | ||
| 255 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 256 | { | ||
| 257 | PropertyId = SummaryInformationType.Keywords, | ||
| 258 | Value = "Installer" | ||
| 259 | }); | ||
| 260 | } | ||
| 261 | |||
| 222 | var symbol = this.Core.AddSymbol(new ModuleSignatureSymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage)) | 262 | var symbol = this.Core.AddSymbol(new ModuleSignatureSymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage)) |
| 223 | { | 263 | { |
| 224 | ModuleID = this.activeName, | 264 | ModuleID = this.activeName, |
| @@ -226,6 +266,14 @@ namespace WixToolset.Core | |||
| 226 | }); | 266 | }); |
| 227 | 267 | ||
| 228 | symbol.Set((int)ModuleSignatureSymbolFields.Language, this.activeLanguage); | 268 | symbol.Set((int)ModuleSignatureSymbolFields.Language, this.activeLanguage); |
| 269 | |||
| 270 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
| 271 | { | ||
| 272 | PropertyId = SummaryInformationType.PackageCode, | ||
| 273 | Value = moduleId | ||
| 274 | }); | ||
| 275 | |||
| 276 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform); | ||
| 229 | } | 277 | } |
| 230 | } | 278 | } |
| 231 | finally | 279 | finally |
