From 43b794567dacd6b11dd508dca4aff29650139946 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 10 May 2020 14:18:29 +1000 Subject: Add test for building a bundle from .wixproj. --- appveyor.yml | 2 +- nuget.config | 1 + .../WixToolsetTest.BuildTasks/MsbuildFixture.cs | 37 ++++++++++++++++++ .../SimpleMsiPackage/SimpleBundle/Bundle.wxs | 10 +++++ .../SimpleBundle/SimpleBundle.wixproj | 45 ++++++++++++++++++++++ .../TestData/SimpleMsiPackage/SimpleMsiPackage.sln | 12 +++++- .../WixToolsetTest.BuildTasks.csproj | 2 + 7 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs create mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj diff --git a/appveyor.yml b/appveyor.yml index 8d80c6af..522e5af3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ branches: - master - develop -image: Visual Studio 2017 +image: Visual Studio 2019 version: 0.0.0.{build} configuration: Release diff --git a/nuget.config b/nuget.config index 6e1e8f4a..81117c3d 100644 --- a/nuget.config +++ b/nuget.config @@ -2,6 +2,7 @@ + diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs index c6e260be..f1874743 100644 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs @@ -13,6 +13,43 @@ namespace WixToolsetTest.BuildTasks { private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(DoIt).Assembly.CodeBase).AbsolutePath), "wix.targets"); + [Fact] + public void CanBuildSimpleBundle() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}" + }); + result.AssertSuccess(); + + var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); + Assert.Single(platformSwitches); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .OrderBy(s => s) + .ToArray(); + Assert.Equal(new[] + { + //@"bin\SimpleBundle.exe", + @"bin\SimpleBundle.wixpdb", + }, paths); + } + } + [Fact] public void CanBuildSimpleMsiPackage() { diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs new file mode 100644 index 00000000..6cd04712 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj new file mode 100644 index 00000000..4c837936 --- /dev/null +++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj @@ -0,0 +1,45 @@ + + + + Debug + x86 + + + + 6670d5c9-bbec-4828-ab60-4a1c0ffeb97d + Bundle + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln index 2c88704e..dd21489d 100644 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln +++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.8 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 MinimumVisualStudioVersion = 10.0.40219.1 Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SimpleBundle", "SimpleBundle\SimpleBundle.wixproj", "{6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -21,6 +23,12 @@ Global {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x64.ActiveCfg = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.ActiveCfg = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.Build.0 = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x64.ActiveCfg = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.ActiveCfg = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj index b48f5477..3909cc79 100644 --- a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj +++ b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj @@ -23,6 +23,8 @@ + + -- cgit v1.2.3-55-g6feb