Old 12th May 2006, 14:06   #1
roly0022
Junior Member
 
Join Date: May 2006
Posts: 4
Installing Framework .Net 2.0

I need to install de .net framework 2.0, but whitout download it, how can i do? this is my script:

Quote:
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Mi aplicación"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Mi compañía, inc."
!define PRODUCT_WEB_SITE "http://www.micompañia.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\ManejoXML.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Instalar_nuevo.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
InstallDir "$PROGRAMFILES\Mi aplicación"
Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
DirText "Se instalará $(^Name) en el siguiente directorio.$\r$\n$\r$\nPara instalar en un directorio distinto, presione Examinar y seleccione otro directorio"
LicenseText "Si acepta todos los términos del acuerdo, seleccione Acepto para continuar. Debe aceptar el acuerdo para instalar $(^Name)."
LicenseData "licencia.txt"
ShowInstDetails show
ShowUnInstDetails show

Section "Principal" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File "Debug\ManejoXML.exe"
CreateDirectory "$SMPROGRAMS\Mi aplicación"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Mi aplicación.lnk" "$INSTDIR\ManejoXML.exe"
CreateShortCut "$DESKTOP\Mi aplicación.lnk" "$INSTDIR\ManejoXML.exe"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ManejoXML.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\ManejoXML.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "La desinstalación de $(^Name) finalizó satisfactoriamente."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Está completamente seguro que desea desinstalar $(^Name) junto con todos sus componentes?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\ManejoXML.exe"

Delete "$SMPROGRAMS\Mi aplicación\Uninstall.lnk"
Delete "$SMPROGRAMS\Mi aplicación\Website.lnk"
Delete "$DESKTOP\Mi aplicación.lnk"
Delete "$SMPROGRAMS\Mi aplicación\Mi aplicación.lnk"

RMDir "$SMPROGRAMS\Mi aplicación"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
roly0022 is offline   Reply With Quote
Old 12th May 2006, 20:06   #2
nacamae
Junior Member
 
Join Date: Apr 2004
Location: São Paulo - Brazil
Posts: 14
Hi,

You have to download the .NET Framework Redistributable Pack from MS download page. It´s a file called dotnetfx.exe.

Then copy this file to $OUTDIR and execute this command inside your script:

ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""

This will perform a silent installation of framework.

I hope this help you.

Henrique Nacamae
nacamae is offline   Reply With Quote
Old 19th May 2006, 15:05   #3
roly0022
Junior Member
 
Join Date: May 2006
Posts: 4
i can't make it work , the installation directory have this files:

instalador.exe
dotnetfix.exe

the script is this, i add the line ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""
in Section "Principal" SEC01

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Mi aplicación"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Mi compañía, inc."
!define PRODUCT_WEB_SITE "http://www.micompañia.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\ManejoXML.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Instalar_nuevo.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
InstallDir "$PROGRAMFILES\Mi aplicación"
Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
DirText "Se instalará $(^Name) en el siguiente directorio.$\r$\n$\r$\nPara instalar en un directorio distinto, presione Examinar y seleccione otro directorio"
LicenseText "Si acepta todos los términos del acuerdo, seleccione Acepto para continuar. Debe aceptar el acuerdo para instalar $(^Name)."
LicenseData "licencia.txt"
ShowInstDetails show
ShowUnInstDetails show

Section "Principal" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File "Debug\ManejoXML.exe"
ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""
CreateDirectory "$SMPROGRAMS\Mi aplicación"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Mi aplicación.lnk" "$INSTDIR\ManejoXML.exe"
CreateShortCut "$DESKTOP\Mi aplicación.lnk" "$INSTDIR\ManejoXML.exe"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Mi aplicación\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ManejoXML.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\ManejoXML.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "La desinstalación de $(^Name) finalizó satisfactoriamente."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Está completamente seguro que desea desinstalar $(^Name) junto con todos sus componentes?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\ManejoXML.exe"

Delete "$SMPROGRAMS\Mi aplicación\Uninstall.lnk"
Delete "$SMPROGRAMS\Mi aplicación\Website.lnk"
Delete "$DESKTOP\Mi aplicación.lnk"
Delete "$SMPROGRAMS\Mi aplicación\Mi aplicación.lnk"

RMDir "$SMPROGRAMS\Mi aplicación"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
roly0022 is offline   Reply With Quote
Old 19th May 2006, 18:54   #4
nacamae
Junior Member
 
Join Date: Apr 2004
Location: São Paulo - Brazil
Posts: 14
You have to copy dotnetfx.exe to $OUTDIR before execute it.

;Copy dotnetfx.exe to $OUTDIR
File "dotnefx.exe"
;install .NET Framework
ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""
;Delete dotnetx.exe
Delete "$OUTDIR\dotnetfx.exe"

Henrique Nacamae
nacamae is offline   Reply With Quote
Old 19th May 2006, 19:21   #5
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
you have to extract dotnetfx.exe to $pluginsdir and then execute it if you just wish to remove it after installation, or in $instdir if you wish the file to reside along with the other files of your installation.
anyway, this redist is a big one, so it might be better if you prompt users to download it from MS server instead of having it with your distribution.

function .onInit
[other code that goes here if needed]
initpluginsdir
file /oname=$PLUGINSDIR\dotnetfx.exe 'your local dir\dotnetfx.exe'
functionend

section -
bla bla bla
call InstallDotNetFx
bla bla bla
sectionend

function InstallDotNetFx
ExecWait '$PLUGINS\dotnetfx.exe /q:a /c:$\"install /q$\"'
; you may also want to check for errors
functionend

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 22nd May 2006, 11:51   #6
roly0022
Junior Member
 
Join Date: May 2006
Posts: 4
This application sould work with or without internet, that`s why i need include the framework.
This :

;Copy dotnetfx.exe to $OUTDIR
File "dotnefx.exe"
;install .NET Framework
ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""
;Delete dotnetx.exe
Delete "$OUTDIR\dotnetfx.exe"

work`s fine, but always install the framwork, can i detect if is installed and not install?

Thanks.-
roly0022 is offline   Reply With Quote
Old 22nd May 2006, 14:00   #7
nacamae
Junior Member
 
Join Date: Apr 2004
Location: São Paulo - Brazil
Posts: 14
Check the entry "Install" (DWORD) in

HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727

If Install==1, then NET is installed.

Henrique Nacamae
nacamae is offline   Reply With Quote
Old 22nd May 2006, 18:02   #8
roly0022
Junior Member
 
Join Date: May 2006
Posts: 4
This is the code, it works fine:

ReadRegDWORD $0 HKLM 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727' Install
!if !$0

;Copy dotnetfx.exe to $OUTDIR
File "archivos\dotnetfx.exe"
;install .NET Framework
ExecWait "$OUTDIR\dotnetfx.exe /q:a /c:$\"install /q$\""
;Delete dotnetx.exe
Delete "$OUTDIR\dotnetfx.exe"
!EndIf

Thanks a lot !!!!
roly0022 is offline   Reply With Quote
Old 22nd May 2006, 18:41   #9
JeronimoColon
Junior Member
 
Join Date: Sep 2004
Location: New York City
Posts: 39
This may be duplicate effort but, I am working on a Microsoft helper library for MSI and the .NET framework.

It detects the .NET 2.0 framework and will proceed to install all the necessary dependencies if required.
1. Detects if MSI is installed and what version.
2. If older than MSI 3.1 installs 3.1 (required by framework for NT based systems).
3. Detects if version 2.0 of framework is installed, if not installs it.

Other (extra) helper macros that are available are:
- Repair .NET framework macro. (If something is wrong with the existing installation)
- Generic MSI installer helper macro. This can be used to install any MSI based installation you may need to shell out.
- Repair MSI installation helper macro. Forces a repair any previously installed MSI (you must have access to the .msi file)
- Detects MDAC version macro.
- Installs MDAC macro (Currently only 2.8sp1).
- Detects Jet version macro.
- Installs Jet macro(Currently Jet 4.0 sp8).

Right now my library is very tied to Windows NT based systems. I need to code to handle Windows 9.x.

The code is based off of Microsoft documentation and recommendations. When I finally post the library I will include links to the source documentation that I used.
JeronimoColon is offline   Reply With Quote
Old 22nd May 2006, 19:08   #10
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
It detects the .NET 2.0 framework and will proceed to install all the necessary dependencies if required.
1. Detects if MSI is installed and what version.
2. If older than MSI 3.1 installs 3.1 (required by framework for NT based systems).
3. Detects if version 2.0 of framework is installed, if not installs it.
Sounds cool! :-)
When you'll be ready, post it on wiki as well, so would be easy for everyone to grab it and use it.
regards

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 17th August 2006, 08:36   #11
n_baua
Member
 
Join Date: Aug 2006
Posts: 86
Any luck with the stuff you wanted to share...

HI JeronimoColon,

I am very new to NSIS and had made lot of efforts to detect the .net framework. My script may be not powerful enough to check all the stuff you discussed.

It will be nice if you post some stuff and newbies like me can use it.

Thanks in advance.
n_baua is offline   Reply With Quote
Old 17th August 2006, 09:17   #12
devzoo
Junior Member
 
Join Date: Aug 2006
Posts: 1
Check .NET version, install 2.0

