Skip to content

Commit 67400cb

Browse files
committed
New wix setup scripts
1 parent cb8e65a commit 67400cb

File tree

9 files changed

+277
-12
lines changed

9 files changed

+277
-12
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ paket-files/
259259
# Python Tools for Visual Studio (PTVS)
260260
__pycache__/
261261
*.pyc
262-
Setup/harvest\.wxs
263-
/Setup/harvest2.wxs
264-
/Setup/harvest3.wxs
262+
harvest.wxs
263+
harvest2.wxs
264+
harvest3.wxs
265265
Setup/SignParams.ps1
266266
SetupBootstrapper/SignParams.ps1
267+
*.wixobj

Setup/buildmsi.ps1

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
param (
2+
[Parameter(Mandatory=$false)]
3+
[string]$BuildVersion = "1.0.0.0",
4+
[Parameter(Mandatory=$false)]
5+
[string]$Platform = "x64",
6+
[Parameter(Mandatory=$false)]
7+
[string]$WixBinPath = "c:\Program Files (x86)\WiX Toolset v3.11\bin"
8+
)
9+
10+
Set-Location $PSScriptRoot
11+
12+
# Remove previous builds
13+
If(Test-Path $PSScriptRoot\bin\$Platform\Release\* -PathType Any) {
14+
Remove-Item $PSScriptRoot\bin\$Platform\Release\*
15+
}
16+
17+
18+
19+
$heatArgs = @(
20+
"dir",
21+
"$PSScriptRoot\..\SqlWorkload\bin\$Platform\release",
22+
"-gg",
23+
"-sfrag",
24+
"-sreg",
25+
"-srd",
26+
"-nologo",
27+
"-cg",
28+
"ProductComponents",
29+
"-dr"
30+
"INSTALLFOLDER",
31+
"-out",
32+
"$PSScriptRoot\harvest.wxs",
33+
"-var",
34+
"var.SqlWorkload.TargetDir",
35+
"-t",
36+
"$PSScriptRoot\transform.xsl"
37+
)
38+
39+
# Write-Host $heatArgs
40+
41+
& "$WixBinPath\heat.exe" @heatArgs
42+
43+
44+
45+
46+
$heatArgs = @(
47+
"dir",
48+
"$PSScriptRoot\..\WorkloadViewer\bin\$Platform\release",
49+
"-gg",
50+
"-sfrag",
51+
"-sreg",
52+
"-srd",
53+
"-nologo",
54+
"-cg",
55+
"WorkloadViewerComponents",
56+
"-dr"
57+
"INSTALLFOLDER",
58+
"-out",
59+
"$PSScriptRoot\harvest2.wxs",
60+
"-var",
61+
"var.WorkloadViewer.TargetDir",
62+
"-t",
63+
"$PSScriptRoot\transform.xsl",
64+
"-t",
65+
"$PSScriptRoot\transform2.xsl"
66+
)
67+
68+
69+
# Write-Host "$WixBinPath\heat.exe"
70+
# Write-Host $heatArgs
71+
72+
& "$WixBinPath\heat.exe" @heatArgs
73+
74+
75+
76+
77+
78+
79+
80+
$heatArgs = @(
81+
"dir",
82+
"$PSScriptRoot\..\ConvertWorkload\bin\release",
83+
"-gg",
84+
"-sfrag",
85+
"-sreg",
86+
"-srd",
87+
"-nologo",
88+
"-cg",
89+
"ConvertWorkloadComponents",
90+
"-dr"
91+
"INSTALLFOLDER",
92+
"-out",
93+
"$PSScriptRoot\harvest3.wxs",
94+
"-var",
95+
"var.ConvertWorkload.TargetDir",
96+
"-t",
97+
"$PSScriptRoot\transform.xsl",
98+
"-t",
99+
"$PSScriptRoot\transform2.xsl"
100+
"-t",
101+
"$PSScriptRoot\transform3.xsl"
102+
)
103+
104+
# Write-Host "$WixBinPath\heat.exe"
105+
# Write-Host $heatArgs
106+
107+
& "$WixBinPath\heat.exe" @heatArgs
108+
109+
110+
#----------------------------------------------------------------
111+
112+
113+
$candleArgs = @(
114+
"-nologo",
115+
"-out",
116+
"$PSScriptRoot\candleout\",
117+
"-dSqlWorkload.TargetDir=`"$PSScriptRoot\..\SqlWorkload\bin\$Platform\release`""
118+
"-dWorkloadViewer.TargetDir=`"$PSScriptRoot\..\WorkloadViewer\bin\$Platform\release`""
119+
"-dConvertWorkload.TargetDir=`"$PSScriptRoot\..\ConvertWorkload\bin\release`""
120+
"-dBuildVersion=$BuildVersion",
121+
"-dPlatform=$Platform",
122+
"$PSScriptRoot\Product.wxs",
123+
"$PSScriptRoot\harvest.wxs",
124+
"$PSScriptRoot\harvest2.wxs",
125+
"$PSScriptRoot\harvest3.wxs",
126+
"-arch"
127+
"$Platform"
128+
)
129+
130+
# Write-Host $candleArgs
131+
132+
& "$WixBinPath\candle.exe" @candleArgs
133+
134+
#----------------------------------------------------------------
135+
136+
$lightArgs = @(
137+
"-out",
138+
".\bin\$Platform\Release\WorkloadTools.msi"
139+
"$PSScriptRoot\candleout\*.wixobj",
140+
"-ext",
141+
"WixUIExtension"
142+
)
143+
144+
# Write-Host $lightArgs
145+
146+
147+
& "$WixBinPath\light.exe" @lightArgs
148+
149+
150+
. $PSScriptRoot\SignMsi.ps1 -InputFile ".\bin\$Platform\Release\WorkloadTools.msi" -OutputFile ".\bin\$Platform\Release\WorkloadTools_$Platform.msi"

Setup/transform2.xsl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,24 @@
3030
<xsl:key name="commandline-search" match="wix:Component[contains(wix:File/@Source, 'CommandLine.')]" use="@Id" />
3131
<xsl:template match="wix:Component[key('commandline-search', @Id)]" />
3232
<xsl:template match="wix:ComponentRef[key('commandline-search', @Id)]" />
33-
33+
3434
<xsl:key name="nlog-search" match="wix:Component[contains(wix:File/@Source, 'NLog.')]" use="@Id" />
3535
<xsl:template match="wix:Component[key('nlog-search', @Id)]" />
3636
<xsl:template match="wix:ComponentRef[key('nlog-search', @Id)]" />
37+
38+
<xsl:key name="config-search" match="wix:Directory[@Name='Config']" use="@Id" />
39+
<xsl:template match="wix:Directory[key('config-search', @Id)]" />
40+
<xsl:template match="wix:DirectoryRef[key('config-search', @Id)]" />
41+
42+
<xsl:key name="consumer-search" match="wix:Directory[@Name='Consumer']" use="@Id" />
43+
<xsl:template match="wix:Directory[key('consumer-search', @Id)]" />
44+
<xsl:template match="wix:DirectoryRef[key('consumer-search', @Id)]" />
45+
46+
<xsl:key name="listener-search" match="wix:Directory[@Name='Listener']" use="@Id" />
47+
<xsl:template match="wix:Directory[key('listener-search', @Id)]" />
48+
<xsl:template match="wix:DirectoryRef[key('listener-search', @Id)]" />
49+
50+
<xsl:key name="sql-search" match="wix:Component[contains(wix:File/@Source, '.sql')]" use="@Id" />
51+
<xsl:template match="wix:Component[key('sql-search', @Id)]" />
52+
<xsl:template match="wix:ComponentRef[key('sql-search', @Id)]" />
3753
</xsl:stylesheet>

Setup/transform3.xsl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" ?>
2+
<xsl:stylesheet version="1.0"
3+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4+
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
5+
6+
<!-- Copy all attributes and elements to the output. -->
7+
<xsl:template match="@*|*">
8+
<xsl:copy>
9+
<xsl:apply-templates select="@*" />
10+
<xsl:apply-templates select="*" />
11+
</xsl:copy>
12+
</xsl:template>
13+
14+
<xsl:output method="xml" indent="yes" />
15+
16+
<!--
17+
This section includes all the files that MUST not be included
18+
in the setup, because they are already included by other projects.
19+
In this list we will include the libraries (nuget packages) that are
20+
already included in the SqlWorkload project, in order to avoid collisions.
21+
22+
##########################################################################
23+
REMEMBER THAT THE MATCH IS CASE-SENSITIVE!!!
24+
If your setup is not building, please double check the case of the items
25+
that you want to exclude
26+
##########################################################################
27+
28+
-->
29+
30+
<xsl:key name="unwanted-search" match="wix:Component[not(contains(wix:File/@Source, '\ConvertWorkload.'))]" use="@Id" />
31+
<xsl:template match="wix:Component[key('unwanted-search', @Id)]" />
32+
<xsl:template match="wix:ComponentRef[key('unwanted-search', @Id)]" />
33+
34+
</xsl:stylesheet>

SetupBootstrapper/Bundle.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
<?define ProductName="WorkloadTools" ?>
1717
<?define CompanyName="sqlconsulting.it" ?>
18-
<!-- <?define ProductVersion="$(var.BuildVersion)" ?> -->
18+
<?define ProductVersion="$(var.BuildVersion)" ?>
1919

2020

2121

22-
<Bundle Name="$(var.ProductName)" Version="!(bind.packageVersion.WorkloadToolsMsi)" Manufacturer="$(var.CompanyName)" UpgradeCode="cad976c4-d0c6-4313-b605-ec3749a23b5f">
22+
<Bundle Name="$(var.ProductName)" Version="$(var.ProductVersion)" Manufacturer="$(var.CompanyName)" UpgradeCode="cad976c4-d0c6-4313-b605-ec3749a23b5f">
2323
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
2424
<bal:WixStandardBootstrapperApplication
2525
LicenseFile="License\License.rtf"

SetupBootstrapper/buildexe.ps1

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
param (
2+
[Parameter(Mandatory=$false)]
3+
[string]$BuildVersion = "1.0.0.0",
4+
[Parameter(Mandatory=$false)]
5+
[string]$Platform = "x64",
6+
[Parameter(Mandatory=$false)]
7+
[string]$WixBinPath = "c:\Program Files (x86)\WiX Toolset v3.11\bin"
8+
)
9+
10+
11+
. $PSScriptRoot\..\Setup\buildmsi.ps1 -BuildVersion $BuildVersion -Platform $Platform -WixBinPath $WixBinPath
12+
13+
Set-Location $PSScriptRoot
14+
15+
# Remove previous builds
16+
If(Test-Path $PSScriptRoot\bin\$Platform\Release\* -PathType Any) {
17+
Remove-Item $PSScriptRoot\bin\$Platform\Release\*
18+
}
19+
20+
21+
if($BuildVersion -eq "1.0.0.0") {
22+
# Try to read from SharedAssemblyInfo
23+
$BuildVersion = (Get-Content ..\SharedAssemblyInfo.cs | Where-Object { $_.StartsWith("[assembly: AssemblyVersion(") }).Replace('[assembly: AssemblyVersion("','').Replace('")]','')
24+
}
25+
26+
#----------------------------------------------------------------
27+
28+
29+
$candleArgs = @(
30+
"-nologo",
31+
"-out",
32+
"$PSScriptRoot\candleout\",
33+
"-dBuildVersion=$BuildVersion",
34+
"-dPlatform=$Platform",
35+
"$PSScriptRoot\Bundle.wxs",
36+
"-arch",
37+
"$Platform",
38+
"-ext",
39+
"WixBalExtension"
40+
)
41+
42+
# Write-Host $candleArgs
43+
44+
& "$WixBinPath\candle.exe" @candleArgs
45+
46+
#----------------------------------------------------------------
47+
48+
$lightArgs = @(
49+
"-out",
50+
".\bin\Release\WorkloadTools.exe"
51+
"$PSScriptRoot\candleout\*.wixobj",
52+
"-ext",
53+
"WixUIExtension",
54+
"-ext",
55+
"WixBalExtension"
56+
)
57+
58+
# Write-Host $lightArgs
59+
60+
61+
& "$WixBinPath\light.exe" @lightArgs
62+
63+
. $PSScriptRoot\SignMsi.ps1 -InputFile ".\bin\Release\WorkloadTools.exe" -OutputFile ".\bin\Release\WorkloadTools_$Platform.exe"

SharedAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
// You can specify all the values or you can default the Build and Revision Numbers
3030
// by using the '*' as shown below:
3131
// [assembly: AssemblyVersion("1.0.*")]
32-
[assembly: AssemblyVersion("1.6.5")]
33-
[assembly: AssemblyFileVersion("1.6.5")]
32+
[assembly: AssemblyVersion("1.7.0")]
33+
[assembly: AssemblyFileVersion("1.7.0")]

WorkloadTools.sln

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ Global
7676
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Debug|x86.ActiveCfg = Debug|x86
7777
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Release|Any CPU.ActiveCfg = Release|x86
7878
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Release|x64.ActiveCfg = Release|x64
79-
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Release|x64.Build.0 = Release|x64
8079
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Release|x86.ActiveCfg = Release|x86
81-
{BBF5FDA0-C08F-48C9-9B98-E017DD8ABB5D}.Release|x86.Build.0 = Release|x86
8280
{62E37C03-BA08-46CE-A583-D71FB7A8825B}.Debug|Any CPU.ActiveCfg = Debug|x86
8381
{62E37C03-BA08-46CE-A583-D71FB7A8825B}.Debug|Any CPU.Build.0 = Debug|x86
8482
{62E37C03-BA08-46CE-A583-D71FB7A8825B}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -120,9 +118,7 @@ Global
120118
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Debug|x86.ActiveCfg = Debug|x86
121119
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Release|Any CPU.ActiveCfg = Release|x86
122120
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Release|x64.ActiveCfg = Release|x64
123-
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Release|x64.Build.0 = Release|x64
124121
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Release|x86.ActiveCfg = Release|x86
125-
{CAD976C4-D0C6-4313-B605-EC3749A23B5F}.Release|x86.Build.0 = Release|x86
126122
EndGlobalSection
127123
GlobalSection(SolutionProperties) = preSolution
128124
HideSolutionNode = FALSE

build.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
& msbuild.exe -t:Rebuild -p:Configuration=Release -p:Platform=x64
3+
. $PSScriptRoot\SetupBootstrapper\buildexe.ps1 -Platform x64
4+
& msbuild.exe -t:Rebuild -p:Configuration=Release -p:Platform=x86
5+
. $PSScriptRoot\SetupBootstrapper\buildexe.ps1 -Platform x86

0 commit comments

Comments
 (0)