From 6d2fa6ac0a21c881a19767ef036349d31928415a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Jun 2023 22:55:23 -0700 Subject: [PATCH 01/49] Start WiX Toolset v4.0.1 --- .github/workflows/build.yml | 4 +++- src/version.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80082b2b6..3e2cb0e1c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,10 +5,12 @@ on: branches: - master - develop + - develop-v4.0.1 pull_request: branches: - master - develop + - develop-v4.0.1 workflow_dispatch: inputs: tags: @@ -88,5 +90,5 @@ jobs: path: build/logs/ - name: Push to GitHub Packages - if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') + if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop-v4.0.1') run: dotnet nuget push "build/artifacts/**/*.nupkg" --source https://nuget.pkg.github.com/wixtoolset/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate diff --git a/src/version.txt b/src/version.txt index fcdb2e109..110be1f39 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.0 +4.0.1-build.{height} From 2fa6703a77d547fb076cc3cdbb99b11bd4f5c039 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 18 Apr 2023 08:43:26 -0700 Subject: [PATCH 02/49] Allow "." as valid Directory SourceName Fixes 7384 --- .../Bind/CreateWindowsInstallerDataFromIRCommand.cs | 2 +- .../TestData/SingleFile/Package.wxs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index 960d298e9..42493484b 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs @@ -507,7 +507,7 @@ private void AddDirectorySymbol(DirectorySymbol symbol) shortName = this.CreateShortName(name, false, "Directory", symbol.ParentDirectoryRef); } - if (String.IsNullOrEmpty(sourceShortname) && !String.IsNullOrEmpty(symbol.SourceName) && !this.BackendHelper.IsValidShortFilename(symbol.SourceName, false)) + if (String.IsNullOrEmpty(sourceShortname) && !String.IsNullOrEmpty(symbol.SourceName) && symbol.SourceName != "." && !this.BackendHelper.IsValidShortFilename(symbol.SourceName, false)) { sourceShortname = this.CreateShortName(symbol.SourceName, false, "Directory", symbol.ParentDirectoryRef); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs index d7b5bdc0e..3cab42674 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs @@ -11,7 +11,7 @@ - + From b4fe940cd1cb5798bc3e68a686289b8020cf7110 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 18 Apr 2023 09:02:59 -0700 Subject: [PATCH 03/49] Do not crash on Subdirectory when missing Component Directory attribute Fixes 7407 --- src/wix/WixToolset.Core/Compiler.cs | 3 +- .../ComponentFixture.cs | 31 ++++++++++++++++++- .../MissingDirectoryWithSubdirectory.wxs | 10 ++++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Component/MissingDirectoryWithSubdirectory.wxs diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index babde97d6..70e246a57 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -2254,8 +2254,7 @@ private void ParseComponentElement(XElement node, ComplexReferenceParentType par { this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Directory")); } - - if (!String.IsNullOrEmpty(subdirectory)) + else if (!String.IsNullOrEmpty(subdirectory)) { directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, directoryId, subdirectory); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs index 94900ee07..9348afa55 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs @@ -34,12 +34,41 @@ public void CanDetectDuplicateComponentGuids() }); var errors = result.Messages.Where(m => m.Level == MessageLevel.Error); - Array.Equals(new[] + Assert.Equal(new[] { 369, 369 }, errors.Select(e => e.Id).ToArray()); } } + + [Fact] + public void CannotBuildMissingDirectoryAttributeWithSubdirectory() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, "bin", "test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Component", "MissingDirectoryWithSubdirectory.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + var errors = result.Messages.Select(m => m.ToString()).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "The Component/@Directory attribute was not found; it is required." + }, errors); + } + } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Component/MissingDirectoryWithSubdirectory.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Component/MissingDirectoryWithSubdirectory.wxs new file mode 100644 index 000000000..cefa9abca --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Component/MissingDirectoryWithSubdirectory.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + From 005a33a0d5ef8233f9d547fa28ae7f72731cad69 Mon Sep 17 00:00:00 2001 From: Mike Wileczka <22036740+mwileczka@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:12:24 -0400 Subject: [PATCH 04/49] Fix harvesting project names with invalid chars Project names with invalid characters, namely spaces, where not being harvested properly. The sanitized name is requires for the `Source="$(var.PROJECT_NAME` output. Updated harvest project unit test for project names with spaces. --- src/tools/heat/VSProjectHarvester.cs | 2 +- .../MsbuildHeatFixture.cs | 48 +++++++++---------- .../HeatProjectPreSdkStyle.wixproj | 2 +- .../HeatProjectPreSdkStyle/Package.wxs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Tools Version 4Cs.csproj} | 4 +- 6 files changed, 32 insertions(+), 32 deletions(-) rename src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/{ToolsVersion4Cs => Tools Version 4Cs}/Properties/AssemblyInfo.cs (82%) rename src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/{ToolsVersion4Cs/ToolsVersion4Cs.csproj => Tools Version 4Cs/Tools Version 4Cs.csproj} (95%) diff --git a/src/tools/heat/VSProjectHarvester.cs b/src/tools/heat/VSProjectHarvester.cs index 02e8ff948..92eac6ff2 100644 --- a/src/tools/heat/VSProjectHarvester.cs +++ b/src/tools/heat/VSProjectHarvester.cs @@ -367,7 +367,7 @@ private int HarvestProjectOutputGroup(string projectFile, IDictionary buildOutpu projectBaseDir = Path.GetDirectoryName(projectFile) + "\\"; } - int harvestCount = this.HarvestProjectOutputGroupFiles(projectBaseDir, projectName, pog.Name, pog.FileSource, pogFiles, harvestParent); + int harvestCount = this.HarvestProjectOutputGroupFiles(projectBaseDir, sanitizedProjectName, pog.Name, pog.FileSource, pogFiles, harvestParent); if (this.GenerateType == GenerateType.Container) { diff --git a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs index cea767124..a7d469627 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs +++ b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs @@ -200,62 +200,62 @@ public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useTool var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); WixAssert.StringCollectionEmpty(warnings); - var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_ToolsVersion4Cs.wxs"); + var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_Tools Version 4Cs.wxs"); Assert.True(File.Exists(generatedFilePath)); var generatedContents = File.ReadAllText(generatedFilePath); var testXml = generatedContents.GetTestXml(); WixAssert.StringEqual(@"" + "" + - "" + - "" + - "" + + "" + + "" + + "" + "" + "" + "" + "" + - "" + - "" + + "" + + "" + "" + "" + "" + - "" + - "" + - "" + + "" + + "" + + "" + "" + "" + "" + "" + - "" + - "" + + "" + + "" + "" + "" + "" + - "" + - "" + - "" + + "" + + "" + + "" + "" + - "" + - "" + - "" + + "" + + "" + + "" + "" + "" + "" + "" + "" + - "" + - "" + - "" + + "" + + "" + + "" + "" + "" + "" + - "" + + "" + "" + "" + - "" + + "" + "" + "" + - "" + + "" + "" + "", testXml); @@ -266,7 +266,7 @@ public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useTool var section = intermediate.Sections.Single(); var fileSymbol = section.Symbols.OfType().Single(); - WixAssert.StringEqual(Path.Combine(fs.BaseFolder, "ToolsVersion4Cs", "bin", "Release\\\\ToolsVersion4Cs.dll"), fileSymbol[FileSymbolFields.Source].AsPath()?.Path); + WixAssert.StringEqual(Path.Combine(fs.BaseFolder, "Tools Version 4Cs", "bin", "Release\\\\Tools Version 4Cs.dll"), fileSymbol[FileSymbolFields.Source].AsPath()?.Path); } } diff --git a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/HeatProjectPreSdkStyle.wixproj b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/HeatProjectPreSdkStyle.wixproj index 642b349d9..14def6122 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/HeatProjectPreSdkStyle.wixproj +++ b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/HeatProjectPreSdkStyle.wixproj @@ -11,7 +11,7 @@ - + diff --git a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/Package.wxs b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/Package.wxs index 6c12861b8..568f9cdd1 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/Package.wxs +++ b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/HeatProjectPreSdkStyle/Package.wxs @@ -5,13 +5,13 @@ - + - + diff --git a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/Properties/AssemblyInfo.cs b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Properties/AssemblyInfo.cs similarity index 82% rename from src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/Properties/AssemblyInfo.cs rename to src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Properties/AssemblyInfo.cs index c29a23038..fed7cd9e9 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/Properties/AssemblyInfo.cs +++ b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Properties/AssemblyInfo.cs @@ -4,8 +4,8 @@ using System.Reflection; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("ToolsVersion4Cs")] -[assembly: AssemblyDescription("ToolsVersion4Cs")] +[assembly: AssemblyTitle("Tools Version 4Cs")] +[assembly: AssemblyDescription("Tools Version 4Cs")] [assembly: AssemblyProduct("WiX Toolset")] [assembly: AssemblyCompany("WiX Toolset Team")] [assembly: AssemblyCopyright("Copyright (c) .NET Foundation and contributors. All rights reserved.")] diff --git a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/ToolsVersion4Cs.csproj b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Tools Version 4Cs.csproj similarity index 95% rename from src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/ToolsVersion4Cs.csproj rename to src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Tools Version 4Cs.csproj index e5723ea25..def5ccb20 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/ToolsVersion4Cs/ToolsVersion4Cs.csproj +++ b/src/tools/test/WixToolsetTest.HeatTasks/TestData/HeatProject/Tools Version 4Cs/Tools Version 4Cs.csproj @@ -5,7 +5,7 @@ {8B19578A-816A-48A1-A6C4-58067334EB79} - ToolsVersion4Cs + Tools Version 4Cs Library ToolsVersion4Cs v4.7.2 @@ -33,4 +33,4 @@ - \ No newline at end of file + From 846165622978edbea0f5cf58c32f35bc6bfe2906 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 20 Apr 2023 18:23:07 -0400 Subject: [PATCH 05/49] Fix merged ProductCode from mergemod.cub and... ...work around other bugs in mergemod.cub. Fixes https://github.com/wixtoolset/issues/issues/7413. --- .../WindowsInstallerValidator.cs | 9 ++-- .../Validate/ValidateDatabaseCommand.cs | 10 ++++ .../TestData/SimpleModule/Module.wixproj | 48 ------------------- .../SimpleModuleWithProperty/Module.en-us.wxl | 10 ++++ .../SimpleModuleWithProperty/Module.wxs | 19 ++++++++ .../SimpleModuleWithProperty/data/test.txt | 1 + .../ValidationFixture.cs | 43 +++++++++++++++-- 7 files changed, 86 insertions(+), 54 deletions(-) delete mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt diff --git a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs index 4c1a39527..7978304ae 100644 --- a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs +++ b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs @@ -190,14 +190,17 @@ private void RunValidations() using (var session = new Session(database)) { - // Add the product code back into the database. - if (null != productCode) + // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. + if (propertyTableExists) { - // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. using (var dropProductCodeView = database.OpenExecuteView("DELETE FROM `Property` WHERE `Property` = 'ProductCode'")) { } + } + // Add the product code back into the database. + if (null != productCode) + { using (var view = database.OpenExecuteView($"INSERT INTO `Property` (`Property`, `Value`) VALUES ('ProductCode', '{productCode}')")) { } diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs index 86212c998..a9f031716 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs @@ -102,6 +102,16 @@ private void LogValidationMessage(ValidationMessage message) messageSourceLineNumbers = this.GetSourceLineNumbers(message.Table, message.PrimaryKeys); } + // Sigh. These are bad messages we get from the poorly-built mergemod.cub that supports Arm64. + // TODO: Re-evaluate mergemod.cub that's current for the next version of WiX. + if (message.IceName == "ICE03" + && (message.Table == "File" && message.Description.Contains("_ICEM07CAB Missing specifications")) + || (message.Table == "Component" && message.Description.Contains("_IceM05Mark Missing specifications")) + ) + { + return; + } + switch (message.Type) { case ValidationMessageType.InternalFailure: diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj deleted file mode 100644 index 597d4318b..000000000 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - Debug - x86 - 0.9 - 27df04c6-3cef-4b9a-bac6-4e78d188384f - MergeModule1 - Module - MergeModule1 - MergeModule1 - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - FgwepExtension.wixext - $(WixExtDir)\FgwepExtension.wixext.dll - - - - - - - - \ No newline at end of file diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl new file mode 100644 index 000000000..1b7195ad9 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs new file mode 100644 index 000000000..fbff36bcd --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt new file mode 100644 index 000000000..cd0db0e19 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs index babe58f53..aa901b464 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs @@ -35,6 +35,7 @@ public void CanBuildAndValidateSimpleModule() var result = WixRunner.Execute(new[] { "build", + "-arch", "arm64", Path.Combine(folder, "Module.wxs"), "-loc", Path.Combine(folder, "Module.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), @@ -91,7 +92,7 @@ public void CanBuildAndValidateSimpleModule() "_SummaryInformation:Author\tExample Company", "_SummaryInformation:Keywords\tMergeModule, MSI, database", "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install MergeModule1.", - "_SummaryInformation:Template\tIntel;1033", + "_SummaryInformation:Template\tArm64;1033", "_SummaryInformation:CodePage\t1252", "_SummaryInformation:PageCount\t500", "_SummaryInformation:WordCount\t0", @@ -109,6 +110,42 @@ public void CanBuildAndValidateSimpleModule() } } + [Fact] + public void CanBuildAndValidateSimpleModuleWithProperty() + { + var folder = TestData.Get(@"TestData\SimpleModuleWithProperty"); + + using (var fs = new DisposableFileSystem()) + { + var intermediateFolder = fs.GetFolder(); + + var result = WixRunner.Execute(new[] + { + "build", + "-arch", "arm64", + Path.Combine(folder, "Module.wxs"), + "-loc", Path.Combine(folder, "Module.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(intermediateFolder, @"bin\test.msm") + }); + + result.AssertSuccess(); + + var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); + Assert.True(File.Exists(msmPath)); + Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); + + var validationResult = WixRunner.Execute(new[] + { + "msi", "validate", + "-intermediateFolder", intermediateFolder, + msmPath + }); + validationResult.AssertSuccess(); + } + } + [Fact] public void CanMergeModuleAndValidate() { @@ -342,14 +379,14 @@ public void CanValidateArm64Msi() msiPath }); - Assert.Equal(1076, validationResult.ExitCode); - var messages = validationResult.Messages.Select(m => m.ToString()).ToArray(); WixAssert.CompareLineByLine(new[] { "ICE12: CustomAction: CausesICE12Error is of type: 35. Therefore it must come after CostFinalize @ 1000 in Seq Table: InstallExecuteSequence. CA Seq#: 49", "ICE46: Property 'Myproperty' referenced in column 'LaunchCondition'.'Condition' of row 'Myproperty' differs from a defined property by case only.", }, messages); + + Assert.Equal(1076, validationResult.ExitCode); } } From 29146461effb7798e054aa9933a88f612237df47 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 26 Apr 2023 13:33:59 -0400 Subject: [PATCH 06/49] Remove InstallDirDlg reference from WixUI_Mondo Fixes https://github.com/wixtoolset/issues/issues/7436. --- src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs | 1 - src/ext/UI/wixlib/WixUI_Mondo.wxs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs b/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs index 17eec3474..77b2ca3a9 100644 --- a/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs +++ b/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs @@ -284,7 +284,6 @@ public void CanBuildUsingWixUIMondo() WixAssert.CompareLineByLine(new[] { "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3", - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2", "ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X86\t1\t1", }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray()); } diff --git a/src/ext/UI/wixlib/WixUI_Mondo.wxs b/src/ext/UI/wixlib/WixUI_Mondo.wxs index 2f883b8b5..aac13112d 100644 --- a/src/ext/UI/wixlib/WixUI_Mondo.wxs +++ b/src/ext/UI/wixlib/WixUI_Mondo.wxs @@ -27,7 +27,6 @@ Patch dialog sequence: - From 1da29b425658bf1ddc774154d9bccaf940d0bc66 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 24 Apr 2023 22:16:34 -0400 Subject: [PATCH 07/49] Fix WcaErrorMessage `cArgs==-1` case. - Count args before creating message record. - Document terminating NULL requirement. - Add terminating NULL in MessageExit* macros. - Enhance tests for problems encountered fixing this nightmare. Fixes https://github.com/wixtoolset/issues/issues/7422. Fixes https://github.com/wixtoolset/issues/issues/7444. --- .../wcautil/WixToolset.WcaUtil/inc/wcautil.h | 6 ++-- .../wcautil/WixToolset.WcaUtil/wcawrap.cpp | 33 +++++++++++-------- src/test/burn/WixTestTools/MSIExec.cs | 2 +- .../NonVitalUserGroup.wxs | 2 ++ 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h b/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h index 9b331b341..b72c8d3f0 100644 --- a/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h +++ b/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h @@ -15,9 +15,9 @@ extern "C" { #include "dutil.h" -#define MessageExitOnLastErrorSource(d, x, e, s, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__); goto LExit; } } -#define MessageExitOnFailureSource(d, x, e, s, ...) if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, INSTALLMESSAGE_ERROR | MB_OK, -1, __VA_ARGS__); goto LExit; } -#define MessageExitOnNullWithLastErrorSource(d, p, x, e, s, ...) if (NULL == p) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (!FAILED(x)) { x = E_FAIL; } ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__); goto LExit; } +#define MessageExitOnLastErrorSource(d, x, e, s, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } } +#define MessageExitOnFailureSource(d, x, e, s, ...) if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, INSTALLMESSAGE_ERROR | MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } +#define MessageExitOnNullWithLastErrorSource(d, p, x, e, s, ...) if (NULL == p) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (!FAILED(x)) { x = E_FAIL; } ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } #define MessageExitOnLastError(x, e, s, ...) MessageExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) #define MessageExitOnFailure(x, e, s, ...) MessageExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) diff --git a/src/libs/wcautil/WixToolset.WcaUtil/wcawrap.cpp b/src/libs/wcautil/WixToolset.WcaUtil/wcawrap.cpp index 86b7602eb..9259e97a6 100644 --- a/src/libs/wcautil/WixToolset.WcaUtil/wcawrap.cpp +++ b/src/libs/wcautil/WixToolset.WcaUtil/wcawrap.cpp @@ -27,7 +27,9 @@ WcaErrorMessage() - sends an error message from the CustomAction using the Error table NOTE: Any and all var_args (...) must be WCHAR* - If you pass -1 to cArgs the count will be determined + If you pass -1 to cArgs, the count will be determined by + looking for a trailing NULL argment. If you omit a terminating + NULL, the results are undefined and probably crashy. ********************************************************************/ extern "C" UINT __cdecl WcaErrorMessage( __in int iError, @@ -41,6 +43,22 @@ extern "C" UINT __cdecl WcaErrorMessage( MSIHANDLE hRec = NULL; va_list args = NULL; + if (-1 == cArgs) + { + LPCWSTR wzArg = NULL; + va_list iter = NULL; + + va_start(iter, cArgs); + cArgs = 0; + + while (NULL != (wzArg = va_arg(iter, WCHAR*)) && L'\0' != *wzArg) + { + ++cArgs; + } + + va_end(iter); + } + uiType |= INSTALLMESSAGE_ERROR; // ensure error type is set hRec = ::MsiCreateRecord(cArgs + 2); if (!hRec) @@ -56,18 +74,6 @@ extern "C" UINT __cdecl WcaErrorMessage( ExitOnFailure(HRESULT_FROM_WIN32(er), "failed to set hresult code into error message"); va_start(args, cArgs); - if (-1 == cArgs) - { - LPCWSTR wzArg = NULL; - va_list iter = args; - cArgs = 0; - - while (NULL != (wzArg = va_arg(iter, WCHAR*)) && L'\0' != *wzArg) - { - ++cArgs; - } - } - for (INT i = 0; i < cArgs; i++) { er = ::MsiRecordSetStringW(hRec, i + 3, va_arg(args, WCHAR*)); @@ -76,6 +82,7 @@ extern "C" UINT __cdecl WcaErrorMessage( va_end(args); er = WcaProcessMessage(static_cast(uiType), hRec); + LExit: if (args) { diff --git a/src/test/burn/WixTestTools/MSIExec.cs b/src/test/burn/WixTestTools/MSIExec.cs index 98f54c562..f8c73afcc 100644 --- a/src/test/burn/WixTestTools/MSIExec.cs +++ b/src/test/burn/WixTestTools/MSIExec.cs @@ -111,7 +111,7 @@ public void SetDefaultArguments() this.ForceRestart = false; this.PromptRestart = false; this.LogFile = String.Empty; - this.LoggingOptions = MSIExecLoggingOptions.VOICEWARMUP; + this.LoggingOptions = MSIExecLoggingOptions.Log_All_Information | MSIExecLoggingOptions.Verbose_Output | MSIExecLoggingOptions.Extra_Debugging_Information; // `/l*vx` this.OtherArguments = String.Empty; } diff --git a/src/test/msi/TestData/UtilExtensionUserTests/ProductNonVitalUserGroup/NonVitalUserGroup.wxs b/src/test/msi/TestData/UtilExtensionUserTests/ProductNonVitalUserGroup/NonVitalUserGroup.wxs index 461648ee2..7ab4bbe10 100644 --- a/src/test/msi/TestData/UtilExtensionUserTests/ProductNonVitalUserGroup/NonVitalUserGroup.wxs +++ b/src/test/msi/TestData/UtilExtensionUserTests/ProductNonVitalUserGroup/NonVitalUserGroup.wxs @@ -10,12 +10,14 @@ + + From 1d7ca4c4d7edfb16be7ca24ca680c9b630d56e7c Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 27 Apr 2023 21:06:35 -0400 Subject: [PATCH 08/49] Fix XmlConfig lookup logic. Fixes https://github.com/wixtoolset/issues/issues/7377. Requires fix for https://github.com/wixtoolset/issues/issues/7444. --- src/ext/Util/ca/XmlConfig.cpp | 13 ++--- .../TestData/XmlConfig/Package.wxs | 22 +++++--- .../TestData/XmlConfig/my.xml | 11 ++++ .../UtilExtensionFixture.cs | 6 ++- .../XmlConfigTests/XmlConfig/Package.wxs | 27 ++++++++++ .../XmlConfig/XmlConfig.wixproj | 6 +++ .../TestData/XmlConfigTests/XmlConfig/my.xml | 11 ++++ .../WixToolsetTest.MsiE2E/XmlConfigTests.cs | 54 +++++++++++++++++++ 8 files changed, 134 insertions(+), 16 deletions(-) create mode 100644 src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/my.xml create mode 100644 src/test/msi/TestData/XmlConfigTests/XmlConfig/Package.wxs create mode 100644 src/test/msi/TestData/XmlConfigTests/XmlConfig/XmlConfig.wixproj create mode 100644 src/test/msi/TestData/XmlConfigTests/XmlConfig/my.xml create mode 100644 src/test/msi/WixToolsetTest.MsiE2E/XmlConfigTests.cs diff --git a/src/ext/Util/ca/XmlConfig.cpp b/src/ext/Util/ca/XmlConfig.cpp index 2014e15fa..3f059435d 100644 --- a/src/ext/Util/ca/XmlConfig.cpp +++ b/src/ext/Util/ca/XmlConfig.cpp @@ -266,11 +266,11 @@ static HRESULT ProcessChanges( // Keep track of where our next spot will be since our current node may be moved pxfcNext = pxfc->pxfcNext; - // With each node, check to see if it's element path matches the Id of some other node in the list + // With each node, check to see if its element path matches the Id of some other node in the list pxfcCheck = *ppxfcHead; while (pxfcCheck) { - if (pxfc->pwzElementId) + if (pxfc->pwzElementId && *pxfc->pwzElementId) { if (0 == lstrcmpW(pxfc->pwzElementId, pxfcCheck->wzId) && 0 == pxfc->iXmlFlags @@ -315,11 +315,6 @@ static HRESULT ProcessChanges( pxfcCheck->cAdditionalChanges = ++cAdditionalChanges; } } - else - { - hr = E_NOTFOUND; - ExitOnRootFailure(hr, "failed to find matching ElementId: %ls", pxfc->pwzElementId); - } } pxfcCheck = pxfcCheck->pxfcNext; @@ -402,10 +397,10 @@ static HRESULT WriteChangeData( HRESULT hr = S_OK; XML_CONFIG_CHANGE* pxfcAdditionalChanges = NULL; - LPCWSTR wzElementPath = pxfc->pwzElementId ? pxfc->pwzElementId : pxfc->pwzElementPath; + LPCWSTR wzElementPath = pxfc->pwzElementId && *pxfc->pwzElementId ? pxfc->pwzElementId : pxfc->pwzElementPath; hr = WcaWriteStringToCaData(wzElementPath, ppwzCustomActionData); - ExitOnFailure(hr, "failed to write ElementPath to custom action data: %ls", wzElementPath); + ExitOnFailure(hr, "failed to write ElementId/ElementPath to custom action data: %ls", wzElementPath); hr = WcaWriteStringToCaData(pxfc->pwzVerifyPath, ppwzCustomActionData); ExitOnFailure(hr, "failed to write VerifyPath to custom action data: %ls", pxfc->pwzVerifyPath); diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/Package.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/Package.wxs index a20026348..cb132960b 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/Package.wxs +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/Package.wxs @@ -1,17 +1,27 @@ - + + + + + - + + + + + + + - - - - + + + + diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/my.xml b/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/my.xml new file mode 100644 index 000000000..3f44c27c6 --- /dev/null +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/XmlConfig/my.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 817ab7c94..e04252dab 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs @@ -10,6 +10,7 @@ namespace WixToolsetTest.Util using WixToolset.Util; using Xunit; using System.Xml.Linq; + using System; public class UtilExtensionFixture { @@ -293,7 +294,10 @@ public void CanBuildWithXmlConfig() var results = build.BuildAndQuery(BuildX64, "Wix4XmlConfig"); WixAssert.CompareLineByLine(new[] { - "Wix4XmlConfig:DelElement\t[INSTALLFOLDER]my.xml\t\t//root/sub\txxx\t\t\t289\tDel\t1", + "Wix4XmlConfig:AddAttribute2\t[INSTALLFOLDER]my.xml\tAddElement\t\t\tTheAttribute2\tAttributeValue2\t0\tAdd\t4", + "Wix4XmlConfig:AddElement\t[#MyXmlFile]\t\t//root/child2\t\tgrandchild3\t\t273\tAdd\t2", + "Wix4XmlConfig:DelElement\t[#MyXmlFile]\t\t//root/child1\tgrandchild1\t\t\t289\tDel\t", + "Wix4XmlConfig:uxcPPF6g4HJEQpBLT9w9GT6SKyHWww\t[#MyXmlFile]\tAddElement\t\t\tTheAttribute1\tAttributeValue1\t0\tAdd\t3", }, results.OrderBy(s => s).ToArray()); } diff --git a/src/test/msi/TestData/XmlConfigTests/XmlConfig/Package.wxs b/src/test/msi/TestData/XmlConfigTests/XmlConfig/Package.wxs new file mode 100644 index 000000000..e5223ea85 --- /dev/null +++ b/src/test/msi/TestData/XmlConfigTests/XmlConfig/Package.wxs @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/XmlConfigTests/XmlConfig/XmlConfig.wixproj b/src/test/msi/TestData/XmlConfigTests/XmlConfig/XmlConfig.wixproj new file mode 100644 index 000000000..58321e7ea --- /dev/null +++ b/src/test/msi/TestData/XmlConfigTests/XmlConfig/XmlConfig.wixproj @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/test/msi/TestData/XmlConfigTests/XmlConfig/my.xml b/src/test/msi/TestData/XmlConfigTests/XmlConfig/my.xml new file mode 100644 index 000000000..3f44c27c6 --- /dev/null +++ b/src/test/msi/TestData/XmlConfigTests/XmlConfig/my.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/msi/WixToolsetTest.MsiE2E/XmlConfigTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/XmlConfigTests.cs new file mode 100644 index 000000000..9b90cf46a --- /dev/null +++ b/src/test/msi/WixToolsetTest.MsiE2E/XmlConfigTests.cs @@ -0,0 +1,54 @@ +// 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.MsiE2E; + +using System; +using System.IO; +using System.Xml.Linq; +using WixTestTools; +using Xunit; +using Xunit.Abstractions; + +public class XmlConfigTests : MsiE2ETests +{ + public XmlConfigTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) + { + } + + [RuntimeFact] + public void CanModifyXmlFileWithXmlConfig() + { + var product = this.CreatePackageInstaller("XmlConfig"); + + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + // Validate the expected changes in my.xml. + var myXmlPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "XmlConfig", "my.xml"); + var content = File.ReadAllText(myXmlPath); + var xDoc = XDocument.Parse(content); + + var xRoot = xDoc.Element("root"); + var xChild1 = xRoot.Element("child1"); + Assert.NotNull(xChild1); + + var xGrandchild1 = xChild1.Element("grandchild1"); + Assert.Null(xGrandchild1); + + var xChild2 = xRoot.Element("child2"); + Assert.NotNull(xChild2); + + var xGrandchild3 = xChild2.Element("grandchild3"); + Assert.NotNull(xGrandchild3); + Assert.True(xGrandchild3.HasAttributes); + + var xAttribute1 = xGrandchild3.Attribute("TheAttribute1"); + Assert.NotNull(xAttribute1); + Assert.Equal("AttributeValue1", xAttribute1.Value); + + var xAttribute2 = xGrandchild3.Attribute("TheAttribute2"); + Assert.NotNull(xAttribute2); + Assert.Equal("AttributeValue2", xAttribute2.Value); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } +} From 5520259549e1ca3380c8e03d5660e399ed12c48e Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 1 May 2023 21:09:14 -0400 Subject: [PATCH 09/49] Tame some wild pointers. Maybe Rust wouldn't be so bad... Fixes https://github.com/wixtoolset/issues/issues/7451. --- src/burn/engine/bundlepackageengine.cpp | 8 ++++---- .../TestData/DependencyTests/BundleF/BundleF.wxs | 13 ++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/burn/engine/bundlepackageengine.cpp b/src/burn/engine/bundlepackageengine.cpp index 95f5acbcd..61911fb43 100644 --- a/src/burn/engine/bundlepackageengine.cpp +++ b/src/burn/engine/bundlepackageengine.cpp @@ -151,7 +151,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes( hr = MemEnsureArraySizeForNewItems(reinterpret_cast(prgsczDetectCodes), *pcDetectCodes, 1, sizeof(LPWSTR), 5); ExitOnFailure(hr, "Failed to resize Detect code array"); - *prgsczDetectCodes[*pcDetectCodes] = sczId; + (*prgsczDetectCodes)[*pcDetectCodes] = sczId; sczId = NULL; *pcDetectCodes += 1; } @@ -160,7 +160,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes( hr = MemEnsureArraySizeForNewItems(reinterpret_cast(prgsczUpgradeCodes), *pcUpgradeCodes, 1, sizeof(LPWSTR), 5); ExitOnFailure(hr, "Failed to resize Upgrade code array"); - *prgsczUpgradeCodes[*pcUpgradeCodes] = sczId; + (*prgsczUpgradeCodes)[*pcUpgradeCodes] = sczId; sczId = NULL; *pcUpgradeCodes += 1; } @@ -169,7 +169,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes( hr = MemEnsureArraySizeForNewItems(reinterpret_cast(prgsczAddonCodes), *pcAddonCodes, 1, sizeof(LPWSTR), 5); ExitOnFailure(hr, "Failed to resize Addon code array"); - *prgsczAddonCodes[*pcAddonCodes] = sczId; + (*prgsczAddonCodes)[*pcAddonCodes] = sczId; sczId = NULL; *pcAddonCodes += 1; } @@ -178,7 +178,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes( hr = MemEnsureArraySizeForNewItems(reinterpret_cast(prgsczPatchCodes), *pcPatchCodes, 1, sizeof(LPWSTR), 5); ExitOnFailure(hr, "Failed to resize Patch code array"); - *prgsczPatchCodes[*pcPatchCodes] = sczId; + (*prgsczPatchCodes)[*pcPatchCodes] = sczId; sczId = NULL; *pcPatchCodes += 1; } diff --git a/src/test/burn/TestData/DependencyTests/BundleF/BundleF.wxs b/src/test/burn/TestData/DependencyTests/BundleF/BundleF.wxs index 4fb1fd43f..cfeda6c41 100644 --- a/src/test/burn/TestData/DependencyTests/BundleF/BundleF.wxs +++ b/src/test/burn/TestData/DependencyTests/BundleF/BundleF.wxs @@ -3,7 +3,18 @@ - + + + + + + + + + + + + From 9b78fdffb9c651d5f03cffdde8b0ae6c77598d63 Mon Sep 17 00:00:00 2001 From: fyodorkor Date: Thu, 13 Apr 2023 22:37:02 +0300 Subject: [PATCH 10/49] Fix XmlConfig decompile to produce schema element, Add unitest for XmlDecomile --- .../UtilExtensionFixture.cs | 23 +++++++++++++++++++ src/ext/Util/wixext/UtilDecompiler.cs | 20 ++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index e04252dab..7cc3a6d48 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs @@ -301,6 +301,29 @@ public void CanBuildWithXmlConfig() }, results.OrderBy(s => s).ToArray()); } + [Fact] + public void CanRoundtripXmlConfig() + { + var folder = TestData.Get(@"TestData", "XmlConfig"); + var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); + var output = Path.Combine(folder, "XmlConfigdecompile.xml"); + + build.BuildAndDecompileAndBuild(Build, Decompile, output); + + var doc = XDocument.Load(output); + var utilElementNames = doc.Descendants().Where(e => e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/util") + .Select(e => e.Name.LocalName) + .ToArray(); + + WixAssert.CompareLineByLine(new[] + { + "XmlConfig", + "XmlConfig", + "XmlConfig", + "XmlConfig" + }, utilElementNames); + } + [Fact] public void CanBuildModuleWithXmlConfig() { diff --git a/src/ext/Util/wixext/UtilDecompiler.cs b/src/ext/Util/wixext/UtilDecompiler.cs index 0a78201e7..52b648896 100644 --- a/src/ext/Util/wixext/UtilDecompiler.cs +++ b/src/ext/Util/wixext/UtilDecompiler.cs @@ -673,7 +673,7 @@ private void DecompileXmlConfigTable(Table table) { foreach (var row in table.Rows) { - var flags = row.FieldAsNullableInteger(6) ?? 0; + var flags = row.FieldAsNullableInteger(7) ?? 0; string node = null; string action = null; string on = null; @@ -712,14 +712,16 @@ private void DecompileXmlConfigTable(Table table) var xmlConfig = new XElement(UtilConstants.XmlConfigName, new XAttribute("Id", row.FieldAsString(0)), new XAttribute("File", row.FieldAsString(1)), - new XAttribute("ElementPath", row.FieldAsString(2)), - AttributeIfNotNull("VerifyPath", row, 3), - AttributeIfNotNull("Name", row, 4), + AttributeIfNotNull("ElementId", row, 2), + AttributeIfNotNull("ElementPath", row, 3), + AttributeIfNotNull("VerifyPath", row, 4), + AttributeIfNotNull("Name", row, 5), + AttributeIfNotNull("Value", row, 6), AttributeIfNotNull("Node", node), AttributeIfNotNull("Action", action), AttributeIfNotNull("On", on), AttributeIfTrue("PreserveModifiedDate", 0x00001000 == (flags & 0x00001000)), - NumericAttributeIfNotNull("Sequence", row, 8) + NumericAttributeIfNotNull("Sequence", row, 9) ); this.DecompilerHelper.IndexElement(row, xmlConfig); @@ -967,16 +969,16 @@ private void FinalizeServiceConfigTable(TableIndexedCollection tables) /// Collection of all tables. private void FinalizeXmlConfigTable(TableIndexedCollection tables) { - if (tables.TryGetTable("XmlConfig", out var xmlConfigTable)) + if (tables.TryGetTable("Wix4XmlConfig", out var xmlConfigTable)) { foreach (var row in xmlConfigTable.Rows) { var xmlConfig = this.DecompilerHelper.GetIndexedElement(row); - if (null == row[6] || 0 == (int)row[6]) + if (null != row[2]) { var id = row.FieldAsString(2); - if (this.DecompilerHelper.TryGetIndexedElement("XmlConfig", id, out var parentXmlConfig)) + if (this.DecompilerHelper.TryGetIndexedElement("Wix4XmlConfig", id, out var parentXmlConfig)) { parentXmlConfig.Add(xmlConfig); } @@ -987,7 +989,7 @@ private void FinalizeXmlConfigTable(TableIndexedCollection tables) } else { - var componentId = row.FieldAsString(7); + var componentId = row.FieldAsString(8); if (this.DecompilerHelper.TryGetIndexedElement("Component", componentId, out var component)) { component.Add(xmlConfig); From 0844d6506420decaed9957e6de77cba02bd579e4 Mon Sep 17 00:00:00 2001 From: Nir Bar Date: Sun, 23 Apr 2023 07:55:21 +0300 Subject: [PATCH 11/49] Fix build failure when bundle has multiple RemoteBundle elements --- ...BundleHarvestedDependencyProviderSymbol.cs | 2 +- ...ipleBundlePackagesWithRemoteBundle.wixproj | 17 ++++++++++++++++ ...MultipleBundlePackagesWithRemoteBundle.wxs | 20 +++++++++++++++++++ .../BundlePackageTests.cs | 10 ++++++++++ src/wix/WixToolset.Core/Compiler_Bundle.cs | 2 +- 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wixproj create mode 100644 src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wxs diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleHarvestedDependencyProviderSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleHarvestedDependencyProviderSymbol.cs index 71d77c948..7eb852750 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleHarvestedDependencyProviderSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleHarvestedDependencyProviderSymbol.cs @@ -17,7 +17,7 @@ public static partial class SymbolDefinitions new IntermediateFieldDefinition(nameof(WixBundleHarvestedDependencyProviderSymbolFields.DisplayName), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleHarvestedDependencyProviderSymbolFields.ProviderAttributes), IntermediateFieldType.Number), }, - typeof(WixDependencyProviderSymbol)); + typeof(WixBundleHarvestedDependencyProviderSymbol)); } } diff --git a/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wixproj b/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wixproj new file mode 100644 index 000000000..0a6ef51e6 --- /dev/null +++ b/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wixproj @@ -0,0 +1,17 @@ + + + + Bundle + {AB842E3A-8212-4D74-B407-C252D9E269F9} + + + + + + + + + + + + diff --git a/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wxs b/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wxs new file mode 100644 index 000000000..a0f42ee9f --- /dev/null +++ b/src/test/burn/TestData/BundlePackageTests/MultipleBundlePackagesWithRemoteBundle/MultipleBundlePackagesWithRemoteBundle.wxs @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs index b3ef94304..228c95c61 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs @@ -13,6 +13,16 @@ public class BundlePackageTests : BurnE2ETests { public BundlePackageTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } + [RuntimeFact] + public void CanBuildBundlePackagesWithRemoteBundles() + { + var multipleBundlePackagesWithRemoteBundle = this.CreateBundleInstaller("MultipleBundlePackagesWithRemoteBundle"); + + multipleBundlePackagesWithRemoteBundle.Install(); + // Bundle only contains permanent packages, so it isn't registered + multipleBundlePackagesWithRemoteBundle.VerifyUnregisteredAndRemovedFromPackageCache(); + } + [RuntimeFact] public void CanInstallAndUninstallBundlePackages() { diff --git a/src/wix/WixToolset.Core/Compiler_Bundle.cs b/src/wix/WixToolset.Core/Compiler_Bundle.cs index 1976117c9..89826cf62 100644 --- a/src/wix/WixToolset.Core/Compiler_Bundle.cs +++ b/src/wix/WixToolset.Core/Compiler_Bundle.cs @@ -2855,7 +2855,7 @@ private void ParseRemoteBundleElement(XElement node, string packagePayloadId) Action = RelatedBundleActionType.Upgrade, }); - var depId = new Identifier(AccessModifier.Section, this.Core.CreateIdentifier("dep", packagePayloadId, providerKey)); + var depId = this.Core.CreateIdentifier("dep", packagePayloadId, providerKey); this.Core.AddSymbol(new WixBundleHarvestedDependencyProviderSymbol(sourceLineNumbers, depId) { PackagePayloadRef = packagePayloadId, From 13dbe58b6be7b7c5d6b01ef7273331fc5e2f252c Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 2 May 2023 20:39:26 -0400 Subject: [PATCH 12/49] Fix Msmq key table relationship. Fixes https://github.com/wixtoolset/issues/issues/7454. --- src/ext/Msmq/wixext/MsmqTableDefinitions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ext/Msmq/wixext/MsmqTableDefinitions.cs b/src/ext/Msmq/wixext/MsmqTableDefinitions.cs index 849054a6d..610e9409c 100644 --- a/src/ext/Msmq/wixext/MsmqTableDefinitions.cs +++ b/src/ext/Msmq/wixext/MsmqTableDefinitions.cs @@ -47,7 +47,7 @@ public static class MsmqTableDefinitions { new ColumnDefinition("MessageQueueGroupPermission", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("MessageQueue_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "MessageQueue", keyColumn: 1, modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("MessageQueue_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Wix4MessageQueue", keyColumn: 1, modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Group_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, modularizeType: ColumnModularizeType.Column), new ColumnDefinition("Permissions", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), }, From f86155f6bd2be3f63b646f259f27c65b607d0368 Mon Sep 17 00:00:00 2001 From: timberto <33670243+timberto@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:34:25 +0200 Subject: [PATCH 13/49] Show correct error message when upgrade is blocked --- src/wix/WixToolset.Core/Compiler.cs | 2 +- .../Upgrade/MajorUpgradeDowngradeMessage.wxs | 15 +++++++++++ .../UpgradeFixture.cs | 25 +++++++++++++++++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 70e246a57..36fd35b22 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -6635,7 +6635,7 @@ private void ParseMajorUpgradeElement(XElement node, IDictionary this.Core.AddSymbol(new LaunchConditionSymbol(sourceLineNumbers) { Condition = WixUpgradeConstants.UpgradePreventedCondition, - Description = downgradeErrorMessage + Description = disallowUpgradeErrorMessage }); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs new file mode 100644 index 000000000..7d964daba --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs index 2b6590eea..5d0b69d1d 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs @@ -11,9 +11,8 @@ namespace WixToolsetTest.CoreIntegration public class UpgradeFixture { - [Fact] - public void PopulatesInstallExecuteSequenceTable() + public void FailsOnInvalidVersion() { var folder = TestData.Get(@"TestData"); @@ -44,5 +43,27 @@ public void PopulatesInstallExecuteSequenceTable() Assert.Equal(242, result.ExitCode); } } + + [Fact] + public void MajorUpgradeDowngradeMessagePopulatesRowsAsExpected() + { + var folder = TestData.Get("TestData", "Upgrade"); + var build = new Builder(folder, null, new[] { folder }); + + var results = build.BuildAndQuery(Build, "Upgrade", "LaunchCondition"); + WixAssert.CompareLineByLine(new[] + { + "LaunchCondition:NOT WIX_DOWNGRADE_DETECTED\tNo downgrades allowed!", + "LaunchCondition:NOT WIX_UPGRADE_DETECTED\tNo upgrades allowed!", + "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t\t2.0.0\t1033\t1\t\tWIX_UPGRADE_DETECTED", + "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t2.0.0\t\t1033\t2\t\tWIX_DOWNGRADE_DETECTED", + }, results); + } + + private static void Build(string[] args) + { + var result = WixRunner.Execute(args); + result.AssertSuccess(); + } } } From 5ddb81c8bb79687c19a24d96ec85b09c63fd9274 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 11 May 2023 22:57:46 -0400 Subject: [PATCH 14/49] Fix Dialog table decompilation. Fix duplicate NoMinimize attribute and add attributes that were entirely missing. Fixes https://github.com/wixtoolset/issues/issues/7482. --- .../Decompile/Decompiler.cs | 3 ++- .../TestData/Decompile/ExpectedUI.wxs | 3 +++ .../TestData/Decompile/ui.msi | Bin 290816 -> 290816 bytes 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 9fda8248c..183c319bf 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs @@ -4246,13 +4246,14 @@ private void DecompileDialogTable(Table table) 0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesVisible) ? new XAttribute("Hidden", "yes") : null, 0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesModal) ? new XAttribute("Modeless", "yes") : null, 0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesMinimize) ? new XAttribute("NoMinimize", "yes") : null, - 0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesMinimize) ? new XAttribute("NoMinimize", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesSysModal == (attributes & WindowsInstallerConstants.MsidbDialogAttributesSysModal) ? new XAttribute("SystemModal", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesKeepModeless == (attributes & WindowsInstallerConstants.MsidbDialogAttributesKeepModeless) ? new XAttribute("KeepModeless", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesTrackDiskSpace == (attributes & WindowsInstallerConstants.MsidbDialogAttributesTrackDiskSpace) ? new XAttribute("TrackDiskSpace", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesUseCustomPalette == (attributes & WindowsInstallerConstants.MsidbDialogAttributesUseCustomPalette) ? new XAttribute("CustomPalette", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesLeftScroll == (attributes & WindowsInstallerConstants.MsidbDialogAttributesLeftScroll) ? new XAttribute("LeftScroll", "yes") : null, WindowsInstallerConstants.MsidbDialogAttributesError == (attributes & WindowsInstallerConstants.MsidbDialogAttributesError) ? new XAttribute("ErrorDialog", "yes") : null, + WindowsInstallerConstants.MsidbDialogAttributesRightAligned == (attributes & WindowsInstallerConstants.MsidbDialogAttributesRightAligned) ? new XAttribute("RightAligned", "yes") : null, + WindowsInstallerConstants.MsidbDialogAttributesRTLRO == (attributes & WindowsInstallerConstants.MsidbDialogAttributesRTLRO) ? new XAttribute("RightToLeft", "yes") : null, !row.IsColumnNull(6) ? new XAttribute("Title", row.FieldAsString(6)) : null); this.UIElement.Add(xDialog); diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ExpectedUI.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ExpectedUI.wxs index 0526efc19..38aa2e7aa 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ExpectedUI.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ExpectedUI.wxs @@ -478,6 +478,9 @@ + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ui.msi b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/ui.msi index 20395fb08db1c44bb7d8c8e7c8efa11cd806b604..230cdb5d60a4fc56bebc6ac117f9ab71db482b88 100644 GIT binary patch delta 1065 zcmYL|UuauZ9LLW&zjL#;NtfHC`=^_|`%_ltS~F4~#NpByn1sP1^r6TGn^L;4(BgX0 zM#W`JQ1E4Vq({XE1)07y3EnP8aInmxlucNN6%3nDXBm52g!(dJ@q0Q#;ePo3?)Uu8 zIlpu6@0M12N-I6p2kyQX8DlSjm%-y!t91mL0wW*|tQSOjPDQ)jj|=0ke$e0qx2}p_ zRxR`&3UzVDdWCxAWt}Y;h^x7y+mtJMmA`w**$js^oISVfl)&G+%=uGoJMjCLxU&zL zqHQUE|9YmAf!hp<12?%7LfGF}WMaS5kgToH0(ZEJ zT6Ob3zEwrVR=xHY<(yrxwzW?zI=O!99x8dL|Gh`&@u?)gtBZfryPssG7(1o7$j*L6 z5tCb`YWT7%6SbV&;T{=1mw)4IF;kd$5{!<|_?i6a!qkNKcHTeZ`Rl{pv|lWYd#~sH z>CrR!X%Eknfgv-Nkl#ghszILiQqt4)IXWl;p__9wI$Nd=ohj2nJz1t9{Y9BxlNX7V zW-G{cD-_{ZbYF!A#k|nRDwu~O&OkRY+(U$MeQlXu*evl929H||m!v|e1Ls%qDWW(% zgq1)9d<0_PQ-FooBCsv}07$R~92;YjZMyAHY{UxC4rmG53B3gEhSs6B&wqv5y_TVI z=v~gXtZ%T2RZ}q7_G`!co^Ehe9~oBF)YY(EEq(gjcvKm187Bme*a delta 933 zcmYL{T}TvB7>4J}IkW!knzO6rPe!AzwOHB8dLb1xjthbWZfGGEv_wG=gve4Yg{}qF zm52vCU3z6VX$u28K}HL9(U0Iz(hoswCedA9Y!DT0?@_h}p6~t6`+euknKLJq^QUtD z^fx`YQ79A+DT>k!WNt!_f-YczD6oD0cx8nfaAUi7ejpT1iYJX;jnpF*>%YkkUa8ir ze+d5tcN@$qKG##jb+wu&8eL6=L;pKX%Y3n^-A**G5JHN!ooI21R*lZ>MT;l)E_(>} zRA??*+F>-jwUeP&MB9Zl_^;q#v}Pw;dkJ4O+U@+lzO5v2ppSTzI#fNyUY>7rH62dl zrjt8(gvl?rjqrPw=fgS=M@qRK*>ZU-65TBGdl7?u$1J`OiG~PK6ctdwfCfCE1eAg@ zP!4#gqk(MLjsC}8&qe_~s<>^j*0Ckj Date: Mon, 15 May 2023 21:05:50 -0400 Subject: [PATCH 15/49] Skip processing missing FeatureComponents table. Fixes https://github.com/wixtoolset/issues/issues/7472. --- .../Bundles/ProcessMsiPackageCommand.cs | 2 +- .../BundleFixture.cs | 28 ++++++++++++++++++ .../Bundle.en-us.wxl | 11 +++++++ .../BundleWithComponentlessPackage/Bundle.wxs | 12 ++++++++ .../data/MsiPackage/Shared.dll | 1 + .../data/MsiPackage/test.txt | 1 + .../data/fakeba.dll | 1 + .../data/test.msi | Bin 0 -> 32768 bytes 8 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.en-us.wxl create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/Shared.dll create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/test.txt create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/fakeba.dll create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/test.msi diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs index 71e0d7de8..d6cf1cfd7 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs @@ -379,7 +379,7 @@ private void CreateRelatedPackages(Database db) private void CreateMsiFeatures(Database db) { - if (db.TableExists("Feature")) + if (db.TableExists("Feature") && db.TableExists("FeatureComponents")) { using (var allFeaturesView = db.OpenExecuteView("SELECT * FROM `Feature`")) using (var featureView = db.OpenView("SELECT `Component_` FROM `FeatureComponents` WHERE `Feature_` = ?")) diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index 5c51ecdba..5bcd1f499 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs @@ -811,5 +811,33 @@ public void CannotBuildWithMissingBootstrapperApplication() Assert.False(true, "Expected exception not accepted."); } } + + [Fact] + public void CanBuildBundleWithMsiPackageWithoutComponents() + { + var folder = TestData.Get(@"TestData\BundleWithComponentlessPackage"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Bundle.wxs"), + "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(baseFolder, @"bin\test.exe") + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); + } + } + } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.en-us.wxl b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.en-us.wxl new file mode 100644 index 000000000..23cf236c7 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.wxs new file mode 100644 index 000000000..01b9e716c --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/Bundle.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/Shared.dll b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/Shared.dll new file mode 100644 index 000000000..0e461ba84 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/Shared.dll @@ -0,0 +1 @@ +This is Shared.dll. \ No newline at end of file diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/test.txt new file mode 100644 index 000000000..8b9862200 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/MsiPackage/test.txt @@ -0,0 +1 @@ +This is test.txt \ No newline at end of file diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/fakeba.dll b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/fakeba.dll new file mode 100644 index 000000000..970efdf09 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/fakeba.dll @@ -0,0 +1 @@ +This is a fakeba.dll \ No newline at end of file diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/test.msi b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithComponentlessPackage/data/test.msi new file mode 100644 index 0000000000000000000000000000000000000000..e773f10409aa1e24d516187051e99316a65986eb GIT binary patch literal 32768 zcmeHPdu$xXc^^`gMai;d*|KA~iM@VAl4J7Br$l*OiO0L6NQaUbl9KGCiMqU7l55`W z(z|;i8OJdlTXxdMb=}%=(nfXCCT-eSP3)xaxDC(-Fj}BBiUw$aqDWC8$RGZv23j;g zYWDY=$KH_=rK1wGP`kVQZg%JKeKX&DubCU(n}4_c`(J$ZmVXhet^=Y)ytBMjT&44y zkQ$I#*9pav53c0xTuN>Zby!N7+jbFM?#qs3lGo! zMUd_R{Y@w*ZC)3tniOU6bTbc6;OZax=lsKkbJ;yZ>V3VR96yd?$g>%Z(kHJhO{jn9 z#_U4=2LqqZ|6BI0!YldCb@pQiPJwI#t}TE@>9cN2LVw%9xxzx>Cm4Ui`$p*>1a0z+ zSO3uC2TR#|2llRW+^V$@cPv+aRhgZl>FJLS3}t}p*;p^=v7*TMMLP5(xqX-(w+nq2R| z4+>%7{>z$yYqkE()cazqCK=;Xh^X zX5B4K|1xKvc-BvUJ7{;*(f?85ZwJ4U{m;Ul%isa&UkzNG&PMr9-oG!QujT(TXW%B# z=XmIK8l`^&>ej}8@Zfx*oPYShYx#RGLjtb@efqO&)*i~+cK)rLwHW%b!e z1Af2rptiq_)W1ZXb=yDEH}Zc8+>I1p7X3SSHiEjbI_u?sV^|xnmC~UqTJ<1AGO25W|pEhqB!B?Yx<;_2BFHfs_L&2T~5C9JrD>ut{vj8vh!6hr3;<*J>m`7m!R=k_C&1i8o@|e%-8r0#n8KdIf{}%N3dZZlRW~3bN zX23SIxC*7$q8F{8uodYwDBpqnZD_L{z&8B;lLX$h~`@8Pb`#jiW%uFu8mT&&baKbo*>^l^L=ejacq zfMeh@(>|m_8ulZ70gwUQ2jIA#0L%hD0Jt7-8{l?81Ymv2MG^2`a5;0RZU} z$KL~X1AYj2H{f3ZPXm4%a5rE8ZC?fi0QRLFun$0aeF`uIV85A18KbOj0Ne_=Q3LDV z1^9OW=iUO`j~?YD2++vO{i}=dYjxQWcDNo8?@zL=C!c!qhfnS}on&0%LA5_Dj)
~mcK?pORolB*qZ++tHPpz&%-l`t3_w0kg^da$c;=|%2;w0o~?Q0|E^Ia?MTVRLY zyXx+P44V4@HtfB2uDZ>5n64bt2*x!g?_+}Z2j%VHgq68xMD6DJv(@)w;xX{`Dp;EL zKm%@rq~DHR;+w@zz^&lzF6i1G=+*n6M;TcogWh#v7r00CqSmb_>4Waxhn^i2{mALX zj_z8YlhE#xaG`_KIPdi^Y(W{PzkFDZo5h@X1ZQO;oQ$hN=jYLZ^})IdeCuoHPT;3bEa)0DMqzKsIR;Fon;2EN$cyc^<0nV zCwVsbiK7wvtiy}#tPAko;JZ-DZ*X`WfS&Rj81+32Q+`*&i{HNp@#W-6zOM0M+N@E$ zuI#2IRlRA6H=k=cro`l$5|w|U&r8=>*=kWdDjpY~MCNUHdRoFxd3KmTg|%m2XhA0;$i z*H0f6AA@3jN}NWF^a=5dcvAeL_yzGCBDhbBXT>jxUlz}cUlA{g&xqd;XT)d4OXAnW zuZzzk()yD4E%BS;3*w82zm7aEOue#c& z-YkaBisyEn-SPU4*Oy;!`Qq}Kp=X!RE+c2xnf{lTUv7S}`Sj2k0N#h5Z9a|iGec*G z&MZGSbawen^NVYLHlJ>JLfy?@Zg~Q@&RA$`owd%kJlpbo%kyk)oms}cGCpX$@3r{% z^5VyOVXDQ-jFcJkny9t^>DFgnd3Nrle|Tw8kI0ON-;4923?W%E<6&MS*Mu`!c1Oct z&JE+m<4(EiW=BSjjTgqoI}ba4b;>Em)zA$K3r=OO>{_`XoC`uH_5vS`O4VYV3rg;z z9X%Z#ot=fw_QAfMTzk*{u6^y<{NAqi-i~ZMi3>MmZvLKZ0?doXHXZLsa zbq@4(b?wbQHtrVD@mw{Eg9H zDdyd%7G^JaJSbNy z?uaw#mX&0j)ZCB;17-e^YPn1+3$2z0_OP=cQ;4gyzDRRK;^)AoX(-#c8y^`iL9M(g z&kd;}RO&fxq}#0O9Lz`2iCoK@vLZK*iQSr9w90Z`U<-oKDhDu^VP?Wzh{s`O{AueH zt-CdaGJ`5(Sx2Deq2;5CY~*5GiYJdtIL^Iklo=*?k@y<)ZOB*rl#sXGh*OVqPgF#u=VBNttxLRrwmnBy*M zrx?lkaWMqU%7qxnp(puj{59rsbWY+_6hFatU0?ElP|hewv#y~&rJO;;nG2=kvF2x7 z->UkavPGO#C&4oX`L7XGGgDILl+NZ37~eZG$0(#Z2q_7n2U2`UfO9CZ*AUhT2oX#L zRlk%eEX;+l3{WFf_lh%C1-{&JDaBwNF-?peD^R$C5Rxt#r@PBSa++==GZGYOccqTR z&;}Nkl#f&WC>pnJO*vi}&eAU#N2zE!lR+3~MnjKEVa>XWRyD%h0gtD&bdk)d37cjo zSXo5ZGRo*UW!VyQE$c$Nb-7Xx$Tsy{s&d8})|w!_GFifzj@&Ywv0G}RmQbZ!gJIr- z`m)L-OhV$~EgBxYm%JkFFX)B=6()8oneiD6$&&0aV^DK^%8NW&6Eg-`djyIN4wpGKq)FQ>Lu4{540zVD|=q{O0gc-Vf&Ky%qPN5XLDNxrECH)$@3_pT7OooCk zPOvM?$Hc}Cdhb|wL{edh=wozq66GCGdN0f{cBQQ)U5<5fk=nLLRs)+|sLtIP7>?4VS<@TDy9`g212x)=^AhAAL77 ztU6+bL>^9hu{Bk8rX!dUP6h)GWXoaHd67NZp}J6aMOuk7M(jG6Xrh@5BDpZ)@L>pn zX$JVByG_&tt%Fkr4XC;_z?`QFBPyI%cw# zX1WYh;M1_apz)Rxm(*@E^U)@)fnjfE49gL$f=V^(U1tQOE^9Nd#0HYXB{LRT(kU3f zCna!xCV;*x?rG6d602H(bMZ`@^p83K(AFe7H#hD&A$X07^oJ0hx=E4i7&epB7fe!Q zDOAc!uP|EdFGf@e;6Pou4w2|&RNO{6p&WZ*RPd`61}l2K3vt7`5r&fXQCdD}%ZwFW z$w&sJoL+6#(USyE;=N_0!AiR)!m7JlVV7>tp(yM511~iR_&iA21>Ia5rg_>4OE4ml zigDW=iWK zt!JBMP$**wZid!MWX8Em^8)t?DTn4@&S~(lO+g`(fe|q${gc+v_;e+ksBU~{$&IB( z$qrJ5;ZZS#D={#jfxL$FZn_C11)L>#iiK z9XWfRjJJNMvZ*w$(k4WD6ALSA$tZ;xVFtDml!r}dNjI3uV_!jP(0!7LCYY9CHaMpo z3TzPEcnOADR)TSyHQ|b!JMh#P252YN^0FGT;4jpYf$AwKxo$}c3z|U0u{nxqfV@Nj zHyc817-By_i4WPB*e6X{xo*xR?G$GUy~1q6daFQBu2GalkZ5GEEcZ*K5@A0?2J?FV zQ|c#Wd4_4q1!^Ow$f=mmXq^-V^HP*sD-YR6PRzIlO*CBafzz;z9@Kd8fZ@-I21GN9#lMX zrEWW(_0&X~D2tXO-Camr8h0P4mC`EHBS{HOcNgHVVNax$G44IxT}XEq(%prrWQlK< zzv=G6s=eLXx=b(oukhUko?hj7Ri5GGdDJn%^O_FMX9n`za}&(3kT#NGE#zx?)(j?P^7)#qEqJ-fg0J^sJ`4^hD1-(vX^fWIlgGf_N0{sN#G@O8ij zz?*;;z&XH102}eQ33edm?-R@+ZAJPNQvRmh3rP9<1b>B;zftfeQquZIr2NgN?;|CC z{?9@`QgOrIEKctDZWDixfb>sz4_Xrewh<9S?7^7>{`LUN_+JpiY6-4_PcDHb@zsVd z=YI>-zA091cq;w^hbAOG{{EfD=Y|>w&pykI0qv0xs4{>g6~>3$(^1Q-axjgpaxUp* zfEk+YDa1aysa5L>&&I0Xa9{*h#-?&Nekg%?Hfs_OPA2{&ew6S=& literal 0 HcmV?d00001 From ddc79979ced959d8e1b7bd326950a735b73343e5 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 17 May 2023 18:14:59 -0400 Subject: [PATCH 16/49] Fix duplicate keys from inline subdirectories. Fixes https://github.com/wixtoolset/issues/issues/7459. --- ...CreateWindowsInstallerDataFromIRCommand.cs | 14 ++++++--- .../DirectoryFixture.cs | 3 +- .../TestData/DuplicateDir/DuplicateDir.wxs | 30 +++++++++++++++---- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index 42493484b..f160bff68 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs @@ -1319,6 +1319,7 @@ private void EnsureModuleIgnoredTable(IntermediateSymbol symbol, string ignoredT { var directory = symbol.Name.Trim(PathSeparatorChars); var parentDir = symbol.ParentDirectoryRef ?? (symbol.Id.Id == "TARGETDIR" ? null : "TARGETDIR"); + var directoryRows = this.Data.TryGetTable("Directory", out var table) ? table.Rows.ToDictionary(row => row.FieldAsString(0)) : new Dictionary(); var start = 0; var end = directory.IndexOfAny(PathSeparatorChars); @@ -1335,10 +1336,15 @@ private void EnsureModuleIgnoredTable(IntermediateSymbol symbol, string ignoredT var id = this.BackendHelper.GenerateIdentifier("d", symbol.ParentDirectoryRef, path); var shortnameSubdirectory = this.BackendHelper.IsValidShortFilename(subdirectoryName, false) ? null : this.CreateShortName(subdirectoryName, false, "Directory", symbol.ParentDirectoryRef); - var subdirectoryRow = this.CreateRow(symbol, "Directory"); - subdirectoryRow[0] = id; - subdirectoryRow[1] = parentDir; - subdirectoryRow[2] = CreateMsiFilename(shortnameSubdirectory, subdirectoryName); + if (!directoryRows.ContainsKey(id)) + { + var subdirectoryRow = this.CreateRow(symbol, "Directory"); + subdirectoryRow[0] = id; + subdirectoryRow[1] = parentDir; + subdirectoryRow[2] = CreateMsiFilename(shortnameSubdirectory, subdirectoryName); + + directoryRows.Add(id, subdirectoryRow); + } parentDir = id; } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs index 8e401c40e..cacf72bdc 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs @@ -170,7 +170,8 @@ public void CanGetDuplicateDir() var dirSymbols = section.Symbols.OfType().ToList(); WixAssert.CompareLineByLine(new[] { - "dZsSsu81KcG46xXTwc4mTSZO5Zx4:INSTALLFOLDER:dupe", + @"d6axmdFGwwNJUBTBpSSKcI7uWXo8:INSTALLFOLDER:path\to\path1", + @"dQ9mCRk.rZXStHc.ILz66dIhE0FI:INSTALLFOLDER:path\to\path2", "INSTALLFOLDER:ProgramFiles6432Folder:MsiPackage", "ProgramFiles6432Folder:ProgramFiles64Folder:.", "ProgramFiles64Folder:TARGETDIR:PFiles64", diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DuplicateDir/DuplicateDir.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DuplicateDir/DuplicateDir.wxs index a58b68c83..6d7b6681d 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DuplicateDir/DuplicateDir.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DuplicateDir/DuplicateDir.wxs @@ -2,23 +2,41 @@ - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + From 36e3408d6f99da692fff5720ff2867faad2803ea Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 22 May 2023 09:47:17 -0700 Subject: [PATCH 17/49] Update CLA signatures location --- .github/workflows/cla.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 9d449e812..d356f4ad8 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -10,13 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - name: "CLA-Bot signature check" - uses: cla-assistant/github-action@v2.1.3-beta + uses: cla-assistant/github-action@v2.3.0 if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PERSONAL_ACCESS_TOKEN : ${{ secrets.CLA_BOT_ACCESS_TOKEN }} with: - remote-repository-name: Home + remote-repository-name: .github path-to-signatures: '.github/signatures/cla.json' - path-to-document: 'https://github.com/wixtoolset/Home/blob/master/DNFCLA.md' - allowlist: wixbot + path-to-document: 'https://github.com/wixtoolset/.github/blob/master/DNFCLA.md' + allowlist: wixbot,dependabot[bot] From 856658a8cbbf5bac9c0bf5cfced01a009c59f80d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 30 May 2023 08:28:14 -0700 Subject: [PATCH 18/49] Obsolete removed PackageState.Cached value A package's cached status is no longer set via the PackageState. The value was removed in native code but the managed code was missed throwing off the enum mapping. Fixes 7399 --- .../burn/WixToolset.Mba.Core/IBootstrapperEngine.cs | 11 ++++++----- src/test/burn/TestBA/TestBA.cs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs index 25ce52dff..3f90639fe 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs @@ -407,11 +407,6 @@ public enum PackageState /// Absent, - /// - /// The package is not installed but is in the package cache. - /// - Cached, - /// /// The package is installed. /// @@ -421,6 +416,12 @@ public enum PackageState /// The package is on the machine but not active, so only uninstall operations are allowed. /// Superseded, + + /// + /// This value is no longer used. See the DetectPackageCompleteEventArgs.Cached value instead. + /// + [Obsolete("Use DetectPackageCompleteEventArgs.Cached instead.")] + Cached = Present, } /// diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index 01109911e..43c1584b6 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs @@ -299,7 +299,7 @@ protected override void OnPlanPackageBegin(PlanPackageBeginEventArgs args) args.CacheType = cacheType; } - this.Log("OnPlanPackageBegin() - id: {0}, defaultState: {1}, requestedState: {2}, defaultCache: {3}, requestedCache: {4}", args.PackageId, args.RecommendedState, args.State, args.RecommendedCacheType, args.CacheType); + this.Log("OnPlanPackageBegin() - id: {0}, currentState: {1}, defaultState: {2}, requestedState: {3}, defaultCache: {4}, requestedCache: {5}", args.PackageId, args.CurrentState, args.RecommendedState, args.State, args.RecommendedCacheType, args.CacheType); } protected override void OnPlanPatchTarget(PlanPatchTargetEventArgs args) From 29cec14e4197080bdac5d6c1b66f4aaf9b53e91c Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 31 May 2023 16:04:27 -0400 Subject: [PATCH 19/49] Downgrade bad ProductVersion error to warning. Fixes https://github.com/wixtoolset/issues/issues/7522. --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 6 --- .../wix/WixToolset.Data/WarningMessages.cs | 11 ++++ .../Bind/BindDatabaseCommand.cs | 2 +- ...CreateWindowsInstallerDataFromIRCommand.cs | 2 +- src/wix/WixToolset.Core/Compiler_Patch.cs | 2 +- ...ackageWithUndefinedBindVariableVersion.wxs | 31 +++++++++++ .../UpgradeFixture.cs | 7 +-- .../VersionFixture.cs | 51 ++++++++++++++----- 8 files changed, 85 insertions(+), 27 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Version/PackageWithUndefinedBindVariableVersion.wxs diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index a948fb2f2..bc63247e0 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -1306,11 +1306,6 @@ public static Message InvalidPreprocessorVariable(SourceLineNumber sourceLineNum return Message(sourceLineNumbers, Ids.InvalidPreprocessorVariable, "Ill-formed preprocessor variable '$({0})'. Variables must have a prefix (like 'var.', 'env.', or 'sys.') and a name at least 1 character long. If the literal string '$({0})' is desired, use '$$({0})'.", variable); } - public static Message InvalidProductVersion(SourceLineNumber sourceLineNumbers, string version) - { - return Message(sourceLineNumbers, Ids.InvalidProductVersion, "Invalid product version '{0}'. MSI product versions must have a major version less than 256, a minor version less than 256, and a build version less than 65536. The revision value is ignored but version labels and metadata are not allowed.", version); - } - public static Message InvalidRemoveComponent(SourceLineNumber sourceLineNumbers, string component, string feature, string transformPath) { return Message(sourceLineNumbers, Ids.InvalidRemoveComponent, "Removing component '{0}' from feature '{1}' is not supported. Either the component was removed or the guid changed in the transform '{2}'. Add the component back, undo the change to the component guid, or remove the entire feature.", component, feature, transformPath); @@ -2520,7 +2515,6 @@ public enum Ids InvalidWixTransform = 239, UnexpectedFileExtension = 240, UnexpectedTableInPatch = 241, - InvalidProductVersion = 242, InvalidKeypathChange = 243, MissingValidatorExtension = 244, InvalidValidatorMessageType = 245, diff --git a/src/api/wix/WixToolset.Data/WarningMessages.cs b/src/api/wix/WixToolset.Data/WarningMessages.cs index 7659b4e5d..d54990e1a 100644 --- a/src/api/wix/WixToolset.Data/WarningMessages.cs +++ b/src/api/wix/WixToolset.Data/WarningMessages.cs @@ -678,6 +678,17 @@ public static Message InvalidMsiProductVersion(SourceLineNumber sourceLineNumber return Message(sourceLineNumbers, Ids.InvalidMsiProductVersion, "Invalid product version '{0}' in MSI package '{1}'. Product version should have a major version less than 256, a minor version less than 256, and a build version less than 65536. The bundle may incorrectly detect upgrades of this package.", version, package); } + public static Message InvalidMsiProductVersion(SourceLineNumber sourceLineNumbers, string version) + { + return Message(sourceLineNumbers, Ids.InvalidMsiProductVersion, + "Invalid MSI package version: '{0}'. " + + "The Windows Installer SDK says that MSI product versions must have a major version less than 256, a minor version less than 256, and a build version less than 65536. " + + "The revision value is ignored but version labels and metadata are not allowed. " + + "Violating the MSI rules sometimes works as expected but the behavior is unpredictable and undefined. "+ + "Future versions of WiX might treat invalid package versions as an error.", + version); + } + public static Message CollidingModularizationTypes(string tableName, string columnName, string foreignTableName, int foreignColumnNumber, string modularizationType, string foreignModularizationType) { return Message(null, Ids.CollidingModularizationTypes, "The definition for the '{0}' table's '{1}' column is a foreign key relationship to the '{2}' table's column number {3}. The modularization types of the two column definitions differ: table '{0}' uses type {4} and table '{2}' uses type {5}. Change one of the modularization types so that they match.", tableName, columnName, foreignTableName, foreignColumnNumber, modularizationType, foreignModularizationType); diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 9b92b271d..a1ec24f48 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -533,7 +533,7 @@ private void ProcessProductVersion(WixPackageSymbol packageSymbol, IntermediateS } else if (validate) { - this.Messaging.Write(ErrorMessages.InvalidProductVersion(packageSymbol.SourceLineNumbers, packageSymbol.Version)); + this.Messaging.Write(WarningMessages.InvalidMsiProductVersion(packageSymbol.SourceLineNumbers, packageSymbol.Version)); } } diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index f160bff68..b25f0b527 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs @@ -1626,7 +1626,7 @@ private bool CheckUpgradeVersion(UpgradeSymbol symbol, string version, out strin } else { - this.Messaging.Write(ErrorMessages.InvalidProductVersion(symbol.SourceLineNumbers, version)); + this.Messaging.Write(WarningMessages.InvalidMsiProductVersion(symbol.SourceLineNumbers, version)); } changedVersion = null; diff --git a/src/wix/WixToolset.Core/Compiler_Patch.cs b/src/wix/WixToolset.Core/Compiler_Patch.cs index bd250ef4c..43e1d2e97 100644 --- a/src/wix/WixToolset.Core/Compiler_Patch.cs +++ b/src/wix/WixToolset.Core/Compiler_Patch.cs @@ -374,7 +374,7 @@ private void ParsePatchFamilyElement(XElement node, ComplexReferenceParentType p } else if (!CompilerCore.IsValidProductVersion(version)) { - this.Core.Write(ErrorMessages.InvalidProductVersion(sourceLineNumbers, version)); + this.Core.Write(WarningMessages.InvalidMsiProductVersion(sourceLineNumbers, version)); } // find unexpected child elements diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Version/PackageWithUndefinedBindVariableVersion.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Version/PackageWithUndefinedBindVariableVersion.wxs new file mode 100644 index 000000000..8e008e0ee --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Version/PackageWithUndefinedBindVariableVersion.wxs @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs index 5d0b69d1d..7d0883f8b 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs @@ -36,11 +36,8 @@ public void FailsOnInvalidVersion() var errorMessages = result.Messages.Where(m => m.Level == MessageLevel.Error) .Select(m => m.ToString()) .ToArray(); - WixAssert.CompareLineByLine(new[] - { - "Invalid product version '1.256.0'. MSI product versions must have a major version less than 256, a minor version less than 256, and a build version less than 65536. The revision value is ignored but version labels and metadata are not allowed.", - }, errorMessages); - Assert.Equal(242, result.ExitCode); + Assert.StartsWith("Invalid MSI package version: '1.256.0'.", errorMessages.Single()); + Assert.Equal(1148, result.ExitCode); } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/VersionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/VersionFixture.cs index facc772d5..cf8466aa1 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/VersionFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/VersionFixture.cs @@ -99,11 +99,8 @@ public void CannotBuildMsiWithExtendedVersion() var errorMessages = result.Messages.Where(m => m.Level == MessageLevel.Error) .Select(m => m.ToString()) .ToArray(); - WixAssert.CompareLineByLine(new[] - { - "Invalid product version 'v4.3.2-preview.1'. MSI product versions must have a major version less than 256, a minor version less than 256, and a build version less than 65536. The revision value is ignored but version labels and metadata are not allowed.", - }, errorMessages); - Assert.Equal(242, result.ExitCode); + Assert.StartsWith("Invalid MSI package version: 'v4.3.2-preview.1'.", errorMessages.Single()); + Assert.Equal(1148, result.ExitCode); } } @@ -118,7 +115,7 @@ public void CannotBuildMsiWithInvalidMajorVersion() var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test1.msi"); - var result = WixRunner.Execute(new[] + var result = WixRunner.Execute(warningsAsErrors: false, new[] { "build", Path.Combine(folder, "Version", "PackageWithReplaceableVersion.wxs"), @@ -128,14 +125,42 @@ public void CannotBuildMsiWithInvalidMajorVersion() "-o", msiPath }); - var errorMessages = result.Messages.Where(m => m.Level == MessageLevel.Error) - .Select(m => m.ToString()) - .ToArray(); - WixAssert.CompareLineByLine(new[] + result.AssertSuccess(); + + var warningMessages = result.Messages.Where(m => m.Level == MessageLevel.Warning).Select(m => m.ToString()).ToArray(); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[0]); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[1]); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[2]); + } + } + + [Fact] + public void CannotBuildMsiWithInvalidBindVariableVersion() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test1.msi"); + + var result = WixRunner.Execute(warningsAsErrors: false, new[] { - "Invalid product version '257.0.0'. MSI product versions must have a major version less than 256, a minor version less than 256, and a build version less than 65536. The revision value is ignored but version labels and metadata are not allowed.", - }, errorMessages); - Assert.Equal(242, result.ExitCode); + "build", + Path.Combine(folder, "Version", "PackageWithUndefinedBindVariableVersion.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-bindvariable", "Version=257.0.0", + "-o", msiPath + }); + + result.AssertSuccess(); + + var warningMessages = result.Messages.Where(m => m.Level == MessageLevel.Warning).Select(m => m.ToString()).ToArray(); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[0]); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[1]); + Assert.StartsWith("Invalid MSI package version: '257.0.0'.", warningMessages[2]); } } From e25aa4354c58d49665517956c0a30b0eaeae7342 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Jun 2023 11:45:10 -0700 Subject: [PATCH 20/49] ProjectReferences to wixlibs should participate in DefineConstants creation Also fix documentation in ResolveWixLibraryReferences target. Fixes 7512 --- .../wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs | 4 ++++ src/wix/WixToolset.Sdk/tools/wix.targets | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs index 508d4721a..75b22b86d 100644 --- a/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs +++ b/src/test/wix/TestData/WixprojPackageVcxprojWindowsApp/Package.wxs @@ -1,3 +1,7 @@ + + + + diff --git a/src/wix/WixToolset.Sdk/tools/wix.targets b/src/wix/WixToolset.Sdk/tools/wix.targets index 0decbbeb0..1ba6746b4 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.targets @@ -331,7 +331,6 @@ - <_WixResolvedProjectReference Remove="@(WixLibrary)" /> @@ -366,11 +365,11 @@ [IN] @(WixLibrary) - the list of .wixlib files. - @(_WixResolvedProjectReference) - resolved project references. $(WixLibrarySearchPaths) - optional search paths used to find .wixlibs. [OUT] - @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries + @(_ResolvedWixLibraryPaths) - Item group with full paths to libraries that were found. + @(_UnresolvedWixLibraryPaths) - Item group with full paths to libraries that were not found. ================================================================================================ --> From 6e6eb47812742cfb61a1c3328ba662ec2886a4e2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 4 Jun 2023 10:47:29 -0700 Subject: [PATCH 21/49] WiX Toolset v4.0.1 --- src/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.txt b/src/version.txt index 110be1f39..1454f6ed4 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.1-build.{height} +4.0.1 From 140abaa1a8629a1f67f41bf549430acc9768ce1b Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 21 Jun 2023 19:53:56 -0400 Subject: [PATCH 22/49] Start WiX Toolset v4.0.2. --- .github/workflows/build.yml | 4 +++- src/version.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e2cb0e1c..3b32174c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,11 +6,13 @@ on: - master - develop - develop-v4.0.1 + - develop402 pull_request: branches: - master - develop - develop-v4.0.1 + - develop402 workflow_dispatch: inputs: tags: @@ -90,5 +92,5 @@ jobs: path: build/logs/ - name: Push to GitHub Packages - if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop-v4.0.1') + if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop-v4.0.1' || github.ref == 'refs/heads/develop402') run: dotnet nuget push "build/artifacts/**/*.nupkg" --source https://nuget.pkg.github.com/wixtoolset/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate diff --git a/src/version.txt b/src/version.txt index 1454f6ed4..7a67432b9 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.1 +4.0.2-build.{height} From ed2a8d1468f58c734903ed9668700921d7deb32a Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 20 Jun 2023 20:09:19 -0400 Subject: [PATCH 23/49] Handle MergeModule.CABinet for extraction. Fixes https://github.com/wixtoolset/issues/issues/7568, --- .../Unbind/ExtractCabinetsCommand.cs | 16 +++++++-- .../DecompileFixture.cs | 34 ++++++++++++------- .../PatchFixture.cs | 2 +- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs index 5ac7efe6d..ba6877c86 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs @@ -29,7 +29,7 @@ public ExtractCabinetsCommand(IFileSystem fileSystem, WindowsInstallerData outpu public Dictionary ExtractedFileIdsWithMediaRow { get; private set; } - private IFileSystem FileSystem { get; } + private IFileSystem FileSystem { get; } private WindowsInstallerData Output { get; } @@ -55,13 +55,23 @@ public void Execute() // index all of the cabinet files if (OutputType.Module == this.Output.Type || this.TreatOutputAsModule) { - embeddedCabinetNamesByDiskId.Add(0, "MergeModule.CABinet"); + var mediaRow = new MediaRow(null, WindowsInstallerTableDefinitions.Media) + { + DiskId = 1, + LastSequence = 1, + Cabinet = "MergeModule.CABinet", + }; + + embeddedCabinetRowsByDiskId.Add(1, mediaRow); + embeddedCabinetNamesByDiskId.Add(1, "MergeModule.CABinet"); } - else if (this.Output.Tables.TryGetTable("Media", out var mediaTable)) + + if (this.Output.Tables.TryGetTable("Media", out var mediaTable)) { foreach (var mediaRow in mediaTable.Rows.Cast().Where(r => !String.IsNullOrEmpty(r.Cabinet))) { if (OutputType.Package == this.Output.Type || + OutputType.Module == this.Output.Type || (OutputType.Transform == this.Output.Type && RowOperation.Add == mediaRow.Operation)) { if (mediaRow.Cabinet.StartsWith("#", StringComparison.Ordinal)) diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index a4915a3a8..6a9de6df3 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs @@ -2,20 +2,22 @@ namespace WixToolsetTest.CoreIntegration { + using System; using System.IO; - using WixInternal.TestSupport; using WixInternal.Core.TestPackage; + using WixInternal.TestSupport; using Xunit; public class DecompileFixture { - private static void DecompileAndCompare(string msiName, string expectedWxsName, params string[] sourceFolder) + private static void DecompileAndCompare(string msiName, bool extract, string expectedWxsName, params string[] sourceFolder) { var folder = TestData.Get(sourceFolder); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); + var extractPath = Path.Combine(intermediateFolder, "$extracted"); var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); var result = WixRunner.Execute(new[] @@ -23,10 +25,18 @@ private static void DecompileAndCompare(string msiName, string expectedWxsName, "msi", "decompile", Path.Combine(folder, msiName), "-intermediateFolder", intermediateFolder, - "-o", outputPath + "-o", outputPath, + extract ? "-x" : String.Empty, + extract ? extractPath : String.Empty, }, out var messages); Assert.Equal(0, result); + Assert.Empty(messages); + + if (extract) + { + Assert.NotEmpty(Directory.EnumerateFiles(extractPath, "*", SearchOption.AllDirectories)); + } WixAssert.CompareXml(Path.Combine(folder, expectedWxsName), outputPath); } @@ -35,19 +45,19 @@ private static void DecompileAndCompare(string msiName, string expectedWxsName, [Fact] public void CanDecompileSingleFileCompressed() { - DecompileAndCompare("example.msi", "Expected.wxs", "TestData", "DecompileSingleFileCompressed"); + DecompileAndCompare("example.msi", extract: true, "Expected.wxs", "TestData", "DecompileSingleFileCompressed"); } [Fact] public void CanDecompile64BitSingleFileCompressed() { - DecompileAndCompare("example.msi", "Expected.wxs", "TestData", "DecompileSingleFileCompressed64"); + DecompileAndCompare("example.msi", extract: true, "Expected.wxs", "TestData", "DecompileSingleFileCompressed64"); } [Fact] public void CanDecompileNestedDirSearchUnderRegSearch() { - DecompileAndCompare("NestedDirSearchUnderRegSearch.msi", "DecompiledNestedDirSearchUnderRegSearch.wxs", "TestData", "AppSearch"); + DecompileAndCompare("NestedDirSearchUnderRegSearch.msi", extract: false, "DecompiledNestedDirSearchUnderRegSearch.wxs", "TestData", "AppSearch"); } [Fact] @@ -56,37 +66,37 @@ public void CanDecompileOldClassTableDefinition() // The input MSI was not created using standard methods, it is an example of a real world database that needs to be decompiled. // The Class/@Feature_ column has length of 32, the File/@Attributes has length of 2, // and numerous foreign key relationships are missing. - DecompileAndCompare("OldClassTableDef.msi", "DecompiledOldClassTableDef.wxs", "TestData", "Class"); + DecompileAndCompare("OldClassTableDef.msi", extract: false, "DecompiledOldClassTableDef.wxs", "TestData", "Class"); } [Fact] public void CanDecompileSequenceTables() { - DecompileAndCompare("SequenceTables.msi", "DecompiledSequenceTables.wxs", "TestData", "SequenceTables"); + DecompileAndCompare("SequenceTables.msi", extract: false, "DecompiledSequenceTables.wxs", "TestData", "SequenceTables"); } [Fact] public void CanDecompileShortcuts() { - DecompileAndCompare("shortcuts.msi", "DecompiledShortcuts.wxs", "TestData", "Shortcut"); + DecompileAndCompare("shortcuts.msi", extract: false, "DecompiledShortcuts.wxs", "TestData", "Shortcut"); } [Fact] public void CanDecompileNullComponent() { - DecompileAndCompare("example.msi", "Expected.wxs", "TestData", "DecompileNullComponent"); + DecompileAndCompare("example.msi", extract: true, "Expected.wxs", "TestData", "DecompileNullComponent"); } [Fact] public void CanDecompileMergeModuleWithTargetDirComponent() { - DecompileAndCompare("MergeModule1.msm", "Expected.wxs", "TestData", "DecompileTargetDirMergeModule"); + DecompileAndCompare("MergeModule1.msm", extract: true, "Expected.wxs", "TestData", "DecompileTargetDirMergeModule"); } [Fact] public void CanDecompileUI() { - DecompileAndCompare("ui.msi", "ExpectedUI.wxs", "TestData", "Decompile"); + DecompileAndCompare("ui.msi", extract: false, "ExpectedUI.wxs", "TestData", "Decompile"); } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index d07793a1f..82dfc7e5d 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs @@ -575,7 +575,7 @@ private static void CreateAdminImage(string msiPath, string targetDir) var args = $"/a \"{Path.ChangeExtension(msiPath, "msi")}\" TARGETDIR=\"{targetDir}\" /qn"; var proc = Process.Start("msiexec.exe", args); - proc.WaitForExit(5000); + proc.WaitForExit(10000); Assert.Equal(0, proc.ExitCode); } From 22dadeafca72b87e75ed697162fa33ccc85723dd Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 29 Jun 2023 21:16:35 -0400 Subject: [PATCH 24/49] Extract object fields with modularization GUIDs. --- .../XunitExtensions/WixAssert.cs | 21 ++++++++++++++++-- .../Unbind/UnbindDatabaseCommand.cs | 8 +++++++ .../Expected.wxs | 5 +++-- .../MergeModule1.msm | Bin 32768 -> 32768 bytes 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs b/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs index 66f831a13..083e34f58 100644 --- a/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs +++ b/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs @@ -4,6 +4,7 @@ namespace WixInternal.TestSupport { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Text; using System.Xml.Linq; @@ -30,8 +31,8 @@ public static void CompareLineByLine(string[] expectedLines, string[] actualLine public static void CompareXml(XContainer xExpected, XContainer xActual) { - var expecteds = xExpected.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}"); - var actuals = xActual.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}"); + var expecteds = ComparableElements(xExpected); + var actuals = ComparableElements(xActual); CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray()); } @@ -44,6 +45,22 @@ public static void CompareXml(string expectedPath, string actualPath) CompareXml(expectedDoc, actualDoc); } + private static IEnumerable ComparableElements(XContainer container) + { + return container.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={ComparableAttribute(a)}"))}"); + } + + private static string ComparableAttribute(XAttribute attribute) + { + switch (attribute.Name.LocalName) + { + case "SourceFile": + return ""; + default: + return attribute.Value; + } + } + /// /// Dynamically skips the test. /// Requires that the test was marked with a fact attribute derived from diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs index 9ad936e4c..cfa532698 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs @@ -146,6 +146,7 @@ private string ProcessTables(WindowsInstallerData output, List exportedF { View validationView = null; string modularizationGuid = null; + string modularizationSuffix = null; try { @@ -204,6 +205,11 @@ private string ProcessTables(WindowsInstallerData output, List exportedF { source = Path.Combine(this.ExportBasePath, tableName, row.GetPrimaryKey('.')); + if (!String.IsNullOrEmpty(modularizationSuffix)) + { + source += modularizationSuffix; + } + Directory.CreateDirectory(Path.Combine(this.ExportBasePath, tableName)); using (var fs = this.FileSystem.OpenFile(null, source, FileMode.Create, FileAccess.Write, FileShare.None)) @@ -238,6 +244,8 @@ private string ProcessTables(WindowsInstallerData output, List exportedF if (null == modularizationGuid) { var match = Modularization.Match(value); + modularizationSuffix = match.Value; + if (match.Success) { modularizationGuid = String.Concat('{', match.Value.Substring(1).Replace('_', '-'), '}'); diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs index 4a89f56b0..501daabb0 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs @@ -1,6 +1,7 @@ - + + @@ -20,4 +21,4 @@ - \ No newline at end of file + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm index a09cab20a7c6c7bc29fba3ad094d00010befee4d..227712a447d7829766880940b6fe917d9bdfaebb 100644 GIT binary patch delta 2165 zcmbVOO>7%Q6y9CCsT23dKnom-wAq$WRZZ+9P3pvU>m*K{GwB9wl z>o%rHF#-vY5Nb0;;s6rK2_Yd>xCbPVKx&KVDIAdaxp1ivNR`T=9FQR48*gGK3Z)V& zefwtLym@ctdo%O4QjsbZ>8j7yyiE{tL>_7`{S8G;E+U<5M zn7x0wS=ip_tl9^@6+OO&V%ur76;^JW7bn=CZ5NqOa*J=X@>3W0a3A~j;)N$V;vMQ7 z=!r8?3hrnTBvFKNCxC#-G$c3Xk7Ksduf?*%uLM^@p1vEQO6Ypr6Y};Q?`sJz$8Yt$ z7FrF8p&OxFL07-4Um9^nI`3XK(AwP;!iTE~!A`Q@In!Oxo9oE_#49CQbGBM`Xe z=|_W;$?gQ?`4~QiffGO+;9f_8lfW2|0FuBsa0-|Jo(59DBv8u=&&(RmK=&;09Pm7F z7I*=85jY2MyA4m(?Fh zYf)Ha%ZbY_u_Cc^Nl0Od-A!J0k9;D$#V(Bp=I?&~W%&49L6gr@(^3sRqI7ly6q)K7 zBdhAUh*Gj=+k?vSV>?^IQ|g=yQ{9RvdD|}b`~4TxIomKai`pHAne$tjJS`B*fBuO7 z!kndGj4X$fMz*9;dC17pBFWK+(%TaVbSm;_HlidG)XY)G0;&YjbETS1XP~=Vkxy@! zQ%8W$YgD&vqG{BucXb7zj+az;W9h-RQ%+RGowSLbC1y6Jnlxh@X1Nw|!ZdOwDV$I> zYMn5&EH&2$V8~`uEH_P;rhT7I{NipJRCQvO+2V9ti_?q|n^gDF+b#2!jd6-RnKw*( zoD{Iaqci#Zc|uf0cD|?7GjiJDNlsJCmg|8U!4ZDQC=?By>bAp8jkmfE^f;@$7z_3e z5A_UmwfFTL?QK88D&*05MIKabomxl@(Jqj()!ntxHJtMm*ZlGZoNbtHj^s;LUb8xQ z($=P&Y$V1}kJ0i3vGWn7Okp%>l*|lP>d2T!HP3RtXW0kShcFp`E%kEk3H$47sB6Ri zIsd%}Q7dDrMc&5gYUB_JPZGT} zOEPxJq-I3fxFs`&ZksBZDdChLx9iEf&k0Hoq~gQr*l4P;!Tx*a;vlb`&oeV^QxDjw z;S|lOmTi_#6Rkw$&AX0Y8R*AiQifqil##JSQsFi@``0t=V9+^lF@svVouarY%1L6| zIOKB8ABIp(GZZ;pE@Jm04(_}fZPRn8|Ezk0d1L1OBbp|i2Uo+pa$HvSpDL0|3PVNFU^QF_et4>nM9YXATM delta 548 zcmYjOJxCl;5Z?EEySGccb4`v^Av}N3Go*N}n&M%^T%v-7T3J|y6oMA6$tma-VwK{& zX+*4!>tb~sz)}Sf1q&e-5fV4w7y~IjzWHWn=6y38$1;v(Jq&}}G)sRz#?s#=ym*);e3qCmQw5(qT0(EH?vQm6bKlOp%iul2uF3@$y1byi? z6{CcrQs*cOy6&7*{(Zq>*SA1qAo!_Dv5+iwe;2-haQ`M;1J+dPSre9SdRE*4=$J~q zD;`&z=Ab}46FTMq^-8#S?nt%tK1H4KRO#yfY%*Xh6KWht|gRX%e zf_K4>zz1NSe~O_`!H?na)6xm;yf;sruKeA>E%N_j_OK7o`jXZxxOoGA#e$vbsdD_plevOwi7r%KONg3OpG^`b$XU|mfc6!@QgpA$lL|7dX Oq@ou|D6g_OaPto?IFBs= From 3d9737dca609345599079c0a378e80c0a1a9cd5f Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 11 Jul 2023 21:19:08 -0400 Subject: [PATCH 25/49] Partial fix for the weirdly broken... IWindowsInstallerDecompileContext.TreatProductAsModule. https://github.com/wixtoolset/issues/issues/7607 --- .../Data/IWindowsInstallerDecompileContext.cs | 3 +- .../Decompile/Decompiler.cs | 8 ++-- .../WindowsInstallerDecompiler.cs | 13 +++++- .../DecompileFixture.cs | 41 +++++++++++++++++++ .../ExpectedModularizationGuids.wxs | 24 +++++++++++ 5 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/ExpectedModularizationGuids.wxs diff --git a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs index 7b974942b..845c89a5f 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs @@ -93,7 +93,8 @@ public interface IWindowsInstallerDecompileContext bool SuppressUI { get; set; } /// - /// Gets or sets whether the decompiler should use module logic on a product output. + /// Gets or sets whether the decompiler should keep modularization + /// GUIDs (true) or remove them (default/false). /// bool TreatProductAsModule { get; set; } } diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 183c319bf..9701f9587 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs @@ -1188,11 +1188,11 @@ private void FinalizeFileTable(TableIndexedCollection tables) var fileName = xFile?.Attribute("Name")?.Value; // set the source (done here because it requires information from the Directory table) - if (OutputType.Module == this.OutputType) + if (OutputType.Module == this.OutputType && !this.TreatProductAsModule) { xFile.SetAttributeValue("Source", String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, fileId, '.', this.ModularizationGuid.Substring(1, 36).Replace('-', '_'))); } - else if (fileCompressed == "yes" || (fileCompressed != "no" && this.Compressed) || (OutputType.Package == this.OutputType && this.TreatProductAsModule)) + else if (fileCompressed == "yes" || (fileCompressed != "no" && this.Compressed) || OutputType.Module == this.OutputType) { xFile.SetAttributeValue("Source", String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, fileId)); } @@ -1898,7 +1898,7 @@ private void FinalizeShortcutTable(TableIndexedCollection tables) private void FinalizeSequenceTables(TableIndexedCollection tables) { // finalize the normal sequence tables - if (OutputType.Package == this.OutputType && !this.TreatProductAsModule) + if (OutputType.Package == this.OutputType) { foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) { @@ -2039,7 +2039,7 @@ private void FinalizeSequenceTables(TableIndexedCollection tables) } } } - else if (OutputType.Module == this.OutputType || this.TreatProductAsModule) // finalize the Module sequence tables + else if (OutputType.Module == this.OutputType) // finalize the Module sequence tables { foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) { diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs index b41876b31..fb560d1c9 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs @@ -92,8 +92,17 @@ private IWindowsInstallerDecompileResult DecompileDatabase(IWindowsInstallerDeco var extractFilesFolder = context.SuppressExtractCabinets || (String.IsNullOrEmpty(context.CabinetExtractFolder) && String.IsNullOrEmpty(context.ExtractFolder)) ? null : String.IsNullOrEmpty(context.CabinetExtractFolder) ? Path.Combine(context.ExtractFolder, "File") : context.CabinetExtractFolder; - var outputType = context.TreatProductAsModule ? OutputType.Module : context.DecompileType; - var unbindCommand = new UnbindDatabaseCommand(this.Messaging, backendHelper, fileSystem, pathResolver, context.DecompilePath, null, outputType, context.ExtractFolder, extractFilesFolder, context.IntermediateFolder, enableDemodularization: true, skipSummaryInfo: false); + // IWindowsInstallerDecompileContext.TreatProductAsModule is broken. So broken, in fact, + // that it's been broken since WiX v3.0 in 2008. It was introduced (according to lore) + // to support Melt, which decompiles merge modules into fragments so you can consume + // merge modules without actually going through the black box that is mergemod.dll. But + // the name is wrong: It's not TreatProductAsModule; if anything it should instead be + // TreatModuleAsProduct, though even that's wrong (because you want a fragment, not a + // product/package). In WiX v5, rename to `KeepModularizeIds` (or something better) to + // reflect the functionality. + var demodularize = !context.TreatProductAsModule; + var sectionType = context.DecompileType; + var unbindCommand = new UnbindDatabaseCommand(this.Messaging, backendHelper, fileSystem, pathResolver, context.DecompilePath, null, sectionType, context.ExtractFolder, extractFilesFolder, context.IntermediateFolder, demodularize, skipSummaryInfo: false); var output = unbindCommand.Execute(); var extractedFilePaths = unbindCommand.ExportedFiles; diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 6a9de6df3..01882feff 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs @@ -3,10 +3,18 @@ namespace WixToolsetTest.CoreIntegration { using System; + using System.Diagnostics; using System.IO; using WixInternal.Core.TestPackage; using WixInternal.TestSupport; + using WixToolset.Core; + using WixToolset.Core.WindowsInstaller; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; using Xunit; + using static NuGet.Packaging.PackagingConstants; public class DecompileFixture { @@ -98,5 +106,38 @@ public void CanDecompileUI() { DecompileAndCompare("ui.msi", extract: false, "ExpectedUI.wxs", "TestData", "Decompile"); } + + [Fact] + public void CanDecompileMergeModuleWithTreatProductAsModule() + { + using (var fs = new DisposableFileSystem()) + { + var intermediateFolder = fs.GetFolder(); + var outputFolder = fs.GetFolder(); + var extractPath = Path.Combine(intermediateFolder, "$extracted"); + var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); + var sourceFolder = TestData.Get("TestData", "DecompileTargetDirMergeModule"); + + var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); + serviceProvider.AddWindowsInstallerBackend(); + var extensionManager = serviceProvider.GetService(); + var context = serviceProvider.GetService(); + + context.Extensions = Array.Empty(); + context.ExtensionData = extensionManager.GetServices(); + context.DecompilePath = Path.Combine(sourceFolder, "MergeModule1.msm"); + context.DecompileType = OutputType.Module; + context.TreatProductAsModule = true; + context.IntermediateFolder = intermediateFolder; + context.ExtractFolder = outputFolder; + context.CabinetExtractFolder = outputFolder; + + var decompiler = serviceProvider.GetService(); + var result = decompiler.Decompile(context); + + result.Document.Save(outputPath); + WixAssert.CompareXml(Path.Combine(sourceFolder, "ExpectedModularizationGuids.wxs"), outputPath); + } + } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/ExpectedModularizationGuids.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/ExpectedModularizationGuids.wxs new file mode 100644 index 000000000..aff9148ca --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/ExpectedModularizationGuids.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 023aa61a85c4ae6683f4858bfe76d1990ec63816 Mon Sep 17 00:00:00 2001 From: chris_bednarski Date: Wed, 2 Aug 2023 19:39:25 +1000 Subject: [PATCH 26/49] fix stack corruption around cbdata when adding a machine certificate --- src/ext/Iis/ca/scacertexec.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ext/Iis/ca/scacertexec.cpp b/src/ext/Iis/ca/scacertexec.cpp index 95870c79b..352644afe 100644 --- a/src/ext/Iis/ca/scacertexec.cpp +++ b/src/ext/Iis/ca/scacertexec.cpp @@ -154,7 +154,7 @@ static HRESULT ExecuteCertificateOperation( LPWSTR pwzPFXPassword = NULL; LPWSTR pwzFilePath = NULL; BYTE* pbData = NULL; - DWORD cbData = 0; + DWORD_PTR cbData = 0; DWORD_PTR cbPFXPassword = 0; BOOL fUserStoreLocation = (CERT_SYSTEM_STORE_CURRENT_USER == dwStoreLocation); @@ -174,7 +174,7 @@ static HRESULT ExecuteCertificateOperation( ExitOnFailure(hr, "Failed to parse certificate attribute"); if (SCA_ACTION_INSTALL == saAction) // install operations need more data { - hr = WcaReadStreamFromCaData(&pwz, &pbData, (DWORD_PTR*)&cbData); + hr = WcaReadStreamFromCaData(&pwz, &pbData, &cbData); ExitOnFailure(hr, "Failed to parse certificate stream."); hr = WcaReadStringFromCaData(&pwz, &pwzPFXPassword); @@ -192,7 +192,7 @@ static HRESULT ExecuteCertificateOperation( // CertAddCertificateContextToStore(CERT_STORE_ADD_REPLACE_EXISTING) does not remove the private key if the cert is replaced UninstallCertificatePackage(hCertStore, fUserStoreLocation, pwzName); - hr = InstallCertificatePackage(hCertStore, fUserStoreLocation, pwzName, pbData, cbData, iAttributes & SCA_CERT_ATTRIBUTE_VITAL, pwzPFXPassword); + hr = InstallCertificatePackage(hCertStore, fUserStoreLocation, pwzName, pbData, (DWORD)cbData, iAttributes & SCA_CERT_ATTRIBUTE_VITAL, pwzPFXPassword); ExitOnFailure(hr, "Failed to install certificate."); } else From b5b3a63ca7e7b0fd0784182ff6be7878328068b7 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 29 Jul 2023 20:57:14 -0400 Subject: [PATCH 27/49] Remove legacy permissions support. In the long ago, a share could have one user/permissions pair. That's really limited, of course, so support for _n_ user/permissions pairs was added. In the move to WiX v4, support for that single, legacy user was removed from the extension side but not the custom action side. Remove that support. Fixes https://github.com/wixtoolset/issues/issues/7632. --- src/ext/Util/ca/scasmb.h | 3 -- src/ext/Util/ca/scasmbsched.cpp | 50 +++------------------------------ 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/src/ext/Util/ca/scasmb.h b/src/ext/Util/ca/scasmb.h index f2a4b53cd..7169cf2b8 100644 --- a/src/ext/Util/ca/scasmb.h +++ b/src/ext/Util/ca/scasmb.h @@ -23,14 +23,11 @@ struct SCA_SMB // hungarian ss WCHAR wzDirectory[MAX_PATH + 1]; int nUserPermissionCount; - int nPermissions; SCA_SMB_EX_USER_PERMS* pExUserPerms; INSTALLSTATE isInstalled, isAction; BOOL fUseIntegratedAuth; - BOOL fLegacyUserProvided; - struct SCA_USER scau; struct SCA_SMB* pssNext; }; diff --git a/src/ext/Util/ca/scasmbsched.cpp b/src/ext/Util/ca/scasmbsched.cpp index 53e8400da..fefd4781b 100644 --- a/src/ext/Util/ca/scasmbsched.cpp +++ b/src/ext/Util/ca/scasmbsched.cpp @@ -92,17 +92,14 @@ void ScaExUserPermsSmbFreeList(SCA_SMB_EX_USER_PERMS* pExUserPermsList) } // sql query constants -LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Description`, `Directory_`, " - L"`Component_`, `User_`, `Permissions` FROM `Wix4FileShare`"; +LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Component_`, `Description`, `Directory_` FROM `Wix4FileShare`"; enum eSmbQuery { ssqFileShare = 1, ssqShareName, + ssqComponent, ssqDescription, ssqDirectory, - ssqComponent, - ssqUser, - ssqPermissions }; @@ -173,31 +170,11 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList) hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData); ExitOnFailure(hr, "Failed to copy description string to smb object"); - // get user info from the user table - hr = WcaGetRecordFormattedString(hRec, ssqUser, &pwzData); - ExitOnFailure(hr, "Failed to get Wix4User record for Wix4FileShare: '%ls'", pss->wzShareName); - // get component install state er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction); hr = HRESULT_FROM_WIN32(er); ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare"); - // if a user was specified - if (*pwzData) - { - pss->fUseIntegratedAuth = FALSE; - pss->fLegacyUserProvided = TRUE; - hr = ScaGetUser(pwzData, &pss->scau); - ExitOnFailure(hr, "Failed to get user information for fileshare: '%ls'", pss->wzShareName); - } - else - { - pss->fLegacyUserProvided = FALSE; - // TODO: figure out whether this is useful still - //pss->fUseIntegratedAuth = TRUE; - // integrated authorization doesn't have a User record - } - // get the share's directory hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData); ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName); @@ -235,9 +212,6 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList) hr = ::StringCchCopyW(pss->wzDirectory, countof(pss->wzDirectory), wzPath); ExitOnFailure(hr, "Failed to copy directory string to smb object"); - hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions); - ExitOnFailure(hr, "Failed to get Wix4FileShare.Permissions"); - // Check to see if additional user & permissions are specified for this share if (bUserPermissionsTableExists) { @@ -378,24 +352,8 @@ HRESULT SchedCreateSmb(SCA_SMB* pss) hr = WcaWriteStringToCaData(pss->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData); ExitOnFailure(hr, "Failed to add server name to CustomActionData"); - if (pss->fLegacyUserProvided) - { - hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount + 1, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); - - hr = UserBuildDomainUserName(wzDomainUser, countof(wzDomainUser), pss->scau.wzName, pss->scau.wzDomain); - ExitOnFailure(hr, "Failed to build user and domain name for CustomActionData"); - hr = WcaWriteStringToCaData(wzDomainUser, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add server Domain\\UserName to CustomActionData"); - - hr = WcaWriteIntegerToCaData(pss->nPermissions, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add permissions to CustomActionData"); - } - else - { - hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); - } + hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData); + ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); if (pss->nUserPermissionCount > 0) { From 1ef2fac522e39384fd8379256b9ce9ef750e18c9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 7 Aug 2023 12:07:39 -0700 Subject: [PATCH 28/49] Ensure the Font actions are scheduled for TrueType fonts TrueType fonts are denoted by the empty string in the FontTitle field of the FileSymbol. That means a non-null FontTitle field value means a font is being installed. Fixes 7593 --- .../Bind/CreateWindowsInstallerDataFromIRCommand.cs | 2 ++ .../Bind/SequenceActionsCommand.cs | 4 +++- .../MsiQueryFixture.cs | 12 ++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index b25f0b527..18914745f 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs @@ -678,6 +678,8 @@ private void AddFileSymbol(FileSymbol symbol) attributes |= (symbol.Attributes & FileSymbolAttributes.Vital) == FileSymbolAttributes.Vital ? WindowsInstallerConstants.MsidbFileAttributesVital : 0; row.Attributes = attributes; + // Note that TrueType fonts are denoted by the empty string in the FontTitle + // field. So, non-null means a font is present. if (symbol.FontTitle != null) { var fontRow = this.CreateRow(symbol, "Font"); diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs index 4a5319b3d..39d5680ba 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs @@ -446,7 +446,9 @@ private IEnumerable GetRequiredActionIds() var foundBindPath = false; foreach (var file in this.Section.Symbols.OfType()) { - if (!foundFont && !String.IsNullOrEmpty(file.FontTitle)) + // Note that TrueType fonts are denoted by the empty string in the FontTitle + // field. So, non-null means a font is present. + if (!foundFont && file.FontTitle != null) { set.Add("InstallExecuteSequence/RegisterFonts"); set.Add("InstallExecuteSequence/UnregisterFonts"); diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 006610d13..7160bf73a 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -488,11 +488,13 @@ public void PopulatesFontTableFromFontTitle() result.AssertSuccess(); Assert.True(File.Exists(msiPath)); - var results = Query.QueryDatabase(msiPath, new[] { "Font" }); + var results = Query.QueryDatabase(msiPath, new[] { "Font", "InstallExecuteSequence" }); WixAssert.CompareLineByLine(new[] { "Font:test.txt\tFakeFont", - }, results); + "InstallExecuteSequence:RegisterFonts\t\t5300", + "InstallExecuteSequence:UnregisterFonts\t\t2500", + }, results.Where(l => l.Contains("Font")).ToArray()); } } @@ -521,11 +523,13 @@ public void PopulatesFontTableFromTrueType() result.AssertSuccess(); Assert.True(File.Exists(msiPath)); - var results = Query.QueryDatabase(msiPath, new[] { "Font" }); + var results = Query.QueryDatabase(msiPath, new[] { "Font", "InstallExecuteSequence" }); WixAssert.CompareLineByLine(new[] { "Font:TrueTypeFontFile\t", - }, results); + "InstallExecuteSequence:RegisterFonts\t\t5300", + "InstallExecuteSequence:UnregisterFonts\t\t2500", + }, results.Where(l => l.Contains("Font")).ToArray()); } } From 205215078d3b7bd9c7459307bc792d52ec404760 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 7 Aug 2023 15:43:10 -0700 Subject: [PATCH 29/49] Fix the use of ModuleSubstitution table Addresses two issues in the creation of configurable merge modules. First, the ModuleConfiguration table Id should not be modularized. Second, the ModuleSubstitution table was never created. Fixing both of those allows configurable merge modules to work again. Fixes 7559 --- .../WindowsInstallerTableDefinitions.cs | 2 +- .../Bind/BindDatabaseCommand.cs | 7 ++- ...CreateWindowsInstallerDataFromIRCommand.cs | 1 + .../ModuleFixture.cs | 58 +++++++++++++++++++ .../Module/MergeModuleSubstitution.wxs | 17 ++++++ .../TestData/Module/ModuleSubstitution.wxs | 11 ++++ 6 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/MergeModuleSubstitution.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs index b0fde6a71..9f0cdd96f 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs @@ -1455,7 +1455,7 @@ public static class WindowsInstallerTableDefinitions SymbolDefinitions.ModuleConfiguration, new[] { - new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Unique identifier for this row."), + new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Unique identifier for this row.", modularizeType: ColumnModularizeType.None), new ColumnDefinition("Format", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 0, maxValue: 3, description: "Format of this item."), new ColumnDefinition("Type", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional type information for this item."), new ColumnDefinition("ContextData", ColumnType.Localized, 0, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional context information about this item."), diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index a1ec24f48..4db1bfbed 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -58,7 +58,7 @@ public BindDatabaseCommand(IBindContext context, IEnumerable + + + + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs new file mode 100644 index 000000000..0ada31b9e --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + From 70096fc3dbcc32edf311d3c22d713d4b8fbf7baf Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 15 Aug 2023 18:05:47 -0400 Subject: [PATCH 30/49] Properly fragment NetFx custom actions. FIxes https://github.com/wixtoolset/issues/issues/7677. --- .../NetfxExtensionFixture.cs | 17 ----------------- .../NetFx/wixlib/NetFxExtension_Platform.wxi | 16 +++++++++++----- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs index aebfe9f41..bb3b7b35f 100644 --- a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs @@ -117,11 +117,7 @@ public void CanBuildUsingNativeImage() var results = build.BuildAndQuery(Build, "Binary", "CustomAction", "Wix4NetFxNativeImage"); WixAssert.CompareLineByLine(new[] { - "Binary:Wix4NetCheck_arm64\t[Binary data]", - "Binary:Wix4NetCheck_x64\t[Binary data]", - "Binary:Wix4NetCheck_x86\t[Binary data]", "Binary:Wix4NetFxCA_X86\t[Binary data]", - "CustomAction:Wix4NetFxDotNetCompatibilityCheck_X86\t1\tWix4NetFxCA_X86\tDotNetCompatibilityCheck\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitInstall_X86\t3649\tWix4NetFxCA_X86\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitUninstall_X86\t3649\tWix4NetFxCA_X86\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageInstall_X86\t3137\tWix4NetFxCA_X86\tExecNetFx\t", @@ -140,11 +136,7 @@ public void CanBuildUsingNativeImageX64() var results = build.BuildAndQuery(BuildX64, "Binary", "CustomAction", "Wix4NetFxNativeImage"); WixAssert.CompareLineByLine(new[] { - "Binary:Wix4NetCheck_arm64\t[Binary data]", - "Binary:Wix4NetCheck_x64\t[Binary data]", - "Binary:Wix4NetCheck_x86\t[Binary data]", "Binary:Wix4NetFxCA_X64\t[Binary data]", - "CustomAction:Wix4NetFxDotNetCompatibilityCheck_X64\t1\tWix4NetFxCA_X64\tDotNetCompatibilityCheck\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitInstall_X64\t3649\tWix4NetFxCA_X64\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitUninstall_X64\t3649\tWix4NetFxCA_X64\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageInstall_X64\t3137\tWix4NetFxCA_X64\tExecNetFx\t", @@ -163,11 +155,7 @@ public void CanBuildUsingNativeImageARM64() var results = build.BuildAndQuery(BuildARM64, "Binary", "CustomAction", "Wix4NetFxNativeImage"); WixAssert.CompareLineByLine(new[] { - "Binary:Wix4NetCheck_arm64\t[Binary data]", - "Binary:Wix4NetCheck_x64\t[Binary data]", - "Binary:Wix4NetCheck_x86\t[Binary data]", "Binary:Wix4NetFxCA_A64\t[Binary data]", - "CustomAction:Wix4NetFxDotNetCompatibilityCheck_A64\t1\tWix4NetFxCA_A64\tDotNetCompatibilityCheck\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitInstall_A64\t3649\tWix4NetFxCA_A64\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageCommitUninstall_A64\t3649\tWix4NetFxCA_A64\tExecNetFx\t", "CustomAction:Wix4NetFxExecuteNativeImageInstall_A64\t3137\tWix4NetFxCA_A64\tExecNetFx\t", @@ -191,11 +179,6 @@ public void CanBuildUsingDotNetCompatibilityCheck() "Binary:Wix4NetCheck_x86\t[Binary data]", "Binary:Wix4NetFxCA_X64\t[Binary data]", "CustomAction:Wix4NetFxDotNetCompatibilityCheck_X64\t1\tWix4NetFxCA_X64\tDotNetCompatibilityCheck\t", - "CustomAction:Wix4NetFxExecuteNativeImageCommitInstall_X64\t3649\tWix4NetFxCA_X64\tExecNetFx\t", - "CustomAction:Wix4NetFxExecuteNativeImageCommitUninstall_X64\t3649\tWix4NetFxCA_X64\tExecNetFx\t", - "CustomAction:Wix4NetFxExecuteNativeImageInstall_X64\t3137\tWix4NetFxCA_X64\tExecNetFx\t", - "CustomAction:Wix4NetFxExecuteNativeImageUninstall_X64\t3137\tWix4NetFxCA_X64\tExecNetFx\t", - "CustomAction:Wix4NetFxScheduleNativeImage_X64\t1\tWix4NetFxCA_X64\tSchedNetFx\t", "Wix4NetFxDotNetCheck:DotNetCoreCheckManualId\tMicrosoft.NETCore.App\tx64\t7.0.1\tLatestMajor\tDOTNETCORECHECKRESULT", }, results.OrderBy(s => s).ToArray()); } diff --git a/src/ext/NetFx/wixlib/NetFxExtension_Platform.wxi b/src/ext/NetFx/wixlib/NetFxExtension_Platform.wxi index 81746db19..ddafe7693 100644 --- a/src/ext/NetFx/wixlib/NetFxExtension_Platform.wxi +++ b/src/ext/NetFx/wixlib/NetFxExtension_Platform.wxi @@ -10,7 +10,6 @@ - @@ -18,17 +17,24 @@ + + + + + + + + + + + - - - - From 5fa73084c66505c8274d64cc4bf2b72e416a01a6 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 5 Sep 2023 06:27:10 -0700 Subject: [PATCH 31/49] Correctly process build -outputType switch Also add a few additional output types to built-in backends. Fixes 7708 --- .../DependencyTests/PatchA/PatchA.wixproj | 2 +- .../DependencyTests/PatchB/PatchB.wixproj | 2 +- .../PatchTests/PatchA2/PatchA2.wixproj | 4 +-- .../SlipstreamTests/PatchA/PatchA.wixproj | 4 +-- .../SlipstreamTests/PatchAB/PatchAB.wixproj | 4 +-- .../SlipstreamTests/PatchAB2/PatchAB2.wixproj | 4 +-- .../BurnBackendFactory.cs | 1 + .../WindowsInstallerBackendFactory.cs | 4 +++ src/wix/WixToolset.Core/BindContext.cs | 2 ++ src/wix/WixToolset.Core/Binder.cs | 15 +++++++-- .../CommandLine/BuildCommand.cs | 5 +++ src/wix/WixToolset.Core/CoreErrors.cs | 6 ++++ .../BadInputFixture.cs | 33 +++++++++++++++++++ 13 files changed, 73 insertions(+), 13 deletions(-) diff --git a/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj b/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj index 4809934d4..bf20b7087 100644 --- a/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj +++ b/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 diff --git a/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj b/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj index c099f0083..5fbdd549f 100644 --- a/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj +++ b/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 diff --git a/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj b/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj index da9acb5e0..3deb22636 100644 --- a/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj +++ b/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 @@ -9,4 +9,4 @@ - \ No newline at end of file + diff --git a/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj index da9acb5e0..3deb22636 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 @@ -9,4 +9,4 @@ - \ No newline at end of file + diff --git a/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj index 81fa9e124..5f9ee5f66 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj index 81fa9e124..5f9ee5f66 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj @@ -1,7 +1,7 @@ - PatchCreation + Patch .msp 1079 @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs b/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs index 03013a086..63f522006 100644 --- a/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs +++ b/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs @@ -18,6 +18,7 @@ public bool TryCreateBackend(string outputType, string outputFile, out IBackend switch (outputType.ToLowerInvariant()) { case "bundle": + case "burn": case ".exe": backend = new BundleBackend(); return true; diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs index d14743e9e..42e1a45db 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs @@ -18,6 +18,7 @@ public bool TryCreateBackend(string outputType, string outputFile, out IBackend switch (outputType?.ToLowerInvariant()) { case "module": + case "msm": case ".msm": backend = new MsmBackend(); return true; @@ -25,11 +26,14 @@ public bool TryCreateBackend(string outputType, string outputFile, out IBackend case "msipackage": case "package": case "product": + case "msi": case ".msi": backend = new MsiBackend(); return true; + case "msppackage": case "patch": + case "msp": case ".msp": backend = new MspBackend(); return true; diff --git a/src/wix/WixToolset.Core/BindContext.cs b/src/wix/WixToolset.Core/BindContext.cs index 1c1f7528f..50ccdec69 100644 --- a/src/wix/WixToolset.Core/BindContext.cs +++ b/src/wix/WixToolset.Core/BindContext.cs @@ -42,6 +42,8 @@ internal BindContext(IServiceProvider serviceProvider) public string OutputPath { get; set; } + public string OutputType { get; set; } + public PdbType PdbType { get; set; } public string PdbPath { get; set; } diff --git a/src/wix/WixToolset.Core/Binder.cs b/src/wix/WixToolset.Core/Binder.cs index 204ab6eec..fd6e1470d 100644 --- a/src/wix/WixToolset.Core/Binder.cs +++ b/src/wix/WixToolset.Core/Binder.cs @@ -58,18 +58,27 @@ private IBindResult BackendBind(IBindContext context) var backendFactories = extensionManager.GetServices(); - var entrySection = context.IntermediateRepresentation.Sections.First(); + var outputType = context is BindContext bindContext ? bindContext.OutputType : null; + + if (String.IsNullOrEmpty(outputType)) + { + var entrySection = context.IntermediateRepresentation.Sections.First(); + + outputType = entrySection.Type.ToString(); + } foreach (var factory in backendFactories) { - if (factory.TryCreateBackend(entrySection.Type.ToString(), context.OutputPath, out var backend)) + if (factory.TryCreateBackend(outputType, context.OutputPath, out var backend)) { var result = backend.Bind(context); return result; } } - // TODO: messaging that a backend could not be found to bind the output type? + var messaging = context.ServiceProvider.GetService(); + + messaging.Write(CoreErrors.BackendNotFound(outputType, context.OutputPath)); return null; } diff --git a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs index 965280d0e..9ed68d811 100644 --- a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs @@ -316,6 +316,11 @@ private void BindPhase(Intermediate output, IReadOnlyCollection lo context.PdbPath = inputsOutputs.PdbPath; context.CancellationToken = cancellationToken; + if (context is BindContext bindContext) + { + bindContext.OutputType = this.commandLine.OutputType; + } + var binder = this.ServiceProvider.GetService(); bindResult = binder.Bind(context); } diff --git a/src/wix/WixToolset.Core/CoreErrors.cs b/src/wix/WixToolset.Core/CoreErrors.cs index 6dbd6c885..16feb9dc8 100644 --- a/src/wix/WixToolset.Core/CoreErrors.cs +++ b/src/wix/WixToolset.Core/CoreErrors.cs @@ -26,6 +26,11 @@ public static Message UnableToOpenFile(SourceLineNumber sourceLineNumbers, strin return Message(sourceLineNumbers, Ids.UnableToOpenFile, "Unable to open file: {0}. Error detail: {1}", path, detail); } + public static Message BackendNotFound(string outputType, string outputPath) + { + return Message(null, Ids.BackendNotFound, "Unable to find a backend to process output type: {0} for output file: {1}. Specify a different output type or output file extension.", outputType, outputPath); + } + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) { return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); @@ -37,6 +42,7 @@ public enum Ids UnableToDeleteFile = 7011, UnableToMoveFile = 7012, UnableToOpenFile = 7013, + BackendNotFound = 7014, } // last available is 7099. 7100 is WindowsInstallerBackendWarnings. } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index f571d13b0..ce28faff1 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs @@ -221,6 +221,39 @@ public void CannotBuildBundleWithReservedVariableNames() } } + [Fact] + public void CannotBuildWithUnknownOutputType() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var outputPath = Path.Combine(intermediateFolder, @"test.pkg"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "SimplePackage", "SimplePackage.wxs"), + "-intermediateFolder", intermediateFolder, + "-bindpath", Path.Combine(folder, ".Data"), + "-outputType", "invalid", + "-o", outputPath, + }); + + var messages = result.Messages.Select(m => m.ToString()).ToList(); + messages.Sort(); + + WixAssert.CompareLineByLine(new[] + { + @"Unable to find a backend to process output type: invalid for output file: \test.pkg. Specify a different output type or output file extension.", + }, messages.Select(s => s.Replace(intermediateFolder, "")).ToArray()); + + Assert.Equal(7014, result.ExitCode); + } + } + [Fact] public void GuardsAgainstVariousBundleValuesFromLoc() { From f8fa3bd2405759b7d77e0a85f917b880828e6cbf Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 12 Sep 2023 14:08:34 -0700 Subject: [PATCH 32/49] Update to latest signing infrastructure Fixes 7546 --- .github/workflows/build.yml | 20 ++++++++- src/Directory.Build.targets | 42 ++++++++----------- .../SetBuildNumber/SetBuildNumber.proj | 9 +--- src/signing-empty-file-list.txt | 1 + src/signing.json | 13 ------ 5 files changed, 37 insertions(+), 48 deletions(-) create mode 100644 src/signing-empty-file-list.txt delete mode 100644 src/signing.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b32174c0..69d3929ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,8 @@ jobs: build: name: Build runs-on: windows-2022 + permissions: + id-token: write steps: - name: Checkout code uses: actions/checkout@v3 @@ -38,6 +40,11 @@ jobs: # shell: cmd # run: ./src/vs_config.cmd + - name: Install sign tool + if: (github.ref == 'refs/heads/master') + shell: cmd + run: dotnet tool install --tool-path build\.tools sign --version 0.9.1-beta.23356.1 + - name: Configure automated logging and crash dumps shell: cmd run: | @@ -50,13 +57,22 @@ jobs: reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpCount /d 10 /f reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpType /d 1 + - name: 'Az CLI login' + if: (github.ref == 'refs/heads/master') + uses: azure/login@v1 + with: + allow-no-subscriptions: true + client-id: ${{ secrets.WIX_SIGNING_CLIENTID }} + tenant-id: ${{ secrets.WIX_SIGNING_TENANTID }} + subscription-id: ${{ secrets.WIX_SIGNING_SUBSCRIPTIONID }} + - name: Build wix4 shell: cmd run: ./src/build_official.cmd env: RuntimeTestsEnabled: true - SigningUser: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_USER || '' }} - SigningSecret: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_SECRET || '' }} + SigningVaultUri: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_VAULTURI || '' }} + SigningCertName: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_CERTNAME || '' }} - name: Validate test results shell: cmd diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 0dd56353c..74a381baf 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -4,9 +4,9 @@ $(ToolsFolder) - $(SigningToolFolder)\SignClient.exe - $(SigningToolFolder)\empty-filelist.txt - $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), signing.json))\signing.json + $(SigningToolFolder)\sign.exe + $(MSBuildThisFileDirectory)signing-empty-file-list.txt + --description "WiX Toolset" --description-url "https://wixtoolset.org/" --timestamp-url "http://timestamp.digicert.com" --file-list "$(SigningFilelist)" --azure-key-vault-managed-identity true --azure-key-vault-url "$(SigningVaultUri)" --azure-key-vault-certificate "$(SigningCertName)" @@ -113,47 +113,39 @@ - - - - - - - - - + - - + - + - - - + + - - - + + - diff --git a/src/internal/SetBuildNumber/SetBuildNumber.proj b/src/internal/SetBuildNumber/SetBuildNumber.proj index 5e5bf564e..6f1011188 100644 --- a/src/internal/SetBuildNumber/SetBuildNumber.proj +++ b/src/internal/SetBuildNumber/SetBuildNumber.proj @@ -22,8 +22,7 @@ GitThisAssembly; SetGlobalJson; SetDirectoryPackagesProps; - SetOverallWixVersions; - InstallSigningClient + SetOverallWixVersions $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\..\..\global.json)) @@ -106,12 +105,6 @@ - - - - diff --git a/src/signing-empty-file-list.txt b/src/signing-empty-file-list.txt new file mode 100644 index 000000000..246cc9b6c --- /dev/null +++ b/src/signing-empty-file-list.txt @@ -0,0 +1 @@ +this-file-prevents-files-from-being-signed-in-nupkgs \ No newline at end of file diff --git a/src/signing.json b/src/signing.json deleted file mode 100644 index fe1c8c9b1..000000000 --- a/src/signing.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "SignClient": { - "AzureAd": { - "AADInstance": "https://login.microsoftonline.com/", - "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", - "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" - }, - "Service": { - "Url": "https://codesign.dotnetfoundation.org/", - "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" - } - } -} From 644ed0118bae1aa885bb6cc906dc6c0b904de4d9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 12 Sep 2023 15:18:19 -0700 Subject: [PATCH 33/49] WiX Toolset v4.0.2 --- src/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.txt b/src/version.txt index 7a67432b9..4d54daddb 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.2-build.{height} +4.0.2 From 646f43b1258ec8f0f45b11ecaf7121b620b3b616 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 2 Nov 2023 23:07:53 -0700 Subject: [PATCH 34/49] Start WiX Toolset v4.0.3 --- .github/workflows/build.yml | 8 +++----- src/version.txt | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69d3929ef..7b6d4f3c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,14 +5,12 @@ on: branches: - master - develop - - develop-v4.0.1 - - develop402 + - develop403 pull_request: branches: - master - develop - - develop-v4.0.1 - - develop402 + - develop403 workflow_dispatch: inputs: tags: @@ -108,5 +106,5 @@ jobs: path: build/logs/ - name: Push to GitHub Packages - if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop-v4.0.1' || github.ref == 'refs/heads/develop402') + if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop403') run: dotnet nuget push "build/artifacts/**/*.nupkg" --source https://nuget.pkg.github.com/wixtoolset/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate diff --git a/src/version.txt b/src/version.txt index 4d54daddb..e40fdfa19 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.2 +4.0.3-build.{height} From 2781774e3f67bad1bef68e6ed32ab301179de531 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 6 Nov 2023 23:08:10 -0800 Subject: [PATCH 35/49] Avoid use of Encoding.WindowsCodePage Fixes 7612 --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 6 +-- .../Bind/CreateIdtFileCommand.cs | 2 +- .../EncodingFixture.cs | 44 +++++++++++++++++++ .../TestData/Encoding/Encoding.wxs | 14 ++++++ 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index bc63247e0..77433e6d6 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -867,12 +867,12 @@ public static Message IllegalCharactersInPath(string pathName) public static Message IllegalCodepage(int codepage) { - return Message(null, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(null, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message IllegalCodepage(SourceLineNumber sourceLineNumbers, int codepage) { - return Message(sourceLineNumbers, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(sourceLineNumbers, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message IllegalCodepageAttribute(SourceLineNumber sourceLineNumbers, string codepage, string elementName, string attributeName) @@ -1318,7 +1318,7 @@ public static Message InvalidSequenceTable(string sequenceTableName) public static Message InvalidStringForCodepage(SourceLineNumber sourceLineNumbers, string codepage) { - return Message(sourceLineNumbers, Ids.InvalidStringForCodepage, "A string was provided with characters that are not available in the specified database code page '{0}'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(sourceLineNumbers, Ids.InvalidStringForCodepage, "A string was provided with characters that are not available in the specified database code page '{0}'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message InvalidStubExe(string filename) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs index 89fc81dbf..28bcfd4a4 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs @@ -81,7 +81,7 @@ private void TableToIdtDefinition(Table table, StreamWriter writer, bool keepAdd } catch (EncoderFallbackException) { - this.Messaging.Write(ErrorMessages.InvalidStringForCodepage(row.SourceLineNumbers, Convert.ToString(writer.Encoding.WindowsCodePage, CultureInfo.InvariantCulture))); + this.Messaging.Write(ErrorMessages.InvalidStringForCodepage(row.SourceLineNumbers, Convert.ToString(writer.Encoding.CodePage, CultureInfo.InvariantCulture))); rowBytes = convertEncoding.GetBytes(rowString); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs new file mode 100644 index 000000000..f02cba75e --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs @@ -0,0 +1,44 @@ +// 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 Xunit; + + public class EncodingFixture + { + [Fact] + public void PopulatesAppIdTableWhenAdvertised() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin", "test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Encoding", "Encoding.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + var errors = result.Messages.Where(m => m.Level == MessageLevel.Error).Select(m => m.ToString().Replace(folder, "")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + "A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + "A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + }, errors); + } + } + } +} diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs new file mode 100644 index 000000000..94ca33b32 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + From 1e6697673d0d1bad77cbd6ef11ece45cf6aeac28 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 6 Nov 2023 22:36:57 -0800 Subject: [PATCH 36/49] Correctly handle top-level AppId element Fixes 7738 --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 2 +- src/wix/WixToolset.Core/Compiler.cs | 2 +- .../AppIdFixture.cs | 76 +++++++++++++++++++ .../MsiQueryFixture.cs | 33 -------- .../TestData/AppId/TopLevelAppId.wxs | 19 +++++ 5 files changed, 97 insertions(+), 35 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/AppIdFixture.cs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/AppId/TopLevelAppId.wxs diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index 77433e6d6..7cb0f4f9a 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -55,7 +55,7 @@ public static Message AdvertiseStateMustMatch(SourceLineNumber sourceLineNumbers public static Message AppIdIncompatibleAdvertiseState(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string value, string parentValue) { - return Message(sourceLineNumbers, Ids.AppIdIncompatibleAdvertiseState, "The {0}/@(1) attribute's value, '{2}' does not match the advertise state on its parent element: '{3}'. (Note: AppIds nested under Fragment, Module, or Product elements must be advertised.)", elementName, attributeName, value, parentValue); + return Message(sourceLineNumbers, Ids.AppIdIncompatibleAdvertiseState, "The {0}/@(1) attribute's value, '{2}' does not match the advertise state on its parent element: '{3}'. (Note: AppIds nested under Fragment, Module, or Package elements must be advertised.)", elementName, attributeName, value, parentValue); } public static Message BaselineRequired() diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 36fd35b22..6063d4630 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -514,7 +514,7 @@ private void ParseAppIdElement(XElement node, string componentId, YesNoType adve { this.Core.Write(ErrorMessages.AppIdIncompatibleAdvertiseState(sourceLineNumbers, node.Name.LocalName, "Advertise", appIdAdvertise.ToString(), advertise.ToString())); } - else + else if (appIdAdvertise != YesNoType.NotSet) { advertise = appIdAdvertise; } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/AppIdFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/AppIdFixture.cs new file mode 100644 index 000000000..7d7fe07ac --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/AppIdFixture.cs @@ -0,0 +1,76 @@ +// 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 WixInternal.Core.TestPackage; + using WixInternal.TestSupport; + using Xunit; + + public class AppIdFixture + { + [Fact] + public void PopulatesAppIdTableAtTopLevel() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin", "test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppId", "TopLevelAppId.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); + WixAssert.CompareLineByLine(new[] + { + "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", + }, results); + } + } + + [Fact] + public void PopulatesAppIdTableWhenAdvertised() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin", "test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "AppId", "Advertised.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); + WixAssert.CompareLineByLine(new[] + { + "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", + }, results); + } + } + } +} diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 7160bf73a..945e2133e 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -12,39 +12,6 @@ namespace WixToolsetTest.CoreIntegration public class MsiQueryFixture { - [Fact] - public void PopulatesAppIdTableWhenAdvertised() - { - var folder = TestData.Get(@"TestData"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var intermediateFolder = Path.Combine(baseFolder, "obj"); - var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); - - var result = WixRunner.Execute(new[] - { - "build", - Path.Combine(folder, "AppId", "Advertised.wxs"), - Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), - Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), - "-bindpath", Path.Combine(folder, "SingleFile", "data"), - "-intermediateFolder", intermediateFolder, - "-o", msiPath - }); - - result.AssertSuccess(); - - Assert.True(File.Exists(msiPath)); - var results = Query.QueryDatabase(msiPath, new[] { "AppId" }); - WixAssert.CompareLineByLine(new[] - { - "AppId:{D6040299-B15C-4C94-AE26-0C9B60D14C35}\t\t\t\t\t\t", - }, results); - } - } - [Fact] public void PopulatesAppSearchTablesFromComponentSearch() { diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AppId/TopLevelAppId.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AppId/TopLevelAppId.wxs new file mode 100644 index 000000000..25c0f1763 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AppId/TopLevelAppId.wxs @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + From 575dc6b828300aaf7fea47eda2526719eb85dc91 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 6 Nov 2023 22:45:46 -0800 Subject: [PATCH 37/49] Fix duplication of AdditionalOptions being added to command-line Fixes 7837 --- src/wix/WixToolset.BuildTasks/DetachBundleEngineForSigning.cs | 2 -- .../WixToolset.BuildTasks/InscribeMsiWithCabinetSignatures.cs | 2 -- src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs | 2 -- src/wix/WixToolset.BuildTasks/WindowsInstallerValidation.cs | 2 -- src/wix/WixToolset.BuildTasks/WixBuild.cs | 1 - 5 files changed, 9 deletions(-) diff --git a/src/wix/WixToolset.BuildTasks/DetachBundleEngineForSigning.cs b/src/wix/WixToolset.BuildTasks/DetachBundleEngineForSigning.cs index 27d4436b3..506f6d56d 100644 --- a/src/wix/WixToolset.BuildTasks/DetachBundleEngineForSigning.cs +++ b/src/wix/WixToolset.BuildTasks/DetachBundleEngineForSigning.cs @@ -42,8 +42,6 @@ protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilde commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); base.BuildCommandLine(commandLineBuilder); - - commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); } protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) diff --git a/src/wix/WixToolset.BuildTasks/InscribeMsiWithCabinetSignatures.cs b/src/wix/WixToolset.BuildTasks/InscribeMsiWithCabinetSignatures.cs index 72d9e872e..4be475329 100644 --- a/src/wix/WixToolset.BuildTasks/InscribeMsiWithCabinetSignatures.cs +++ b/src/wix/WixToolset.BuildTasks/InscribeMsiWithCabinetSignatures.cs @@ -27,8 +27,6 @@ protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilde commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); base.BuildCommandLine(commandLineBuilder); - - commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); } } } diff --git a/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs b/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs index d131402d8..0dbcc46d6 100644 --- a/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs +++ b/src/wix/WixToolset.BuildTasks/ReattachSignedBundleEngine.cs @@ -49,8 +49,6 @@ protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilde commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); base.BuildCommandLine(commandLineBuilder); - - commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); } protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) diff --git a/src/wix/WixToolset.BuildTasks/WindowsInstallerValidation.cs b/src/wix/WixToolset.BuildTasks/WindowsInstallerValidation.cs index 24e504448..e0077ffa1 100644 --- a/src/wix/WixToolset.BuildTasks/WindowsInstallerValidation.cs +++ b/src/wix/WixToolset.BuildTasks/WindowsInstallerValidation.cs @@ -53,8 +53,6 @@ protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilde commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); base.BuildCommandLine(commandLineBuilder); - - commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); } } } diff --git a/src/wix/WixToolset.BuildTasks/WixBuild.cs b/src/wix/WixToolset.BuildTasks/WixBuild.cs index 4cadd7e08..0d455c464 100644 --- a/src/wix/WixToolset.BuildTasks/WixBuild.cs +++ b/src/wix/WixToolset.BuildTasks/WixBuild.cs @@ -82,7 +82,6 @@ protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilde commandLineBuilder.AppendArrayIfNotNull("-bindVariable ", this.CalculateBindVariableStrings()); commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles); - commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions); commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " "); } From 86774dad361714fdd55a2df23379c1a1600d1f27 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 6 Nov 2023 21:46:30 -0800 Subject: [PATCH 38/49] Include duplicated inline directory symbols referenced in subsequent sections Due to the handling of redundant symbols, which are only used by inline directory syntax, the symbols were only defined in the first section encountered by the linker. Fix that so at most one duplicated inline directory symbol is included when referenced. Fixes 7840 --- .../FindEntrySectionAndLoadSymbolsCommand.cs | 25 +++++----- .../Link/ReportConflictingSymbolsCommand.cs | 4 +- .../Link/ResolveReferencesCommand.cs | 13 ++--- .../WixToolset.Core/Link/SymbolWithSection.cs | 25 ++-------- src/wix/WixToolset.Core/Linker.cs | 20 +++++--- .../DirectoryFixture.cs | 47 +++++++++++++++++++ .../RedundantSubdirectoryInSecondSection.wxs | 26 ++++++++++ 7 files changed, 108 insertions(+), 52 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Directory/RedundantSubdirectoryInSecondSection.wxs diff --git a/src/wix/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs b/src/wix/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs index 908476db5..496c61783 100644 --- a/src/wix/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs +++ b/src/wix/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs @@ -42,13 +42,13 @@ public FindEntrySectionAndLoadSymbolsCommand(IMessaging messaging, IEnumerable - public ISet RedundantSymbols { get; private set; } + public ISet IdenticalDirectorySymbols { get; private set; } public void Execute() { var symbolsByName = new Dictionary(); var possibleConflicts = new HashSet(); - var redundantSymbols = new HashSet(); + var identicalDirectorySymbols = new HashSet(); if (!Enum.TryParse(this.ExpectedOutputType.ToString(), out SectionType expectedEntrySectionType)) { @@ -76,28 +76,27 @@ public void Execute() } } - // Load all the symbols from the section's tables that create symbols. + // Load all the symbols from the section's tables that can be referenced (i.e. have an Id). foreach (var symbol in section.Symbols.Where(t => t.Id != null)) { var symbolWithSection = new SymbolWithSection(section, symbol); + var fullName = symbolWithSection.GetFullName(); - if (!symbolsByName.TryGetValue(symbolWithSection.Name, out var existingSymbol)) + if (!symbolsByName.TryGetValue(fullName, out var existingSymbol)) { - symbolsByName.Add(symbolWithSection.Name, symbolWithSection); + symbolsByName.Add(fullName, symbolWithSection); } else // uh-oh, duplicate symbols. { // If the duplicate symbols are both private directories, there is a chance that they - // point to identical symbols. Identical directory symbols are redundant and will not cause - // conflicts. + // point to identical symbols. Identical directory symbols should be treated as redundant. + // and not cause conflicts. if (AccessModifier.Section == existingSymbol.Access && AccessModifier.Section == symbolWithSection.Access && SymbolDefinitionType.Directory == existingSymbol.Symbol.Definition.Type && existingSymbol.Symbol.IsIdentical(symbolWithSection.Symbol)) { - // Ensure identical symbol's symbol is marked redundant to ensure (should the symbol be - // referenced into the final output) it will not add duplicate primary keys during - // the .IDT importing. - existingSymbol.AddRedundant(symbolWithSection); - redundantSymbols.Add(symbolWithSection.Symbol); + // Ensure identical symbols are tracked to ensure that only one symbol will end up in linked intermediate. + identicalDirectorySymbols.Add(existingSymbol.Symbol); + identicalDirectorySymbols.Add(symbolWithSection.Symbol); } else { @@ -111,7 +110,7 @@ public void Execute() this.SymbolsByName = symbolsByName; this.PossibleConflicts = possibleConflicts; - this.RedundantSymbols = redundantSymbols; + this.IdenticalDirectorySymbols = identicalDirectorySymbols; } } } diff --git a/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs b/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs index ace2e19df..3a07d3662 100644 --- a/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs +++ b/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs @@ -40,7 +40,9 @@ public void Execute() if (actuallyReferencedDuplicates.Any()) { - this.Messaging.Write(ErrorMessages.DuplicateSymbol(referencedDuplicate.Symbol.SourceLineNumbers, referencedDuplicate.Name)); + var fullName = referencedDuplicate.GetFullName(); + + this.Messaging.Write(ErrorMessages.DuplicateSymbol(referencedDuplicate.Symbol.SourceLineNumbers, fullName)); foreach (var duplicate in actuallyReferencedDuplicates) { diff --git a/src/wix/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/wix/WixToolset.Core/Link/ResolveReferencesCommand.cs index efb90bb85..d95d648f2 100644 --- a/src/wix/WixToolset.Core/Link/ResolveReferencesCommand.cs +++ b/src/wix/WixToolset.Core/Link/ResolveReferencesCommand.cs @@ -91,15 +91,16 @@ private void RecursivelyResolveReferences(IntermediateSection section) else // display errors for the duplicate symbols. { var accessibleSymbol = accessible[0]; + var accessibleFullName = accessibleSymbol.GetFullName(); var referencingSourceLineNumber = wixSimpleReferenceRow.SourceLineNumbers?.ToString(); if (String.IsNullOrEmpty(referencingSourceLineNumber)) { - this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleSymbol.Name)); + this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleFullName)); } else { - this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleSymbol.Name, referencingSourceLineNumber)); + this.Messaging.Write(ErrorMessages.DuplicateSymbol(accessibleSymbol.Symbol.SourceLineNumbers, accessibleFullName, referencingSourceLineNumber)); } foreach (var accessibleDuplicate in accessible.Skip(1)) @@ -146,14 +147,6 @@ private List DetermineAccessibleSymbols(IntermediateSection r } } - foreach (var dupe in symbolWithSection.Redundants) - { - if (this.AccessibleSymbol(referencingSection, dupe)) - { - accessibleSymbols.Add(dupe); - } - } - return accessibleSymbols; } diff --git a/src/wix/WixToolset.Core/Link/SymbolWithSection.cs b/src/wix/WixToolset.Core/Link/SymbolWithSection.cs index 08e01077a..dbaceb283 100644 --- a/src/wix/WixToolset.Core/Link/SymbolWithSection.cs +++ b/src/wix/WixToolset.Core/Link/SymbolWithSection.cs @@ -13,7 +13,6 @@ namespace WixToolset.Core.Link internal class SymbolWithSection { private HashSet possibleConflicts; - private HashSet redundants; /// /// Creates a symbol for a symbol. @@ -24,7 +23,6 @@ public SymbolWithSection(IntermediateSection section, IntermediateSymbol symbol) { this.Symbol = symbol; this.Section = section; - this.Name = String.Concat(this.Symbol.Definition.Name, ":", this.Symbol.Id.Id); } /// @@ -33,12 +31,6 @@ public SymbolWithSection(IntermediateSection section, IntermediateSymbol symbol) /// Accessbility of the symbol. public AccessModifier Access => this.Symbol.Id.Access; - /// - /// Gets the name of the symbol. - /// - /// Name of the symbol. - public string Name { get; } - /// /// Gets the symbol for this symbol. /// @@ -56,11 +48,6 @@ public SymbolWithSection(IntermediateSection section, IntermediateSymbol symbol) /// public IEnumerable PossiblyConflicts => this.possibleConflicts ?? Enumerable.Empty(); - /// - /// Gets any duplicates of this symbol with sections that are redundant. - /// - public IEnumerable Redundants => this.redundants ?? Enumerable.Empty(); - /// /// Adds a duplicate symbol with sections that is a possible conflict. /// @@ -76,17 +63,11 @@ public void AddPossibleConflict(SymbolWithSection symbolWithSection) } /// - /// Adds a duplicate symbol that is redundant. + /// Gets the full name of the symbol. /// - /// Symbol with section that is redundant of this symbol. - public void AddRedundant(SymbolWithSection symbolWithSection) + public string GetFullName() { - if (null == this.redundants) - { - this.redundants = new HashSet(); - } - - this.redundants.Add(symbolWithSection); + return String.Concat(this.Symbol.Definition.Name, ":", this.Symbol.Id.Id); } } } diff --git a/src/wix/WixToolset.Core/Linker.cs b/src/wix/WixToolset.Core/Linker.cs index a3d990392..5c021ca0f 100644 --- a/src/wix/WixToolset.Core/Linker.cs +++ b/src/wix/WixToolset.Core/Linker.cs @@ -177,14 +177,20 @@ public Intermediate Link(ILinkContext context) // metadata. var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type); var references = new List(); + var identicalDirectoryIds = new HashSet(StringComparer.Ordinal); foreach (var section in sections) { foreach (var symbol in section.Symbols) { - if (find.RedundantSymbols.Contains(symbol)) + // If this symbol is an identical directory, ensure we only visit + // one (and skip the other identicals with the same id). + if (find.IdenticalDirectorySymbols.Contains(symbol)) { - continue; + if (!identicalDirectoryIds.Add(symbol.Id.Id)) + { + continue; + } } var copySymbol = true; // by default, copy symbols. @@ -351,22 +357,24 @@ private void LoadStandardSymbols(IDictionary symbolsB foreach (var actionSymbol in WindowsInstallerStandard.StandardActions()) { var symbolWithSection = new SymbolWithSection(null, actionSymbol); + var fullName = symbolWithSection.GetFullName(); // If the action's symbol has not already been defined (i.e. overriden by the user), add it now. - if (!symbolsByName.ContainsKey(symbolWithSection.Name)) + if (!symbolsByName.ContainsKey(fullName)) { - symbolsByName.Add(symbolWithSection.Name, symbolWithSection); + symbolsByName.Add(fullName, symbolWithSection); } } foreach (var directorySymbol in WindowsInstallerStandard.StandardDirectories()) { var symbolWithSection = new SymbolWithSection(null, directorySymbol); + var fullName = symbolWithSection.GetFullName(); // If the directory's symbol has not already been defined (i.e. overriden by the user), add it now. - if (!symbolsByName.ContainsKey(symbolWithSection.Name)) + if (!symbolsByName.ContainsKey(fullName)) { - symbolsByName.Add(symbolWithSection.Name, symbolWithSection); + symbolsByName.Add(fullName, symbolWithSection); } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs index cacf72bdc..3f4108cbb 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs @@ -273,5 +273,52 @@ public void CanGetDuplicateTargetSourceName() }, directoryRows.Select(r => String.Join('\t', r.FieldAsString(0), r.FieldAsString(1), r.FieldAsString(2))).ToArray()); } } + + [Fact] + public void CanFindRedundantSubdirectoryInSecondSection() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, "bin", "test.msi"); + var wixpdbPath = Path.ChangeExtension(msiPath, ".wixpdb"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Directory", "RedundantSubdirectoryInSecondSection.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + var intermediate = Intermediate.Load(wixpdbPath); + var section = intermediate.Sections.Single(); + + var dirSymbols = section.Symbols.OfType().ToList(); + WixAssert.CompareLineByLine(new[] + { + @"dKO7wPCF.XLmq6KnqybHHgcBBqtU:ProgramFilesFolder:a\b\c", + @"ProgramFilesFolder:TARGETDIR:PFiles", + @"TARGETDIR::SourceDir" + }, dirSymbols.OrderBy(d => d.Id.Id).Select(d => d.Id.Id + ":" + d.ParentDirectoryRef + ":" + d.Name).OrderBy(s => s).ToArray()); + + var data = WindowsInstallerData.Load(wixpdbPath); + var directoryRows = data.Tables["Directory"].Rows; + WixAssert.CompareLineByLine(new[] + { + @"d1nVb5_zcCwRCz7i2YXNAofGRmfc:ProgramFilesFolder:a", + @"dijlG.bNicFgvj1_DujiGg9EBGrQ:d1nVb5_zcCwRCz7i2YXNAofGRmfc:b", + @"dKO7wPCF.XLmq6KnqybHHgcBBqtU:dijlG.bNicFgvj1_DujiGg9EBGrQ:c", + "ProgramFilesFolder:TARGETDIR:PFiles", + "TARGETDIR::SourceDir" + }, directoryRows.Select(r => r.FieldAsString(0) + ":" + r.FieldAsString(1) + ":" + r.FieldAsString(2)).OrderBy(s => s).ToArray()); + } + } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Directory/RedundantSubdirectoryInSecondSection.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Directory/RedundantSubdirectoryInSecondSection.wxs new file mode 100644 index 000000000..fc73ee474 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Directory/RedundantSubdirectoryInSecondSection.wxs @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + From 4d3c19dc160e5701d3e75aa7e032779ca49f4709 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 7 Nov 2023 15:29:32 -0800 Subject: [PATCH 39/49] Include build permission to push to GitHub Packages --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b6d4f3c7..7da17eda1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,7 @@ jobs: runs-on: windows-2022 permissions: id-token: write + packages: write steps: - name: Checkout code uses: actions/checkout@v3 From b9e579a44e257c3efd5dd9f321c6b0acf51fc5d6 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 13 Nov 2023 12:56:15 -0800 Subject: [PATCH 40/49] Return intermediate even if compiler encounters error Fixes 7854 --- src/wix/WixToolset.Core/Compiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 6063d4630..47ef0a1b8 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -162,7 +162,7 @@ public Intermediate Compile(ICompileContext context) target.UpdateLevel(Data.IntermediateLevels.Compiled); - return this.Messaging.EncounteredError ? null : target; + return target; } /// From b9b68be290f544475f9d0f853344be38ef006993 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 13 Nov 2023 13:55:46 -0800 Subject: [PATCH 41/49] WiX Toolset v4.0.3 --- src/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.txt b/src/version.txt index e40fdfa19..c4e41f945 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.3-build.{height} +4.0.3 From 1c36cb8bc5a6535de82a64a6fa695df3ec4d7fda Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 28 Jan 2024 08:45:16 -0800 Subject: [PATCH 42/49] Start WiX Toolset v4.0.4 --- .github/workflows/build.yml | 6 +++--- src/version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7da17eda1..0cd8e1350 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,12 +5,12 @@ on: branches: - master - develop - - develop403 + - develop404 pull_request: branches: - master - develop - - develop403 + - develop404 workflow_dispatch: inputs: tags: @@ -107,5 +107,5 @@ jobs: path: build/logs/ - name: Push to GitHub Packages - if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop403') + if: github.event_name == 'push' && github.repository_owner == 'wixtoolset' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/develop404') run: dotnet nuget push "build/artifacts/**/*.nupkg" --source https://nuget.pkg.github.com/wixtoolset/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate diff --git a/src/version.txt b/src/version.txt index c4e41f945..81002d34d 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -4.0.3 +4.0.4-build.{height} From 6a6f1eb8d4e86b63b455d6676455e6489ee147a4 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sun, 26 Nov 2023 22:40:25 -0500 Subject: [PATCH 43/49] Build tweaks to support VS 17.8... ...because SemVer is just a suggestion. - Also fix missing NuGet cleanup. - And update NuGet^2 packages because v6.3.1 has vulnerabilities. --- .../WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj | 1 + src/clean.cmd | 7 +++++++ src/ext/Bal/test/examples/examples.proj | 7 ++++++- src/internal/SetBuildNumber/Directory.Packages.props.pp | 6 +++--- .../WixToolsetTest.Core.Native.csproj | 1 + .../TestData/MultiTargetingWixlib/TestExe/TestExe.csproj | 1 + 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj index 7c21734fa..21b9cfdc0 100644 --- a/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj +++ b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj @@ -5,6 +5,7 @@ net6.0 win-x86 + false true diff --git a/src/clean.cmd b/src/clean.cmd index 67823b796..b3303d527 100644 --- a/src/clean.cmd +++ b/src/clean.cmd @@ -25,6 +25,7 @@ if exist "%_NUGET_CACHE%\wixtoolset.balutil" rd /s/q "%_NUGET_CACHE%\wixtoolset. if exist "%_NUGET_CACHE%\wixtoolset.bextutil" rd /s/q "%_NUGET_CACHE%\wixtoolset.bextutil" if exist "%_NUGET_CACHE%\wixtoolset.bootstrappercore.native" rd /s/q "%_NUGET_CACHE%\wixtoolset.bootstrappercore.native" if exist "%_NUGET_CACHE%\wixtoolset.burn" rd /s/q "%_NUGET_CACHE%\wixtoolset.burn" +if exist "%_NUGET_CACHE%\wixtoolset.complus.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.complus.wixext" if exist "%_NUGET_CACHE%\wixtoolset.converters" rd /s/q "%_NUGET_CACHE%\wixtoolset.converters" if exist "%_NUGET_CACHE%\wixtoolset.core" rd /s/q "%_NUGET_CACHE%\wixtoolset.core" if exist "%_NUGET_CACHE%\wixtoolset.core.burn" rd /s/q "%_NUGET_CACHE%\wixtoolset.core.burn" @@ -33,6 +34,7 @@ if exist "%_NUGET_CACHE%\wixtoolset.core.native" rd /s/q "%_NUGET_CACHE%\wixtool if exist "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" rd /s/q "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" if exist "%_NUGET_CACHE%\wixtoolset.data" rd /s/q "%_NUGET_CACHE%\wixtoolset.data" if exist "%_NUGET_CACHE%\wixtoolset.dependency.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.dependency.wixext" +if exist "%_NUGET_CACHE%\wixtoolset.directx.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.directx.wixext" if exist "%_NUGET_CACHE%\wixtoolset.dnc.hostgenerator" rd /s/q "%_NUGET_CACHE%\wixtoolset.dnc.hostgenerator" if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression" if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" @@ -46,13 +48,18 @@ if exist "%_NUGET_CACHE%\wixtoolset.dutil" rd /s/q "%_NUGET_CACHE%\wixtoolset.du if exist "%_NUGET_CACHE%\wixtoolset.extensibility" rd /s/q "%_NUGET_CACHE%\wixtoolset.extensibility" if exist "%_NUGET_CACHE%\wixtoolset.firewall.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.firewall.wixext" if exist "%_NUGET_CACHE%\wixtoolset.heat" rd /s/q "%_NUGET_CACHE%\wixtoolset.heat" +if exist "%_NUGET_CACHE%\wixtoolset.http.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.http.wixext" if exist "%_NUGET_CACHE%\wixtoolset.iis.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.iis.wixext" if exist "%_NUGET_CACHE%\wixtoolset.mba.core" rd /s/q "%_NUGET_CACHE%\wixtoolset.mba.core" +if exist "%_NUGET_CACHE%\wixtoolset.msmq.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.msmq.wixext" if exist "%_NUGET_CACHE%\wixtoolset.netfx.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.netfx.wixext" +if exist "%_NUGET_CACHE%\wixtoolset.powershell.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.powershell.wixext" if exist "%_NUGET_CACHE%\wixtoolset.sdk" rd /s/q "%_NUGET_CACHE%\wixtoolset.sdk" +if exist "%_NUGET_CACHE%\wixtoolset.sql.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.sql.wixext" if exist "%_NUGET_CACHE%\wixtoolset.util.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.util.wixext" if exist "%_NUGET_CACHE%\wixtoolset.ui.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.ui.wixext" if exist "%_NUGET_CACHE%\wixtoolset.versioning" rd /s/q "%_NUGET_CACHE%\wixtoolset.versioning" +if exist "%_NUGET_CACHE%\wixtoolset.visualstudio.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.visualstudio.wixext" if exist "%_NUGET_CACHE%\wixtoolset.wcautil" rd /s/q "%_NUGET_CACHE%\wixtoolset.wcautil" if exist "%_NUGET_CACHE%\wix" rd /s/q "%_NUGET_CACHE%\wix" diff --git a/src/ext/Bal/test/examples/examples.proj b/src/ext/Bal/test/examples/examples.proj index 855f0ef53..60388a936 100644 --- a/src/ext/Bal/test/examples/examples.proj +++ b/src/ext/Bal/test/examples/examples.proj @@ -39,7 +39,12 @@ Condition="'%(CoreMBAProject.SkipFDD)'==''" /> - + diff --git a/src/internal/SetBuildNumber/Directory.Packages.props.pp b/src/internal/SetBuildNumber/Directory.Packages.props.pp index a14cf55ad..8ec6f78cb 100644 --- a/src/internal/SetBuildNumber/Directory.Packages.props.pp +++ b/src/internal/SetBuildNumber/Directory.Packages.props.pp @@ -68,9 +68,9 @@ - - - + + +