Just wanted to share the code that I use for this. I install C# applications, so it's important that .NET 2.0 is always installed. I include the .NET framework installer file (dotnetfx.exe), and then put this code in my scripts (right after the languages section).

I can't take credit for this, by the way. Somebody else posted it somewhere, and I just tweaked it.

code:

;--------------------------------
; .NET Stuff

!include WordFunc.nsh
!insertmacro VersionCompare
!include LogicLib.nsh

Function .onInit
Call GetDotNETVersion
Pop $0
${If} $0 == "not found"
MessageBox MB_OK|MB_ICONSTOP ".NET runtime library is not installed. The .NET installer will now run. After .NET has been installed, installion of MY APPLICATION will resume."
Call InstallDotNET
Return
${EndIf}

StrCpy $0 $0 "" 1 # skip "v"

${VersionCompare} $0 "2.0" $1
${If} $1 == 2
MessageBox MB_OK|MB_ICONSTOP ".NET runtime library v2.0 or newer is required. You have $0."
Call InstallDotNET
Return
; ${Else}
; MessageBox MB_OK|MB_ICONSTOP "The correct version of the .NET runtime library is installed."
${EndIf}
FunctionEnd

Function GetDotNETVersion
Push $0
Push $1

System::Call "mscoree::GetCORVersion(w .r0, i ${NSIS_MAX_STRLEN}, *i) i .r1"
StrCmp $1 "error" 0 +2
StrCpy $0 "not found"

Pop $1
Exch $0
FunctionEnd

Function InstallDotNET
SetOutPath $TEMP
File "dotnetfx.exe"
ExecWait '"$TEMP\dotnetfx.exe"'
FunctionEnd



Notice that a couple of lines are commented out. These allow you to display a message if the .NET framework is already installed, but I think this is actually unnecessary.

Hope this helps.

Thanks!
devzoo is offline   Reply With Quote
Old 16th October 2006, 08:45   #13
sunlight112
Senior Member
 
Join Date: Oct 2006
Posts: 129
However, I want to set up my program with multi languages. When I finish to detect .NET framework, I only run one language although my code is made with multi languages if .NET framework is not installed in my program.To .NET framework which is installed in my program, the process is OK.
Somebody can help me!!!

!define PRODUCT_NAME "Test_Game"
!define PRODUCT_VERSION "1.4"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Test_Game.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

!include "MUI.nsh"

Var MUI_TEMP
Var STARTMENU_FOLDER

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ; optional

!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE $(MUILicense)

;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"

!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER

; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\Test_Game.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Dutch"
;--------------------------------
;License Language String

!define MUI_LICENSEPAGE_RADIOBUTTONS
LicenseLangString MUILicense ${LANG_ENGLISH} "E:\Client\Install\Script\en_license.txt"
LicenseLangString MUILicense ${LANG_JAPANESE} "E:\Client\Install\Script\jpn_license.txt"
LicenseLangString MUILicense ${LANG_KOREAN} "${NSISDIR}\Docs\Modern UI\License.txt"
LicenseLangString MUILicense ${LANG_DUTCH} "E:\Client\Install\Script\dutch_license.txt"

!insertmacro MUI_RESERVEFILE_LANGDLL

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "E:\Client\Install\Script\EXE\Office Talk.exe"
InstallDir "$PROGRAMFILES\Office Talk"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Section "Test_Game" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
File "E:\Client\Install\Script\OfficeTalk.exe"

ReadRegDWORD $0 HKLM 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727' Install
!if !$0
;Copy dotnetfx.exe to $OUTDIR
File "E:\Client\Install\vcredist_x86.exe"
;install .NET Framework
ExecWait "$OUTDIR\vcredist_x86.exe /q:a /c:$\"install /q$\""
;Delete dotnetx.exe
Delete "$OUTDIR\vcredist_x86.exe"
!EndIf

CreateDirectory "$SMPROGRAMS\Office Talk"
CreateShortCut "$SMPROGRAMS\Office Talk\Office Talk.lnk" "$INSTDIR\Test_Game.exe"
CreateShortCut "$DESKTOP\Test_Game.lnk" "$INSTDIR\OfficeTalk.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Test_Game\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Test_Game\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Test_Game.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Test_Game.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
FunctionEnd

Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Test_Game.exe"

Delete "$SMPROGRAMS\Test_Game\Uninstall.lnk"
Delete "$SMPROGRAMS\Test_Game\Website.lnk"
Delete "$DESKTOP\Test_Game.lnk"
Delete "$SMPROGRAMS\Test_Game\Test_Game.lnk"

RMDir "$SMPROGRAMS\Test_Game"
RMDir "$INSTDIR"

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"

;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose false
SectionEnd
sunlight112 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump