diff --git a/src/WixToolset.Core.TestPackage/BundleExtractor.cs b/src/WixToolset.Core.TestPackage/BundleExtractor.cs index ad97f113..d407c12a 100644 --- a/src/WixToolset.Core.TestPackage/BundleExtractor.cs +++ b/src/WixToolset.Core.TestPackage/BundleExtractor.cs @@ -44,6 +44,23 @@ public static ExtractBAContainerResult ExtractBAContainer(IMessaging messaging, return result; } + /// + /// Extracts detached and attached containers. + /// + /// + /// Path to the bundle. + /// Path to extract to. + /// Temp path for extraction. + /// + public static bool ExtractAttachedContainer(IMessaging messaging, string bundleFilePath, string destinationFolderPath, string tempFolderPath) + { + Directory.CreateDirectory(tempFolderPath); + using (var burnReader = BurnReader.Open(messaging, bundleFilePath)) + { + return burnReader.ExtractAttachedContainer(destinationFolderPath, tempFolderPath); + } + } + /// /// Gets an for BootstrapperApplicationData.xml with the given prefix assigned to the root namespace. /// diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index 1e3f1e24..31363c49 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs @@ -348,5 +348,42 @@ public void CantBuildWithUnscheduledRollbackBoundary() Assert.InRange(result.ExitCode, 2, Int32.MaxValue); } } + + [Fact(Skip = "Test demonstrates failure https://github.com/wixtoolset/issues/issues/6298")] + public void CanDecompileBundleWithDettachedContainer() + { + var folder = TestData.Get(@"TestData\BundleWithDetachedContainer"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var exePath = Path.Combine(baseFolder, @"bin\test.exe"); + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract1"); + var extractContainerFolderPath = Path.Combine(baseFolder, "extract2"); + + 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", exePath, + }); + + result.AssertSuccess(); + Assert.Empty(result.Messages.Where(m => m.Level == MessageLevel.Warning)); + + Assert.True(File.Exists(exePath)); + Assert.True(File.Exists(pdbPath)); + + Assert.True(BundleExtractor.ExtractAttachedContainer(null, exePath, extractFolderPath, extractContainerFolderPath)); + + //TODO Check that extracted files exist as expected + } + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.en-us.wxl new file mode 100644 index 00000000..bc1dee83 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.en-us.wxl @@ -0,0 +1,10 @@ + + + + + + ~TestBundle + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs new file mode 100644 index 00000000..f45c567b --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/Bundle.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBootstrapperApplication.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBootstrapperApplication.wxs new file mode 100644 index 00000000..f5fe9885 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBootstrapperApplication.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBundle.wxs new file mode 100644 index 00000000..48f53ae3 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/MultiFileBundle.wxs @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/Shared.dll b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/Shared.dll new file mode 100644 index 00000000..0e461ba8 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/Shared.dll @@ -0,0 +1 @@ +This is Shared.dll. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/test.txt new file mode 100644 index 00000000..8b986220 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/MsiPackage/test.txt @@ -0,0 +1 @@ +This is test.txt \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/fakeba.dll b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/fakeba.dll new file mode 100644 index 00000000..970efdf0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/fakeba.dll @@ -0,0 +1 @@ +This is a fakeba.dll \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/test.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/test.msi new file mode 100644 index 00000000..0722d60e Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithDetachedContainer/data/test.msi differ diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index a38e89ce..36e5585b 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -7,6 +7,16 @@ false embedded + + + + + + + + + + @@ -32,6 +42,30 @@ + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest +