forked from eXpandFramework/eXpand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXpand.nsi
386 lines (335 loc) · 11.7 KB
/
Xpand.nsi
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# Auto-generated by EclipseNSIS Script Wizard
# 16.02.2011 14:21:40
!define APP_NAME "eXpandFramework"
Name "${APP_NAME}"
RequestExecutionLevel admin
# General Symbol Definitions
!define REGKEY "SOFTWARE\${APP_NAME}"
!ifndef VERSION
!define VERSION 1.0
!endif
!ifndef DEVEXVERSION
!define DEVEXVERSION "v14.1"
!endif
!define COMPANY eXpandFramework
!define URL http://www.expandframework.com
!define MicrosoftSDKsREGKEY "SOFTWARE\Microsoft\Microsoft SDKs\Windows"
# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME}"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_WELCOMEFINISHPAGE_BITMAP "Resource\Installer\PageImage.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "Resource\Installer\PageImage.bmp"
# Included files
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
var gacutilPath
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile setup.exe
InstallDir $PROGRAMFILES\eXpandFramework
CRCCheck on
XPStyle on
ShowInstDetails show
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
VIProductVersion "${VERSION}.0.0"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "${APP_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription ""
VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright "© 2011"
ShowUninstDetails show
BrandingText "${APP_NAME} Install System v ${VERSION}"
# Installer sections
!macro CREATE_SMGROUP_SHORTCUT NAME PATH
Push "${NAME}"
Push "${PATH}"
Call CreateSMGroupShortcut
!macroend
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
File /r /x Xpand.DesignExperience Build\Installer\*
call InstallProjectTemplates
WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd
Section -post SEC0001
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath $SMPROGRAMS\$StartMenuGroup
!insertmacro CREATE_SMGROUP_SHORTCUT "Dll list" $INSTDIR\XpandDllList.txt
!insertmacro CREATE_SMGROUP_SHORTCUT "Source" $INSTDIR\Source.zip
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
# add To display an assembly in the Add Reference dialog box http://msdn.microsoft.com/en-us/library/wkze6zky.aspx
#WriteRegStr HKLM "SOFTWARE\Microsoft\.NETFramework\v3.0\AssemblyFoldersEx\Xpand" "" "$INSTDIR\Xpand.DLL"
#call DllsToGAC
ExecWait "$INSTDIR\Xpand.Dll\GACInstaller.exe" $0
ExecWait "$INSTDIR\Xpand.Dll\Xpand.ToolboxCreator.exe" $0
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
!macro SET_GACUTIL_PATH un
Function ${un}SetGacutilPath
ReadRegStr $0 HKLM "${MicrosoftSDKsREGKEY}" "CurrentInstallFolder"
StrCpy $gacutilPath "$0Bin\NETFX 4.0 Tools\gacutil.exe"
IfFileExists $gacutilPath +4 0
StrCmp "${un}" "un." 0 +2
MessageBox MB_OK "gacutil.exe not found! The DLLs can not be installed into the GAC."
MessageBox MB_OK "gacutil.exe not found! The DLLs can not be uninstalled from the GAC."
FunctionEnd
!macroend
!insertmacro SET_GACUTIL_PATH ""
!insertmacro SET_GACUTIL_PATH "un."
# Uninstaller sections
!macro DELETE_SMGROUP_SHORTCUT NAME
Push "${NAME}"
Call un.DeleteSMGroupShortcut
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
ExecWait '"$INSTDIR\Xpand.Dll\GACInstaller.exe" "" u' $0
ExecWait '"$INSTDIR\Xpand.Dll\Xpand.ToolboxCreator.exe" u' $0
!insertmacro DELETE_SMGROUP_SHORTCUT "Dll list"
!insertmacro DELETE_SMGROUP_SHORTCUT "Source"
RmDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
# remove To display an assembly in the Add Reference dialog box http://msdn.microsoft.com/en-us/library/wkze6zky.aspx
#DeleteRegKey HKLM "SOFTWARE\Microsoft\.NETFramework\v3.0\AssemblyFoldersEx\Xpand"
#call un.DllsFromGAC
call un.InstallProjectTemplates
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /REBOOTOK $INSTDIR
Push $R0
StrCpy $R0 $StartMenuGroup 1
StrCmp $R0 ">" no_smgroup
no_smgroup:
Pop $R0
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
#call SetGacutilPath
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
#call un.SetGacutilPath
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
#'"$INSTDIR\someprogram.exe" some parameters'
FunctionEnd
# Installer Language Strings
# TODO Update the Language Strings with the appropriate translations.
LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
;Function MakeFileList
; Exch $R0 #path
; Exch
; Exch $R1 #filter
; Exch
; Exch 2
; Exch $R2 #output file
; Exch 2
; Push $R3
; Push $R4
; Push $R5
; ClearErrors
; FindFirst $R3 $R4 "$R0\$R1"
; FileOpen $R5 $R2 w
;
; Loop:
; IfErrors Done
; FileWrite $R5 "$R0\$R4$\r$\n"
; FindNext $R3 $R4
; Goto Loop
;
; Done:
; FileClose $R5
; FindClose $R3
; Pop $R5
; Pop $R4
; Pop $R3
; Pop $R2
; Pop $R1
; Pop $R0
;FunctionEnd
;Function DllsToGAC
; IfFileExists $gacutilPath +3 0
; StrCpy $0 "1"
; Goto Ende
;
; # get all eXpand Dll's from the $INSTDIR and put into XpandDllList.txt
; Push "$INSTDIR\XpandDllList.txt" # output file
; Push "*.dll" # filter
; Push "$INSTDIR\Xpand.DLL" # folder to search in
; Call MakeFileList
;
; # install all eXpand Dll's to the GAC
; Exec '"$gacutilPath" /il "$INSTDIR\XpandDllList.txt" /f'
;
; Ende:
; StrCmp $0 "1" 0 +2
; DetailPrint "install assamblies into the GAC failed"
;FunctionEnd
;Function un.DllsFromGAC
; IfFileExists $gacutilPath +3 0
; StrCpy $0 "1"
; Goto Ende
;
; CreateDirectory "$TEMP\${APP_NAME}"
;
; StrCpy $3 "$TEMP\${APP_NAME}\getDlls.cmd"
; Delete $3
;
; StrCpy $1 "$TEMP\${APP_NAME}\tempDllList.txt"
;
; FileOpen $0 "$3" w
; # get all eXpand Dll's from the GAC and put into tempDllList.txt
; FileWrite $0 '"$gacutilPath" /l | find /i "Xpand." > "$1"'
; FileClose $0
;
; #ExecWait '"$gacutilPath" /l | find /i "Xpand." > "$1"'
; ExecWait "$3"
;
;
; # uninstall all eXpand Dll's to the GAC
; ExecWait '"$gacutilPath" /ul "$1" /f' $0
;
; RMDir /r "$TEMP\${APP_NAME}"
;
; Ende:
; StrCmp $0 "1" 0 +2
; DetailPrint "uninstall assamblies from the GAC failed"
;FunctionEnd
;
Function InstallProjectTemplatesFiles
Push $R0
Exch
Pop $R0
CreateDirectory "$R0ProjectTemplates\CSharp\DevExpress XAF"
File "/oname=$R0ProjectTemplates\CSharp\DevExpress XAF\XpandFullSolutionCS.${DevExVersion}.zip" "Build\Installer\Xpand.DesignExperience\vs_templates\cs\XpandFullSolutionCS.${DevExVersion}.zip"
CreateDirectory "$R0ProjectTemplates\VisualBasic\DevExpress XAF"
File "/oname=$R0ProjectTemplates\VisualBasic\DevExpress XAF\XpandFullSolutionVB.${DevExVersion}.zip" "Build\Installer\Xpand.DesignExperience\vs_templates\vb\XpandFullSolutionVB.${DevExVersion}.zip"
Pop $R0
FunctionEnd
Function un.InstallProjectTemplatesFiles
Push $R0
Exch
Pop $R0
Delete "$0ProjectTemplates\CSharp\DevExpress XAF\XpandFullSolutionCS.${DevExVersion}.zip"
Delete "$0ProjectTemplates\VisualBasic\DevExpress XAF\XpandFullSolutionVB.${DevExVersion}.zip"
Pop $R0
FunctionEnd
Function InstallProjectTemplates
Push $0
ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\9.0" "InstallDir"
StrCmp $0 "" +4 0
Push $0
call InstallProjectTemplatesFiles
WriteRegStr HKLM "${REGKEY}" "VS9Path" $0
ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\10.0" "InstallDir"
StrCmp $0 "" +4 0
Push $0
call InstallProjectTemplatesFiles
WriteRegStr HKLM "${REGKEY}" "VS10Path" $0
ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\11.0" "InstallDir"
StrCmp $0 "" +4 0
Push $0
call InstallProjectTemplatesFiles
WriteRegStr HKLM "${REGKEY}" "VS11Path" $0
ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\12.0" "InstallDir"
StrCmp $0 "" +4 0
Push $0
call InstallProjectTemplatesFiles
WriteRegStr HKLM "${REGKEY}" "VS12Path" $0
Exec "$0devenv.exe /InstallVSTemplates"
Pop $0
FunctionEnd
Function un.InstallProjectTemplates
Push $0
ReadRegStr $0 HKLM "${REGKEY}" VS9Path
StrCmp $0 "" +3 0
Push $0
call un.InstallProjectTemplatesFiles
ReadRegStr $0 HKLM "${REGKEY}" VS10Path
StrCmp $0 "" +3 0
Push $0
call un.InstallProjectTemplatesFiles
Pop $0
DeleteRegValue HKLM "${REGKEY}" VS9Path
DeleteRegValue HKLM "${REGKEY}" VS10Path
FunctionEnd
Function CreateSMGroupShortcut
Exch $R0 ;PATH
Exch
Exch $R1 ;NAME
Push $R2
StrCpy $R2 $StartMenuGroup 1
StrCmp $R2 ">" no_smgroup
SetOutPath $SMPROGRAMS\$StartMenuGroup
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$R1.lnk" $R0
no_smgroup:
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
Function un.DeleteSMGroupShortcut
Exch $R1 ;NAME
Push $R2
StrCpy $R2 $StartMenuGroup 1
StrCmp $R2 ">" no_smgroup
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$R1.lnk"
no_smgroup:
Pop $R2
Pop $R1
FunctionEnd