Initial commit
This commit is contained in:
121
Creator/SetupTmpl.tt
Normal file
121
Creator/SetupTmpl.tt
Normal file
@ -0,0 +1,121 @@
|
||||
<#@ template language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
Unicode true
|
||||
ManifestDPIAware true
|
||||
!define APPNAME "<#= AppName #>"
|
||||
!define EXECUTABLE "<#= Executable #>"
|
||||
!define SOURCEPATH "<#= SourcePath #>"
|
||||
!define COMPANYNAME "<#= CompanyName #>"
|
||||
!define DESCRIPTION "<#= Description #>"
|
||||
!define VERSION <#= Version.ToString() #>
|
||||
!define HELPURL <#= HelpUrl #>
|
||||
!define INSTALLSIZE <#= InstallSize #>
|
||||
!define ISMANAGED <#= IsManaged ? 1 : 0 #>
|
||||
; exampleCmd: makensis.exe /DVERSION=1.0.0.5 /DNAME=WpfApp1 Setup.nsi
|
||||
|
||||
Name "${APPNAME}"
|
||||
OutFile "<#= OutFile #>"
|
||||
InstallDir "$LOCALAPPDATA\${APPNAME}"
|
||||
RequestExecutionLevel user
|
||||
SetCompressor /SOLID lzma
|
||||
SilentUnInstall silent
|
||||
; Subcaption 3 " "
|
||||
XPStyle on
|
||||
AutoCloseWindow true
|
||||
ChangeUI all "<#= UserInterface #>"
|
||||
Icon "<#= IconPath #>"
|
||||
UninstallIcon "<#= UninstallIcon #>"
|
||||
ShowInstDetails nevershow
|
||||
ShowUninstDetails nevershow
|
||||
BrandingText "${COMPANYNAME}"
|
||||
|
||||
VIProductVersion <#= LegacyVersion.ToString(4) #>
|
||||
VIAddVersionKey ProductName "${APPNAME}"
|
||||
VIAddVersionKey Comments ""
|
||||
VIAddVersionKey CompanyName "${COMPANYNAME}"
|
||||
VIAddVersionKey LegalCopyright "${COMPANYNAME}"
|
||||
VIAddVersionKey FileDescription "${DESCRIPTION}"
|
||||
VIAddVersionKey FileVersion "${VERSION}"
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey OriginalFilename "<#= OutFile #>"
|
||||
|
||||
;--------------------------------
|
||||
; The stuff to install
|
||||
Section "install" ;No components page, name is not important
|
||||
DetailPrint 'Installing ${APPNAME}. Please wait...'
|
||||
SetShellVarContext current
|
||||
SetDetailsPrint None
|
||||
IfSilent +2
|
||||
RMDir /r $INSTDIR
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Create sub-directories
|
||||
<# foreach(var directory in Directories) { #><#= $" CreateDirectory \"$INSTDIR\\{directory}\"{Environment.NewLine}" #><# } #>
|
||||
|
||||
; Put file there
|
||||
<#foreach(var file in Files) { #><#= $" File \"/oname={file.TargetPath}\" \"{file.SourcePath}\"{Environment.NewLine}" #><# } #>
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
; Desktop
|
||||
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${EXECUTABLE}"
|
||||
|
||||
# Start Menu
|
||||
CreateDirectory "$SMPROGRAMS\${COMPANYNAME}"
|
||||
CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${EXECUTABLE}"
|
||||
|
||||
# Update pinned Taskbar
|
||||
IfFileExists "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk" 0 +2
|
||||
CreateShortCut "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk" "$INSTDIR\${EXECUTABLE}"
|
||||
SetOutPath $INSTDIR\app-${VERSION}
|
||||
StrCpy $0 ${EXECUTABLE} -4
|
||||
IfFileExists "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk" 0 +2
|
||||
CreateShortCut "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk" "$INSTDIR\app-${VERSION}\${EXECUTABLE}"
|
||||
|
||||
# Registry information for add/remove programs
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\app-${VERSION}\${EXECUTABLE}$\""
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}"
|
||||
; WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "${HELPURL}"
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
|
||||
# There is no option for modifying or repairing the install
|
||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
|
||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
|
||||
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
|
||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
|
||||
SectionEnd ; end the section
|
||||
|
||||
Function .onInstSuccess
|
||||
IfSilent +2
|
||||
Exec '"$INSTDIR\${EXECUTABLE}"'
|
||||
FunctionEnd
|
||||
|
||||
Section "uninstall"
|
||||
DetailPrint 'Please wait...'
|
||||
SetShellVarContext current
|
||||
SetDetailsPrint None
|
||||
SetAutoClose true
|
||||
|
||||
# Remove Start Menu launcher
|
||||
Delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
|
||||
Delete "$DESKTOP\${APPNAME}.lnk"
|
||||
StrCpy $0 ${EXECUTABLE} -4
|
||||
Delete "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk"
|
||||
Delete "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk"
|
||||
# Try to remove the Start Menu folder - this will only happen if it is empty
|
||||
RMDir "$SMPROGRAMS\${COMPANYNAME}"
|
||||
|
||||
# Always delete uninstaller as the last action
|
||||
delete $INSTDIR\uninstall.exe
|
||||
|
||||
# Try to remove the install directory - this will only happen if it is empty
|
||||
RMDir /r /REBOOTOK $INSTDIR
|
||||
|
||||
# Remove uninstaller information from the registry
|
||||
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
|
||||
sectionEnd
|
Reference in New Issue
Block a user