@@ -50,34 +50,67 @@ step -message "Creating Installer.wixproj"
50
50
51
51
[xml ]$installer = Get-Content " $PSScriptRoot \source\installer.wixproj"
52
52
53
+ Write-Host " Setting project information."
54
+
53
55
$installer.Project.PropertyGroup [0 ].OutputName = " $Product ($Version )"
54
56
$installer.Project.PropertyGroup [0 ].ProjectGuid = " $ProjectGUID "
55
57
$installer.Project.PropertyGroup [0 ].ProductVersion = $Version
56
58
$installer.Project.PropertyGroup [1 ].DefineConstants = " Debug;HarvestPath=$Path ;ProductVersion=$Version "
57
59
$installer.Project.PropertyGroup [2 ].DefineConstants = " HarvestPath=$Path ;ProductVersion=$Version "
58
60
$installer.Project.Target [0 ].HeatDirectory.Directory = $Path
59
61
62
+ Write-Host " Saving to .\build"
63
+
60
64
$installer.Save (" $PSScriptRoot \build\installer.wixproj" )
61
65
62
66
step - message " Creating Product.wxs"
63
67
64
68
$productwxs = New-Object xml
65
69
$productwxs.Load (" $PSScriptRoot \source\product.wxs" )
66
70
71
+ Write-Host " Setting product information."
72
+
67
73
$productwxs.Wix.Product.Name = $Product
68
74
$productwxs.Wix.Product.Version = $Version
69
75
$productwxs.Wix.Product.Manufacturer = $Manufacturer
70
76
$productwxs.Wix.Product.UpgradeCode = $UpgradeGUID
71
77
78
+ Write-Host " Creating directories."
79
+
72
80
$productwxs.Wix.Product.Directory.Directory [0 ].Directory.Name = $Product
73
- $productwxs.Wix.Product.Directory.Directory [0 ].Directory.Component.File.Source = " $Path \$Executable "
81
+
82
+ $installDir = $productwxs.Wix.Product.Directory.Directory [0 ].Directory
83
+ $installDir.Component.File.Source = " $Path \$Executable "
84
+
85
+ $dirs = $Executable.split (' \' )
86
+ $i = 1
87
+
88
+ forEach ($dir in $dirs ){
89
+ if ($dir -notmatch ' \.exe$' ){
90
+ $exeDir = $installDir.Clone ()
91
+
92
+ $component = $installDir.Component
93
+ $installDir.RemoveChild ($component ) | Out-Null
94
+
95
+ $exeDir.Id = " EXEDIR_$i "
96
+ $exeDir.Name = $dir
97
+ $installDir.appendChild ($exeDir ) | Out-Null
98
+ $installDir = $exeDir
99
+ $i = $i + 1
100
+ }
101
+ }
102
+
103
+
104
+
105
+ Write-Host " Creating start menu shortcut."
106
+
74
107
$productwxs.Wix.Product.Directory.Directory [1 ].Component.Shortcut.Name = $Product
75
108
$productwxs.Wix.Product.Directory.Directory [1 ].Component.Shortcut.Description = $Product
76
109
$productwxs.Wix.Product.Directory.Directory [1 ].Component.Shortcut.Target = " [INSTALLDIR]$Executable "
77
110
$productwxs.Wix.Product.Directory.Directory [1 ].Component.RegistryValue.Key = " Software\$Product "
78
111
79
112
if ($Desktop ){
80
- Write-Host " Adding desktop shortcut"
113
+ Write-Host " Creating desktop shortcut"
81
114
82
115
$desktopDirectory = $productwxs.Wix.Product.Directory.Directory [1 ].Clone()
83
116
$desktopDirectory.Component.Shortcut.Id = " DesktopShortcut_001"
@@ -94,6 +127,8 @@ $productwxs.Wix.Product.Icon.SourceFile = "$Path\$Executable"
94
127
95
128
$productwxs.Wix.Product.Feature.Title = $Product
96
129
130
+ Write-Host " Setting contact information."
131
+
97
132
$productwxs.Wix.Product.Property [0 ].Value = $Contact
98
133
$productwxs.Wix.Product.Property [1 ].Value = $HelpLink
99
134
$productwxs.Wix.Product.Property [3 ].Value = $AboutLink
@@ -115,13 +150,17 @@ if($FileType){
115
150
$productwxs.Wix.Product.Directory.Directory [0 ].Directory.Component.appendChild($appendable.ProgId ) | Out-Null
116
151
}
117
152
153
+ Write-Host " Saving to .\build"
154
+
118
155
$productwxs.Save (" $PSScriptRoot \build\product.wxs" )
119
156
120
157
step - message " Create Transform"
121
158
122
159
[xml ]$transform = Get-Content " $PSScriptRoot \source\transform.xslt"
123
160
124
- $transform.stylesheet.key.match = " wix:Component[contains(wix:File/@Source, '$Executable ')]"
161
+ $exe = Split-Path - Path " $Path \$Executable " - Leaf - Resolve
162
+
163
+ $transform.stylesheet.key.match = " wix:Component[contains(wix:File/@Source, '$exe ')]"
125
164
126
165
$transform.Save (" $PSScriptRoot \build\transform.xslt" )
127
166
0 commit comments