Create bundle for Windows

Creates a nice looking bundle that installs the .NET Core MSI package.
Prerequisites and additional packages can be added as needed.

Resolves #1064
This commit is contained in:
Rob Mensching 2016-01-28 01:46:03 -08:00
parent cbdd098ef6
commit 4806977ee2
8 changed files with 350 additions and 21 deletions

View file

@ -14,6 +14,10 @@ namespace Dotnet.Cli.Msi.Tests
public InstallFixture()
{
string msiFile = Environment.GetEnvironmentVariable("CLI_MSI");
if(string.IsNullOrEmpty(msiFile))
{
throw new InvalidOperationException("%CLI_MSI% must point to the msi that is to be tested");
}
_msiMgr = new MsiManager(msiFile);

View file

@ -10,22 +10,20 @@ namespace Dotnet.Cli.Msi.Tests
{
public class InstallationTests : IDisposable
{
private string _msiFile;
private MsiManager _msiMgr;
public InstallationTests()
{
// all the tests assume that the msi to be tested is available via environment variable %CLI_MSI%
_msiFile = Environment.GetEnvironmentVariable("CLI_MSI");
if(string.IsNullOrEmpty(_msiFile))
var msiFile = Environment.GetEnvironmentVariable("CLI_MSI");
if(string.IsNullOrEmpty(msiFile))
{
throw new InvalidOperationException("%CLI_MSI% must point to the msi that is to be tested");
}
_msiMgr = new MsiManager(_msiFile);
_msiMgr = new MsiManager(msiFile);
}
[Theory]
[InlineData("")]
[InlineData(@"%SystemDrive%\dotnet")]
@ -34,14 +32,14 @@ namespace Dotnet.Cli.Msi.Tests
installLocation = Environment.ExpandEnvironmentVariables(installLocation);
string expectedInstallLocation = string.IsNullOrEmpty(installLocation) ?
Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\dotnet") :
installLocation;
installLocation;
// make sure that the msi is not already installed, if so the machine is in a bad state
Assert.False(_msiMgr.IsInstalled, "The dotnet CLI msi is already installed");
Assert.False(Directory.Exists(expectedInstallLocation));
_msiMgr.Install(installLocation);
Assert.True(_msiMgr.IsInstalled);
Assert.True(_msiMgr.IsInstalled);
Assert.True(Directory.Exists(expectedInstallLocation));
_msiMgr.UnInstall();

View file

@ -1,14 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Deployment.WindowsInstaller.Package;
namespace Dotnet.Cli.Msi.Tests
{
public class MsiManager
{
private string _bundleFile;
private string _msiFile;
private string _productCode;
private InstallPackage _installPackage;
@ -48,6 +50,7 @@ namespace Dotnet.Cli.Msi.Tests
public MsiManager(string msiFile)
{
_bundleFile = Path.ChangeExtension(msiFile, "exe");
_msiFile = msiFile;
var ispackage = Installer.VerifyPackage(msiFile);
@ -67,8 +70,8 @@ namespace Dotnet.Cli.Msi.Tests
{
dotnetHome = $"DOTNETHOME={customLocation}";
}
Installer.SetInternalUI(InstallUIOptions.Silent);
Installer.InstallProduct(_msiFile, $"ACTION=INSTALL ALLUSERS=2 ACCEPTEULA=1 {dotnetHome}");
RunBundle(dotnetHome);
return IsInstalled;
}
@ -80,10 +83,25 @@ namespace Dotnet.Cli.Msi.Tests
throw new InvalidOperationException($"UnInstall Error: Msi at {_msiFile} is not installed.");
}
Installer.SetInternalUI(InstallUIOptions.Silent);
Installer.InstallProduct(_msiFile, "REMOVE=ALL");
RunBundle("/uninstall");
return !IsInstalled;
}
private void RunBundle(string additionalArguments)
{
var arguments = $"/q /norestart {additionalArguments}";
var process = Process.Start(_bundleFile, arguments);
if (!process.WaitForExit(5 * 60 * 1000))
{
throw new InvalidOperationException($"Failed to wait for the installation operation to complete. Check to see if the installation process is still running. Command line: {_bundleFile} {arguments}");
}
else if (0 != process.ExitCode)
{
throw new InvalidOperationException($"The installation operation failed with exit code: {process.ExitCode}. Command line: {_bundleFile} {arguments}");
}
}
}
}

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<Theme xmlns="http://wixtoolset.org/schemas/thmutil/2010">
<Window Width="620" Height="418" HexStyle="100a0000" FontId="0">#(loc.Caption)</Window>
<Font Id="0" Height="-12" Weight="500" Foreground="000000" Background="FFFFFF">Segoe UI</Font>
<Font Id="1" Height="-36" Weight="900" Foreground="FFFFFF" Background="682079">Segoe UI</Font>
<Font Id="2" Height="-22" Weight="500" Foreground="666666">Segoe UI</Font>
<Font Id="3" Height="-12" Weight="500" Foreground="000000" Background="FFFFFF">Segoe UI</Font>
<Font Id="4" Height="-12" Weight="500" Foreground="ff0000" Background="FFFFFF" Underline="yes">Segoe UI</Font>
<Font Id="5" Height="-14" Weight="500" Foreground="444444">Segoe UI</Font>
<Text X="11" Y="11" Width="-11" Height="64" FontId="1" Visible="yes" Center="yes" DisablePrefix="yes">#(loc.Title)</Text>
<Page Name="Help">
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.HelpHeader)</Text>
<Text X="20" Y="115" Width="-11" Height="-35" FontId="3" DisablePrefix="yes">#(loc.HelpText)</Text>
<Button Name="HelpCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.HelpCloseButton)</Button>
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
</Page>
<Page Name="Install">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text Name="InstallVersion" X="11" Y="80" Width="135" Height="30" FontId="2" DisablePrefix="yes" HideWhenDisabled="yes">v[DisplayVersion]</Text>
<Text X="11" Y="110" Width="135" Height="30" FontId="2" DisablePrefix="yes">[ReleaseSuffix] [BuildType]</Text>
<Text X="11" Y="145" Width="135" Height="100" FontId="5" DisablePrefix="yes">#(loc.Motto)</Text>
<Text X="155" Y="80" Width="-11" Height="-70" TabStop="no" FontId="2" HexStyle="0x800000" DisablePrefix="yes" />
<Richedit Name="EulaRichedit" X="158" Y="81" Width="-12" Height="-71" TabStop="yes" FontId="0" />
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>
</Page>
<Page Name="Options">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Text>
<Text X="11" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OptionsLocationLabel)</Text>
<Editbox Name="FolderEditbox" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" />
<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">#(loc.OptionsBrowseButton)</Button>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button>
<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsCancelButton)</Button>
</Page>
<Page Name="FilesInUse">
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.FilesInUseHeader)</Text>
<Text X="11" Y="121" Width="-11" Height="34" FontId="3" DisablePrefix="yes">#(loc.FilesInUseLabel)</Text>
<Text Name="FilesInUseText" X="11" Y="150" Width="-11" Height="-86" FontId="3" DisablePrefix="yes" HexStyle="0x0000000C">A</Text>
<Button Name="FilesInUseCloseRadioButton" X="300" Y="-65" Width="-11" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes" HexStyle="0x000009">#(loc.FilesInUseCloseRadioButton)</Button>
<Button Name="FilesInUseDontCloseRadioButton" X="300" Y="-45" Width="-11" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes" HexStyle="0x000009">#(loc.FilesInUseDontCloseRadioButton)</Button>
<Button Name="FilesInUseOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FilesInUseOkButton)</Button>
<Button Name="FilesInUseCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.FilesInUseCancelButton)</Button>
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
</Page>
<Page Name="Progress">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ProgressHeader)</Text>
<Text X="11" Y="121" Width="70" Height="17" FontId="3" DisablePrefix="yes">#(loc.ProgressLabel)</Text>
<Text Name="OverallProgressPackageText" X="85" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OverallProgressPackageText)</Text>
<Progressbar Name="OverallCalculatedProgressbar" X="11" Y="143" Width="-11" Height="15" />
<Button Name="ProgressCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ProgressCancelButton)</Button>
</Page>
<Page Name="Modify">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ModifyHeader)</Text>
<Button Name="RepairButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.ModifyRepairButton)</Button>
<Button Name="UninstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyUninstallButton)</Button>
<Button Name="ModifyCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyCloseButton)</Button>
</Page>
<Page Name="Success">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text Name="SuccessHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessHeader)</Text>
<Text Name="SuccessInstallHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessInstallHeader)</Text>
<Text Name="SuccessRepairHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessRepairHeader)</Text>
<Text Name="SuccessUninstallHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessUninstallHeader)</Text>
<Button Name="LaunchButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessLaunchButton)</Button>
<Text Name="SuccessRestartText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessRestartText)</Text>
<Button Name="SuccessRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessRestartButton)</Button>
<Button Name="SuccessCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.SuccessCloseButton)</Button>
</Page>
<Page Name="Failure">
<Image X="0" Y="0" Width="620" Height="418" ImageFile="bg.png" />
<Text X="0" Y="0" Width="620" Height="75" FontId="1" />
<Text Name="FailureHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureHeader)</Text>
<Text Name="FailureInstallHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureInstallHeader)</Text>
<Text Name="FailureUninstallHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureUninstallHeader)</Text>
<Text Name="FailureRepairHeader" X="11" Y="80" Width="-11" Height="30" FontId="2" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureRepairHeader)</Text>
<Hypertext Name="FailureLogFileLink" X="11" Y="121" Width="-11" Height="42" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext>
<Hypertext Name="FailureMessageText" X="22" Y="163" Width="-11" Height="51" FontId="3" TabStop="yes" HideWhenDisabled="yes" />
<Text Name="FailureRestartText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureRestartText)</Text>
<Button Name="FailureRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button>
<Button Name="FailureCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.FailureCloseButton)</Button>
</Page>
</Theme>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" Language="1033" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="Caption">[WixBundleName] Setup</String>
<String Id="Title">Microsoft Dotnet CLI for Windows</String>
<String Id="Motto">You just need a shell, a text editor and 10 minutes of your time.
Ready? Set? Let's go!</String>
<String Id="ConfirmCancelMessage">Are you sure you want to cancel?</String>
<String Id="ExecuteUpgradeRelatedBundleMessage">Previous version</String>
<String Id="HelpHeader">Setup Help</String>
<String Id="HelpText">/install | /repair | /uninstall | /layout [directory] - installs, repairs, uninstalls or
creates a complete local copy of the bundle in directory. Install is the default.
/passive | /quiet - displays minimal UI with no prompts or displays no UI and
no prompts. By default UI and all prompts are displayed.
/norestart - suppress any attempts to restart. By default UI will prompt before restart.
/log log.txt - logs to a specific file. By default a log file is created in %TEMP%.</String>
<String Id="HelpCloseButton">&amp;Close</String>
<String Id="InstallAcceptCheckbox">I &amp;agree to the license terms and conditions</String>
<String Id="InstallOptionsButton">&amp;Options</String>
<String Id="InstallInstallButton">&amp;Install</String>
<String Id="InstallCloseButton">&amp;Close</String>
<String Id="OptionsHeader">Setup Options</String>
<String Id="OptionsLocationLabel">Install location:</String>
<String Id="OptionsBrowseButton">&amp;Browse</String>
<String Id="OptionsOkButton">&amp;OK</String>
<String Id="OptionsCancelButton">&amp;Cancel</String>
<String Id="ProgressHeader">Setup Progress</String>
<String Id="ProgressLabel">Processing:</String>
<String Id="OverallProgressPackageText">Initializing...</String>
<String Id="ProgressCancelButton">&amp;Cancel</String>
<String Id="ModifyHeader">Modify Setup</String>
<String Id="ModifyRepairButton">&amp;Repair</String>
<String Id="ModifyUninstallButton">&amp;Uninstall</String>
<String Id="ModifyCloseButton">&amp;Close</String>
<String Id="SuccessRepairHeader">Repair Successfully Completed</String>
<String Id="SuccessUninstallHeader">Uninstall Successfully Completed</String>
<String Id="SuccessInstallHeader">Installation Successfully Completed</String>
<String Id="SuccessHeader">Setup Successful</String>
<String Id="SuccessLaunchButton">&amp;Launch</String>
<String Id="SuccessRestartText">You must restart your computer before you can use the software.</String>
<String Id="SuccessRestartButton">&amp;Restart</String>
<String Id="SuccessCloseButton">&amp;Close</String>
<String Id="FailureHeader">Setup Failed</String>
<String Id="FailureInstallHeader">Setup Failed</String>
<String Id="FailureUninstallHeader">Uninstall Failed</String>
<String Id="FailureRepairHeader">Repair Failed</String>
<String Id="FailureHyperlinkLogText">One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the &lt;a href="#"&gt;log file&lt;/a&gt;.</String>
<String Id="FailureRestartText">You must restart your computer to complete the rollback of the software.</String>
<String Id="FailureRestartButton">&amp;Restart</String>
<String Id="FailureCloseButton">&amp;Close</String>
<String Id="FilesInUseHeader">Files In Use</String>
<String Id="FilesInUseLabel">The following applications are using files that need to be updated:</String>
<String Id="FilesInUseCloseRadioButton">Close the &amp;applications and attempt to restart them.</String>
<String Id="FilesInUseDontCloseRadioButton">&amp;Do not close applications. A reboot will be required.</String>
<String Id="FilesInUseOkButton">&amp;OK</String>
<String Id="FilesInUseCancelButton">&amp;Cancel</String>
</WixLocalization>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:swid="http://schemas.microsoft.com/wix/TagExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include "Variables.wxi" ?>
<Bundle Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)"
Version="$(var.DisplayVersion)" UpgradeCode="70A1576F-63B6-4659-9E39-25C7B769DDE5"
AboutUrl="http://dotnet.github.io/"
Compressed="yes">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
<bal:WixStandardBootstrapperApplication
LicenseFile="..\osx\resources\en.lproj\eula.rtf"
ShowFilesInUse="yes"
ShowVersion="yes"
/>
<PayloadGroupRef Id="DotnetCoreBAPayloads" />
</BootstrapperApplicationRef>
<swid:Tag Regid="microsoft.com" InstallPath="[DOTNETHOME]" />
<Variable Name="BuildType" Value="$(var.BuildType)" />
<Variable Name="DisplayVersion" Value="$(var.DisplayVersion)" />
<Variable Name="ReleaseSuffix" Value="$(var.ReleaseSuffix)" />
<Variable Name="DOTNETHOME" Type="string" Value="[ProgramFiles6432Folder]dotnet" bal:Overridable="yes" />
<util:RegistrySearch Id="PreviousInstallFolderSearch" Root="HKLM" Key="SOFTWARE\dotnet\Setup" Value="InstallDir" Variable="PreviousInstallFolder" />
<util:DirectorySearch Path="[PreviousInstallFolder]" Variable="DOTNETHOME" After="PreviousInstallFolderSearch" Condition="PreviousInstallFolder" />
<Chain DisableSystemRestore="yes" ParallelCache="yes">
<MsiPackage SourceFile="$(var.MsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<PayloadGroup Id="DotnetCoreBAPayloads">
<Payload Name="thm.xml" Compressed="yes" SourceFile="bundle.thm" />
<Payload Name="thm.wxl" Compressed="yes" SourceFile="bundle.wxl" />
<Payload Name="bg.png" Compressed="yes" SourceFile="..\osx\resources\dotnetbackground.png" />
<Payload Name='eula.rtf' Compressed='yes' SourceFile='!(wix.WixStdbaLicenseRtf)' />
</PayloadGroup>
<CustomTable Id='WixStdbaInformation'>
<Row>
<Data Column='LicenseFile'>eula.rtf</Data>
</Row>
</CustomTable>
</Fragment>
</Wix>

