forked from Particular/NServiceBus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSI.ps1
54 lines (42 loc) · 1.81 KB
/
MSI.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
properties {
$ProductVersion = "4.0"
$PatchVersion = "0"
$VsixFilePath = if($env:VSIX_PATH -ne $null) { $env:VSIX_PATH } else { "C:\Projects" }
$SignFile = if($env:SIGN_CER_PATH -ne $null) { $env:SIGN_CER_PATH } else { "" }
}
$baseDir = Split-Path (Resolve-Path $MyInvocation.MyCommand.Path)
$packageOutPutDir = "$baseDir\artifacts"
$toolsDir = "$baseDir\tools"
$buildWixPath = "$baseDir\build\wix\"
include $toolsDir\psake\buildutils.ps1
task default -depends Build, Sign
task Clean {
if ( -Not (Test-Path $packageOutPutDir))
{
New-Item $packageOutPutDir -ItemType Directory | Out-Null
} else {
Remove-Item ($packageOutPutDir + '\*.msi')
}
}
task Init {
$sdkInstallRoot = Get-RegistryValue "HKLM:\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1" "InstallationFolder"
echo "skdpath" $sdkInstallRoot
if($sdkInstallRoot -eq $null) {
$sdkInstallRoot = Get-RegistryValue "HKLM:\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" "InstallationFolder"
}
$netfxInstallroot = ""
$netfxInstallroot = Get-RegistryValue "HKLM:\SOFTWARE\Microsoft\.NETFramework\" "InstallRoot"
$netfxCurrent = $netfxInstallroot + "v4.0.30319"
$script:msBuild = $netfxCurrent + "\msbuild.exe"
$script:signTool = $sdkInstallRoot + "Bin\signtool.exe"
echo ".Net 4.0 build requested - $script:msBuild"
}
task Build -depends Clean, Init {
exec { &$script:msBuild $baseDir\src\wix\WixSolution.sln /t:"Clean,Build" /p:OutDir="$buildWixPath" /p:Configuration=Release /p:ProductVersion="$ProductVersion.$PatchVersion" /p:VsixPath="$VsixFilePath" }
copy $buildWixPath*.msi $packageOutPutDir\
}
task Sign -depends Init {
if($SignFile -ne "") {
exec { &$script:signTool sign /f "$SignFile" /p "$env:SIGN_CER_PASSWORD" /d "NServiceBus Installer" /du "http://www.nservicebus.com" /q $packageOutPutDir\*.msi }
}
}