@joebigelow / wix-1 / commits / 43b79456

Add test for building a bundle from .wixproj.

Sean Hall committed May 10, 2020 at 14:18 UTC 43b794567dacd6b11dd508dca4aff29650139946
7 files changed +106 -3
appveyor.yml
+1 -1
@@ -8,7 +8,7 @@ branches:
8 - master
9 - develop
10
11 -image: Visual Studio 2017
11 +image: Visual Studio 2019
12
13 version: 0.0.0.{build}
14 configuration: Release
nuget.config
+1
@@ -2,6 +2,7 @@
2 <configuration>
3 <packageSources>
4 <clear />
5 + <add key="wixtoolset-burn" value="https://ci.appveyor.com/nuget/wixtoolset-burn" />
6 <add key="wixtoolset-converters" value="https://ci.appveyor.com/nuget/wixtoolset-converters" />
7 <add key="wixtoolset-core" value="https://ci.appveyor.com/nuget/wixtoolset-core" />
8 <add key="wixtoolset-core-native" value="https://ci.appveyor.com/nuget/wixtoolset-core-native" />
src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
+37
@@ -13,6 +13,43 @@ namespace WixToolsetTest.BuildTasks
13 {
14 private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(DoIt).Assembly.CodeBase).AbsolutePath), "wix.targets");
15
16 + [Fact]
17 + public void CanBuildSimpleBundle()
18 + {
19 + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj");
20 +
21 + using (var fs = new DisposableFileSystem())
22 + {
23 + var baseFolder = fs.GetFolder();
24 + var binFolder = Path.Combine(baseFolder, @"bin\");
25 + var intermediateFolder = Path.Combine(baseFolder, @"obj\");
26 +
27 + var result = MsbuildRunner.Execute(projectPath, new[]
28 + {
29 + $"-p:WixTargetsPath={WixTargetsPath}",
30 + $"-p:IntermediateOutputPath={intermediateFolder}",
31 + $"-p:OutputPath={binFolder}"
32 + });
33 + result.AssertSuccess();
34 +
35 + var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86"));
36 + Assert.Single(platformSwitches);
37 +
38 + var warnings = result.Output.Where(line => line.Contains(": warning"));
39 + Assert.Empty(warnings);
40 +
41 + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories)
42 + .Select(s => s.Substring(baseFolder.Length + 1))
43 + .OrderBy(s => s)
44 + .ToArray();
45 + Assert.Equal(new[]
46 + {
47 + //@"bin\SimpleBundle.exe",
48 + @"bin\SimpleBundle.wixpdb",
49 + }, paths);
50 + }
51 + }
52 +
53 [Fact]
54 public void CanBuildSimpleMsiPackage()
55 {
src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs new
+10
@@ -0,0 +1,10 @@
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Bundle Name="SimpleBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="6670d5c9-bbec-4828-ab60-4a1c0ffeb97d">
4 + <BootstrapperApplication SourceFile="test.txt" />
5 +
6 + <Chain>
7 + <ExePackage SourceFile="test.txt" />
8 + </Chain>
9 + </Bundle>
10 +</Wix>
src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj new
+45
@@ -0,0 +1,45 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <PropertyGroup>
4 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 + <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 + </PropertyGroup>
7 +
8 + <PropertyGroup>
9 + <ProjectGuid>6670d5c9-bbec-4828-ab60-4a1c0ffeb97d</ProjectGuid>
10 + <OutputType>Bundle</OutputType>
11 + </PropertyGroup>
12 +
13 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
14 + <PlatformName>$(Platform)</PlatformName>
15 + <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
16 + <DefineConstants>Debug</DefineConstants>
17 + </PropertyGroup>
18 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
19 + <PlatformName>$(Platform)</PlatformName>
20 + <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
21 + </PropertyGroup>
22 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
23 + <PlatformName>$(Platform)</PlatformName>
24 + <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
25 + <DefineConstants>Debug</DefineConstants>
26 + </PropertyGroup>
27 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
28 + <PlatformName>$(Platform)</PlatformName>
29 + <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30 + </PropertyGroup>
31 +
32 + <ItemGroup>
33 + <Compile Include="Bundle.wxs" />
34 + </ItemGroup>
35 +
36 + <ItemGroup>
37 + <BindInputPaths Include="..\MsiPackage\data" />
38 + </ItemGroup>
39 +
40 + <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
41 + <Import Project="$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets') " />
42 + <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
43 + <Error Text="WiX Toolset build tools (v4.0 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
44 + </Target>
45 +</Project>
\ No newline at end of file
src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln
+10 -2
@@ -1,10 +1,12 @@
1 
2 Microsoft Visual Studio Solution File, Format Version 12.00
3 -# Visual Studio 15
4 -VisualStudioVersion = 15.0.26730.8
3 +# Visual Studio Version 16
4 +VisualStudioVersion = 16.0.30011.22
5 MinimumVisualStudioVersion = 10.0.40219.1
6 Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}"
7 EndProject
8 +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SimpleBundle", "SimpleBundle\SimpleBundle.wixproj", "{6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}"
9 +EndProject
10 Global
11 GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 Debug|x64 = Debug|x64
@@ -21,6 +23,12 @@ Global
23 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64
24 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86
25 {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86
26 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x64.ActiveCfg = Debug|x86
27 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.ActiveCfg = Debug|x86
28 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.Build.0 = Debug|x86
29 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x64.ActiveCfg = Release|x86
30 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.ActiveCfg = Release|x86
31 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.Build.0 = Release|x86
32 EndGlobalSection
33 GlobalSection(SolutionProperties) = preSolution
34 HideSolutionNode = FALSE
src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
+2
@@ -23,6 +23,8 @@
23 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\SimpleMsiPackage\MsiPackage\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
26 + <Content Include="TestData\SimpleMsiPackage\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
27 + <Content Include="TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj" CopyToOutputDirectory="PreserveNewest" />
28 </ItemGroup>
29
30 <ItemGroup>