diff options
| author | Rob Mensching <rob@firegiant.com> | 2022-08-10 13:28:34 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2022-08-10 17:31:40 -0700 |
| commit | 84e7b6d277e5c3d118e11a45834d420254a758c0 (patch) | |
| tree | 7e50655dd077d4db4c99db45bf7ba8d68f378030 | |
| parent | 6b7ad550ab4caaa262137539c9e5b0017fba4bd5 (diff) | |
| download | wix-84e7b6d277e5c3d118e11a45834d420254a758c0.tar.gz wix-84e7b6d277e5c3d118e11a45834d420254a758c0.tar.bz2 wix-84e7b6d277e5c3d118e11a45834d420254a758c0.zip | |
Prevent crash when Bundle has SWID Tag but child MSI does not
Fixes 6854
Diffstat (limited to '')
3 files changed, 57 insertions, 6 deletions
diff --git a/src/setup/WixAdditionalTools/WixAdditionalTools.wxs b/src/setup/WixAdditionalTools/WixAdditionalTools.wxs index a53db9d3..c54f6100 100644 --- a/src/setup/WixAdditionalTools/WixAdditionalTools.wxs +++ b/src/setup/WixAdditionalTools/WixAdditionalTools.wxs | |||
| @@ -13,8 +13,7 @@ | |||
| 13 | </BootstrapperApplication> | 13 | </BootstrapperApplication> |
| 14 | 14 | ||
| 15 | <SetVariable Variable="InstallFolder" Value="[ProgramFilesFolder]WiX Toolset v$(SetupMajorMinorVersion)\" /> | 15 | <SetVariable Variable="InstallFolder" Value="[ProgramFilesFolder]WiX Toolset v$(SetupMajorMinorVersion)\" /> |
| 16 | <!-- TODO: bring back SoftwareTag when #6854 fixed --> | 16 | <SoftwareTag Regid="!(loc.Regid)" InstallPath="[InstallFolder]" /> |
| 17 | <!-- <SoftwareTag Regid="!(loc.Regid)" InstallPath="[InstallFolder]" /> --> | ||
| 18 | 17 | ||
| 19 | <Update Location="!(loc.UpdateUrl)" /> | 18 | <Update Location="!(loc.UpdateUrl)" /> |
| 20 | 19 | ||
diff --git a/src/wix/WixToolset.Core.Burn/Bind/ProcessBundleSoftwareTagsCommand.cs b/src/wix/WixToolset.Core.Burn/Bind/ProcessBundleSoftwareTagsCommand.cs index f9ff23cb..1962660f 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/ProcessBundleSoftwareTagsCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/ProcessBundleSoftwareTagsCommand.cs | |||
| @@ -71,11 +71,14 @@ namespace WixToolset.Core.Burn.Bind | |||
| 71 | 71 | ||
| 72 | using (var db = new Database(payload.SourceFile.Path, OpenDatabase.ReadOnly)) | 72 | using (var db = new Database(payload.SourceFile.Path, OpenDatabase.ReadOnly)) |
| 73 | { | 73 | { |
| 74 | using (var view = db.OpenExecuteView("SELECT `Regid`, `TagId` FROM `SoftwareIdentificationTag`")) | 74 | if (db.TableExists("SoftwareIdentificationTag")) |
| 75 | { | 75 | { |
| 76 | foreach (var record in view.Records) | 76 | using (var view = db.OpenExecuteView("SELECT `Regid`, `TagId` FROM `SoftwareIdentificationTag`")) |
| 77 | { | 77 | { |
| 78 | tags.Add(new SoftwareTag { Regid = record.GetString(1), Id = record.GetString(2) }); | 78 | foreach (var record in view.Records) |
| 79 | { | ||
| 80 | tags.Add(new SoftwareTag { Regid = record.GetString(1), Id = record.GetString(2) }); | ||
| 81 | } | ||
| 79 | } | 82 | } |
| 80 | } | 83 | } |
| 81 | } | 84 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs index 9ff97e8c..544fcbda 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/SoftwareTagFixture.cs | |||
| @@ -13,7 +13,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 13 | public class SoftwareTagFixture | 13 | public class SoftwareTagFixture |
| 14 | { | 14 | { |
| 15 | private static readonly XNamespace BurnManifestNamespace = "http://wixtoolset.org/schemas/v4/2008/Burn"; | 15 | private static readonly XNamespace BurnManifestNamespace = "http://wixtoolset.org/schemas/v4/2008/Burn"; |
| 16 | private static readonly XNamespace SwidTagNamespace = "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"; | 16 | private static readonly XNamespace SwidTagNamespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd"; |
| 17 | 17 | ||
| 18 | [Fact] | 18 | [Fact] |
| 19 | public void CanBuildPackageWithTag() | 19 | public void CanBuildPackageWithTag() |
| @@ -87,6 +87,55 @@ namespace WixToolsetTest.CoreIntegration | |||
| 87 | var version = docTag.Root.Attribute("version").Value; | 87 | var version = docTag.Root.Attribute("version").Value; |
| 88 | Assert.Equal("~TagTestBundle", title); | 88 | Assert.Equal("~TagTestBundle", title); |
| 89 | Assert.Equal("4.3.2.1", version); | 89 | Assert.Equal("4.3.2.1", version); |
| 90 | |||
| 91 | var msiLink = docTag.Root.Elements(SwidTagNamespace + "Link").Single(); | ||
| 92 | Assert.Equal("component", msiLink.Attribute("rel").Value); | ||
| 93 | Assert.StartsWith("swid:msi:package/", msiLink.Attribute("href").Value); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | [Fact] | ||
| 99 | public void CanBuildBundleWithTagWhereMsiDoesNotHaveTag() | ||
| 100 | { | ||
| 101 | var testDataFolder = TestData.Get(@"TestData"); | ||
| 102 | |||
| 103 | using (var fs = new DisposableFileSystem()) | ||
| 104 | { | ||
| 105 | var baseFolder = fs.GetFolder(); | ||
| 106 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 107 | |||
| 108 | var result = WixRunner.Execute(new[] | ||
| 109 | { | ||
| 110 | "build", | ||
| 111 | Path.Combine(testDataFolder, "BundleTag", "BundleWithTag.wxs"), | ||
| 112 | "-bindpath", Path.Combine(testDataFolder, "SimpleBundle", "data"), | ||
| 113 | "-intermediateFolder", intermediateFolder, | ||
| 114 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | ||
| 115 | }); | ||
| 116 | |||
| 117 | result.AssertSuccess(); | ||
| 118 | |||
| 119 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); | ||
| 120 | Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); | ||
| 121 | |||
| 122 | using (var ouput = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixpdb"))) | ||
| 123 | { | ||
| 124 | var badata = ouput.GetDataStream("wix-burndata.xml"); | ||
| 125 | var doc = XDocument.Load(badata); | ||
| 126 | |||
| 127 | var swidTag = doc.Root.Element(BurnManifestNamespace + "Registration").Element(BurnManifestNamespace + "SoftwareTag").Value; | ||
| 128 | |||
| 129 | var swidTagPath = Path.Combine(baseFolder, "test.swidtag"); | ||
| 130 | File.WriteAllText(swidTagPath, swidTag); | ||
| 131 | |||
| 132 | var docTag = XDocument.Load(swidTagPath); | ||
| 133 | var title = docTag.Root.Attribute("name").Value; | ||
| 134 | var version = docTag.Root.Attribute("version").Value; | ||
| 135 | Assert.Equal("~TagTestBundle", title); | ||
| 136 | Assert.Equal("4.3.2.1", version); | ||
| 137 | |||
| 138 | Assert.Empty(docTag.Root.Elements(SwidTagNamespace + "Link")); | ||
| 90 | } | 139 | } |
| 91 | } | 140 | } |
| 92 | } | 141 | } |
