Add test for building a bundle from .wixproj.

This commit is contained in:
Sean Hall 2020-05-10 14:18:29 +10:00
Родитель a5f59cb11a
Коммит 43b794567d
7 изменённых файлов: 106 добавлений и 3 удалений

Просмотреть файл

@ -8,7 +8,7 @@ branches:
- master
- develop
image: Visual Studio 2017
image: Visual Studio 2019
version: 0.0.0.{build}
configuration: Release

Просмотреть файл

@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="wixtoolset-burn" value="https://ci.appveyor.com/nuget/wixtoolset-burn" />
<add key="wixtoolset-converters" value="https://ci.appveyor.com/nuget/wixtoolset-converters" />
<add key="wixtoolset-core" value="https://ci.appveyor.com/nuget/wixtoolset-core" />
<add key="wixtoolset-core-native" value="https://ci.appveyor.com/nuget/wixtoolset-core-native" />

Просмотреть файл

@ -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()
{

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Bundle Name="SimpleBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="6670d5c9-bbec-4828-ab60-4a1c0ffeb97d">
<BootstrapperApplication SourceFile="test.txt" />
<Chain>
<ExePackage SourceFile="test.txt" />
</Chain>
</Bundle>
</Wix>

Просмотреть файл

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>6670d5c9-bbec-4828-ab60-4a1c0ffeb97d</ProjectGuid>
<OutputType>Bundle</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformName>$(Platform)</PlatformName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformName>$(Platform)</PlatformName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformName>$(Platform)</PlatformName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<PlatformName>$(Platform)</PlatformName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<BindInputPaths Include="..\MsiPackage\data" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<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/." />
</Target>
</Project>

Просмотреть файл

@ -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

Просмотреть файл

@ -23,6 +23,8 @@
<Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
<Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
<Content Include="TestData\SimpleMsiPackage\MsiPackage\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
<Content Include="TestData\SimpleMsiPackage\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
<Content Include="TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>