diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-10 14:18:29 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-10 14:20:58 +1000 |
commit | 43b794567dacd6b11dd508dca4aff29650139946 (patch) | |
tree | 77d079557bd687e5a4c05a765b312775e1f4ef2f | |
parent | a5f59cb11a6372a6da8540bd1bebf6dec20e92e3 (diff) | |
download | wix-43b794567dacd6b11dd508dca4aff29650139946.tar.gz wix-43b794567dacd6b11dd508dca4aff29650139946.tar.bz2 wix-43b794567dacd6b11dd508dca4aff29650139946.zip |
Add test for building a bundle from .wixproj.
7 files changed, 106 insertions, 3 deletions
diff --git a/appveyor.yml b/appveyor.yml index 8d80c6af..522e5af3 100644 --- a/appveyor.yml +++ b/appveyor.yml | |||
@@ -8,7 +8,7 @@ branches: | |||
8 | - master | 8 | - master |
9 | - develop | 9 | - develop |
10 | 10 | ||
11 | image: Visual Studio 2017 | 11 | image: Visual Studio 2019 |
12 | 12 | ||
13 | version: 0.0.0.{build} | 13 | version: 0.0.0.{build} |
14 | configuration: Release | 14 | configuration: Release |
diff --git a/nuget.config b/nuget.config index 6e1e8f4a..81117c3d 100644 --- a/nuget.config +++ b/nuget.config | |||
@@ -2,6 +2,7 @@ | |||
2 | <configuration> | 2 | <configuration> |
3 | <packageSources> | 3 | <packageSources> |
4 | <clear /> | 4 | <clear /> |
5 | <add key="wixtoolset-burn" value="https://ci.appveyor.com/nuget/wixtoolset-burn" /> | ||
5 | <add key="wixtoolset-converters" value="https://ci.appveyor.com/nuget/wixtoolset-converters" /> | 6 | <add key="wixtoolset-converters" value="https://ci.appveyor.com/nuget/wixtoolset-converters" /> |
6 | <add key="wixtoolset-core" value="https://ci.appveyor.com/nuget/wixtoolset-core" /> | 7 | <add key="wixtoolset-core" value="https://ci.appveyor.com/nuget/wixtoolset-core" /> |
7 | <add key="wixtoolset-core-native" value="https://ci.appveyor.com/nuget/wixtoolset-core-native" /> | 8 | <add key="wixtoolset-core-native" value="https://ci.appveyor.com/nuget/wixtoolset-core-native" /> |
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 | |||
@@ -14,6 +14,43 @@ namespace WixToolsetTest.BuildTasks | |||
14 | private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(DoIt).Assembly.CodeBase).AbsolutePath), "wix.targets"); | 14 | private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(DoIt).Assembly.CodeBase).AbsolutePath), "wix.targets"); |
15 | 15 | ||
16 | [Fact] | 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] | ||
17 | public void CanBuildSimpleMsiPackage() | 54 | public void CanBuildSimpleMsiPackage() |
18 | { | 55 | { |
19 | var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); | 56 | var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); |
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 @@ | |||
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> | ||
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 @@ | |||
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 | ||
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 @@ | |||
1 | | 1 | |
2 | Microsoft Visual Studio Solution File, Format Version 12.00 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 |
3 | # Visual Studio 15 | 3 | # Visual Studio Version 16 |
4 | VisualStudioVersion = 15.0.26730.8 | 4 | VisualStudioVersion = 16.0.30011.22 |
5 | MinimumVisualStudioVersion = 10.0.40219.1 | 5 | MinimumVisualStudioVersion = 10.0.40219.1 |
6 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" | 6 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" |
7 | EndProject | 7 | EndProject |
8 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SimpleBundle", "SimpleBundle\SimpleBundle.wixproj", "{6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}" | ||
9 | EndProject | ||
8 | Global | 10 | Global |
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
10 | Debug|x64 = Debug|x64 | 12 | Debug|x64 = Debug|x64 |
@@ -21,6 +23,12 @@ Global | |||
21 | {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 | 23 | {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 |
22 | {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 | 24 | {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 |
23 | {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = 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 | ||
24 | EndGlobalSection | 32 | EndGlobalSection |
25 | GlobalSection(SolutionProperties) = preSolution | 33 | GlobalSection(SolutionProperties) = preSolution |
26 | HideSolutionNode = FALSE | 34 | 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 @@ | |||
23 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
24 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 24 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
25 | <Content Include="TestData\SimpleMsiPackage\MsiPackage\data\test.txt" 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" /> | ||
26 | </ItemGroup> | 28 | </ItemGroup> |
27 | 29 | ||
28 | <ItemGroup> | 30 | <ItemGroup> |