public void CanCompileAndDecompile() { var folder = TestData.Get(@"TestData"); var expectedFile = Path.Combine(folder, "CustomTable", "CustomTable-Expected.wxs"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); var decompiledWxsPath = Path.Combine(baseFolder, @"decompiled.wxs"); var result = WixRunner.Execute(new[] { "build", "-d", "ProductCode=83f9c623-26fe-42ab-951e-170022117f54", Path.Combine(folder, "CustomTable", "CustomTable.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)); result = WixRunner.Execute(new[] { "decompile", msiPath, "-sw1060", "-intermediateFolder", intermediateFolder, "-o", decompiledWxsPath }); result.AssertSuccess(); WixAssert.CompareXml(expectedFile, decompiledWxsPath); } }
private static void DecompileAndCompare(string sourceFolder, string msiName, string expectedWxsName) { var folder = TestData.Get(sourceFolder); using (var fs = new DisposableFileSystem()) { var intermediateFolder = fs.GetFolder(); var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); var result = WixRunner.Execute(new[] { "decompile", Path.Combine(folder, msiName), "-intermediateFolder", intermediateFolder, "-o", outputPath }); result.AssertSuccess(); WixAssert.CompareXml(Path.Combine(folder, expectedWxsName), outputPath); } }