public void CanBuildSimpleMsiPackage() { var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var pdbPath = Path.Combine(baseFolder, @"bin\testpackage.wixpdb"); var engine = new FakeBuildEngine(); var task = new DoIt { BuildEngine = engine, SourceFiles = new[] { new TaskItem(Path.Combine(folder, "Package.wxs")), new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), }, LocalizationFiles = new[] { new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), }, BindInputPaths = new[] { new TaskItem(Path.Combine(folder, "data")), }, IntermediateDirectory = new TaskItem(intermediateFolder), OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), PdbType = "Full", PdbFile = new TaskItem(pdbPath), }; var result = task.Execute(); Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); Assert.True(File.Exists(pdbPath)); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); var intermediate = Intermediate.Load(pdbPath); var section = intermediate.Sections.Single(); var fileTuple = section.Tuples.OfType <FileTuple>().Single(); Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileTuple[FileTupleFields.Source].AsPath().Path); Assert.Equal(@"test.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); } }
public void ReportsInnerExceptionForUnexpectedExceptions() { var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new DisposableFileSystem()) { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); var pdbPath = Path.Combine(baseFolder, @"bin\testpackage.wixpdb"); var engine = new FakeBuildEngine(); var task = new DoIt { BuildEngine = engine, SourceFiles = new[] { new TaskItem(Path.Combine(folder, "Package.wxs")), new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), }, LocalizationFiles = new[] { new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), }, BindInputPaths = new[] { new TaskItem(Path.Combine(folder, "data")), }, IntermediateDirectory = new TaskItem(intermediateFolder), OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), PdbType = "Full", PdbFile = new TaskItem(pdbPath), }; var result = task.Execute(); Assert.False(result, $"MSBuild task succeeded unexpectedly. Output:\r\n{engine.Output}"); Assert.Contains( "System.PlatformNotSupportedException: Could not find platform specific 'wixnative.exe' ---> System.IO.FileNotFoundException: Could not find internal piece of WiX Toolset from", engine.Output); } }