dotnet-installer/packaging/host/windows/generatemsi.ps1
Matt Ellis 04d21e6693 Add Shared Host MSI Authoring
Ideally in the project.json for the shared host we would just list the
actual package that holds the shared host, instead of all of
NetStandard.Library, but doing some leads to compliation errors, since
publish wants to include a compile step that has a generated
AssemblyAttributes file which references types like System.String.
2016-03-10 03:37:41 -08:00

109 lines
No EOL
2.6 KiB
PowerShell

# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
param(
[Parameter(Mandatory=$true)][string]$SharedHostPublishRoot,
[Parameter(Mandatory=$true)][string]$DotnetHostMSIOutput,
[Parameter(Mandatory=$true)][string]$WixRoot,
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
[Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$WixObjRoot
)
. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1"
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
function RunCandle
{
$result = $true
pushd "$WixRoot"
Write-Host Running candle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\host\windows"
.\candle.exe -nologo `
-out "$WixObjRoot\" `
-ext WixDependencyExtension.dll `
-dHostSrc="$SharedHostPublishRoot" `
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
-dBuildVersion="$DotnetMSIVersion" `
-dDisplayVersion="$DotnetCLIVersion" `
-arch $Architecture `
"$AuthWsxRoot\host.wxs" `
"$AuthWsxRoot\provider.wxs" `
"$AuthWsxRoot\registrykeys.wxs" | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Candle failed with exit code $LastExitCode."
}
popd
return $result
}
function RunLight
{
$result = $true
pushd "$WixRoot"
Write-Host Running light..
.\light.exe -nologo `
-ext WixUIExtension.dll `
-ext WixDependencyExtension.dll `
-ext WixUtilExtension.dll `
-cultures:en-us `
"$WixObjRoot\host.wixobj" `
"$WixObjRoot\provider.wixobj" `
"$WixObjRoot\registrykeys.wixobj" `
-out $DotnetHostMSIOutput | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Light failed with exit code $LastExitCode."
}
popd
return $result
}
if(!(Test-Path $SharedHostPublishRoot))
{
throw "$SharedHostPublishRoot not found"
}
if(!(Test-Path $WixObjRoot))
{
throw "$WixObjRoot not found"
}
Write-Host "Creating shared host MSI at $DotnetHostMSIOutput"
if([string]::IsNullOrEmpty($WixRoot))
{
Exit -1
}
if(-Not (RunCandle))
{
Exit -1
}
if(-Not (RunLight))
{
Exit -1
}
if(!(Test-Path $DotnetHostMSIOutput))
{
throw "Unable to create the shared host msi."
Exit -1
}
Write-Host -ForegroundColor Green "Successfully created shared host MSI - $DotnetHostMSIOutput"
exit $LastExitCode