View file

@ -6,7 +6,7 @@
<MajorUpgrade DowngradeErrorMessage="$(var.DowngradeErrorMessage)" Schedule="afterInstallInitialize"/>
<MediaTemplate CompressionLevel="high" EmbedCab="yes"/>
<MediaTemplate CabinetTemplate="dnet-{0}.cab" CompressionLevel="high" />
<Feature Id="MainFeature" Title="Main Feature" Level="1">
<ComponentGroupRef Id="InstallFiles" />

View file

@ -8,6 +8,7 @@ param(
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
$DotnetMSIOutput = ""
$DotnetBundleOutput = ""
$WixRoot = ""
$InstallFileswsx = "install-files.wxs"
$InstallFilesWixobj = "install-files.wixobj"
@ -19,7 +20,7 @@ function AcquireWixTools
Write-Host Restoring Wixtools..
$result = $env:TEMP
.\dotnet restore $RepoRoot\packaging\windows\WiXTools --packages $result | Out-Null
if($LastExitCode -ne 0)
@ -32,14 +33,14 @@ function AcquireWixTools
$result = Join-Path $result WiX\3.10.0.2103-pre1\tools
}
popd
popd
return $result
}
function RunHeat
{
$result = $true
pushd "$WixRoot"
$result = $true
pushd "$WixRoot"
Write-Host Running heat..
@ -63,7 +64,8 @@ function RunCandle
Write-Host Running candle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
.\candle.exe -dDotnetSrc="$inputDir" `
.\candle.exe -nologo `
-dDotnetSrc="$inputDir" `
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
@ -92,14 +94,20 @@ function RunLight
pushd "$WixRoot"
Write-Host Running light..
$CabCache = Join-Path $WixRoot "cabcache"
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
.\light -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
.\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
-cultures:en-us `
dotnet.wixobj `
provider.wixobj `
registrykeys.wixobj `
checkbuildtype.wixobj `
$InstallFilesWixobj `
-b "$inputDir" `
-b "$AuthWsxRoot" `
-reusecab `
-cc "$CabCache" `
-out $DotnetMSIOutput | Out-Host
if($LastExitCode -ne 0)
@ -112,19 +120,80 @@ function RunLight
return $result
}
function RunCandleForBundle
{
$result = $true
pushd "$WixRoot"
Write-Host Running candle for bundle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
.\candle.exe -nologo `
-dDotnetSrc="$inputDir" `
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
-dReleaseSuffix="$env:ReleaseSuffix" `
-dMsiSourcePath="$DotnetMSIOutput" `
-arch x64 `
-ext WixBalExtension.dll `
-ext WixUtilExtension.dll `
-ext WixTagExtension.dll `
"$AuthWsxRoot\bundle.wxs" | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Candle failed with exit code $LastExitCode."
}
popd
return $result
}
function RunLightForBundle
{
$result = $true
pushd "$WixRoot"
Write-Host Running light for bundle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
.\light.exe -nologo `
-cultures:en-us `
bundle.wixobj `
-ext WixBalExtension.dll `
-ext WixUtilExtension.dll `
-ext WixTagExtension.dll `
-b "$AuthWsxRoot" `
-out $DotnetBundleOutput | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Light failed with exit code $LastExitCode."
}
popd
return $result
}
if(!(Test-Path $inputDir))
{
throw "$inputDir not found"
}
if(!(Test-Path $PackageDir))
if(!(Test-Path $PackageDir))
{
mkdir $PackageDir | Out-Null
}
$DotnetMSIOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.msi"
$DotnetBundleOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.exe"
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"
Write-Host "Creating dotnet Bundle at $DotnetBundleOutput"
$WixRoot = AcquireWixTools
@ -135,7 +204,7 @@ if([string]::IsNullOrEmpty($WixRoot))
}
if(-Not (RunHeat))
{
{
Exit -1
}
@ -144,18 +213,35 @@ if(-Not (RunCandle))
Exit -1
}
if(-Not (RunCandleForBundle))
{
Exit -1
}
if(-Not (RunLight))
{
Exit -1
}
if(-Not (RunLightForBundle))
{
Exit -1
}
if(!(Test-Path $DotnetMSIOutput))
{
throw "Unable to create the dotnet msi."
Exit -1
}
if(!(Test-Path $DotnetBundleOutput))
{
throw "Unable to create the dotnet bundle."
Exit -1
}
Write-Host -ForegroundColor Green "Successfully created dotnet MSI - $DotnetMSIOutput"
Write-Host -ForegroundColor Green "Successfully created dotnet bundle - $DotnetBundleOutput"
_ $PSScriptRoot\testmsi.ps1 @("$DotnetMSIOutput")