- NSIS Discussion
- Silent install for .NET framework 2.0
Archive: Silent install for .NET framework 2.0
jdt2oo7
2nd January 2010 21:51 UTC
Silent install for .NET framework 2.0
Hi all,
I am having trouble install .NET framework 2.0 silently.
I have verified using command prompt and successfully install .NET framework 2.0 using:
dotnetfx.exe /q:a /c:â€install.exe /qâ€
But when I use it in script, it doesn't run the installation:
ExecWait '"$EXEDIR\Products\Microsoft Redistribute\dotnetfx.exe" /q:a /c:â€install.exe /qâ€' $ExitCode5
"Products\Microsoft Redistribute" is where I run dotnetfx.exe from.
I also add quotation mark as suggested in another thread:
ExecWait '"Products\Microsoft Redistribute\dotnetfx.exe" /q:a /c:$\â€install.exe /q$\â€' $ExitCode5
I have tried this also:
ExecWait '"$EXEDIR\Products\Microsoft Redistribute\dotnetfx.exe" /q' $ExitCode5
If you have any idea what is wrong, please let me know. This is so time consuming :(
I previously had posted question about Silent install for VS C++ 2008 SP1 Redistributable Package (x86), and that is working.
http://forums.winamp.com/showthread....hreadid=315810
meaningoflights
6th January 2010 02:20 UTC
!macro NET_INSTALL installer_path
;Check for framework 2.0————————————–
StrCpy $1 “0?
ReadRegDword $1 HKLM “SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727? “Installâ€
${If} $1 != “1?
${If} ${RunningX64}
StrCpy $9 ‘â€${installer_path}\netfx64.exe†/q /c:â€install.exe /qb /noaspupgradeâ€â€˜
${Else}
StrCpy $9 ‘â€${installer_path}\dotnetfx2.0.exe†/q /c:â€install.exe /qb /noaspupgradeâ€â€˜
${EndIf}
SetDetailsPrint both
DetailPrint “Installing .Net Frameworkâ€
SetDetailsPrint none
!insertmacro EXEC_SUBINSTALLER “Microsoft .Net Framework 2.0? $9
${EndIf}
!macroend
jdt2oo7
6th January 2010 02:50 UTC
Thanks for your reply , meaningoflights.
I tried:
ExecWait '"$EXEDIR\Products\Microsoft Redistribute\dotnetfx.exe" /q /c:â€install.exe /qb /noaspupgradeâ€'
but it gave me "syntax error".
I wonder how you use it in:
!insertmacro EXEC_SUBINSTALLER “Microsoft .Net Framework 2.0? $9
Thanks!
meaningoflights
6th January 2010 03:26 UTC
ok use this, I attached it as a ZIP so the characters dont get affected by html encoding:
jdt2oo7
6th January 2010 04:45 UTC
Cool, seem to work when I use your Macro.
I am still seeing the extracting window and "Microsoft .NET Framework 2.0" window. Is there anyway we can hide those?
Thanks a lot!
meaningoflights
6th January 2010 05:02 UTC
Looking at the command line parameters for the dotnetfx.exe there isn't a option to hide the extraction window:
---------------------------
Microsoft .NET Framework 2.0
---------------------------
Command line options:
/Q -- Quiet modes for package,
/T:<full path> -- Specifies temporary working folder,
/C -- Extract files only to the folder when used also with /T.
/C:<Cmd> -- Override Install Command defined by author.
---------------------------
OK
---------------------------
In my installer I download dotnetfx.exe from the Microsoft site (either x86 or the x64 installer), but if you really want to hide the extraction window and can package your app with dotnetfx.exe then here's a method:
1. Use Winzip or winrar to extract the dotnetfx.exe to a folder and include that folder in your install package.
2. Inside the folder you'll see install.msi which you can run with command parameters, eg:
---------------------------
Usage
---------------------------
Usage:
/l <logname.txt> :Name of verbose msi log
/lang <xxxx> :4-digit language code
/q :Quiet install mode
/qu :Quiet uninstall mode
/? :Show the Usage dialog
---------------------------
OK
---------------------------
jdt2oo7
6th January 2010 05:04 UTC
I guess I can live with the extract window, because we don't want to include .NET in our installer. Again, thanks for your help... I've been struggle with this the last few days.
meaningoflights
6th January 2010 05:35 UTC
your welcome, let us know if you need anymore help :)
ps As per the dotnexfx 2.0 system requirements:
http://www.microsoft.com/downloads/d...displaylang=en
You should check that Windows Installer 3.1 or above is installed before installing .net 2.0..., I think its upto WindowsInstaller v4.5 these days...
===============================================
;THIS IS THE SWITCH TO COMPILE FOR INTERNET OR FULL SETUP - comment out the !define and change the Output file name
!define IS_INTERNET_RELEASE
OutFile "XXX Setup using Internet.exe"
---------------------------------------------
;The call to the function to check if MSI 3.1 or above is installed, if not to download and install it:
Call UpdateMSIVersion
---------------------------------------------
;The function
Function UpdateMSIVersion
GetDllVersion "$SYSDIR\MSI.dll" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntCmp $R2 3 0 InstallMSI RightMSI
IntCmp $R3 1 RightMSI InstallMSI RightMSI
RightMSI:
Push 0
Goto ExitFunction
InstallMSI:
!ifdef IS_INTERNET_RELEASE
DetailPrint "Downloading MSI Installer"
DetailPrint "Pausing installation while downloading MSI Installer"
;NSISDL::download "http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe" "$INSTDIR\WindowsInstaller-KB893803-v2-x86.exe"
InetLoad::load /POPUP "MSI Installer" /RESUME "Internet Connection Error. Please make sure you are connected to the Internet. You must be connected to the Internet to install XXX. Please make sure your firewall or anti virus software is not preventing the XXX installation from connecting to the Internet. Retry?" "http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe" "$$INSTDIR\WindowsInstaller-KB893803-v2-x86.exe"
Pop $0 # return value = exit code, "OK" if OK
${If} $0 != "OK"
nsislog::log "$INSTDIR\install.log" "Failed to download Windows Installer 3.1: $0"
MessageBox MB_YESNO "MSI Installer - Download Status: $0. Do you wish to continue?" IDYES go1
Abort
go1:
${EndIf}
DetailPrint "Completed download"
!endif
DetailPrint "Updating Windows Installer..."
nsislog::log "$INSTDIR\install.log" "Installing Windows Installer 3.1"
ExecWait "$INSTDIR\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart"
Push 1
Goto ExitFunction
ExitFunction:
FunctionEnd
amselon
13th January 2010 12:06 UTC
ExecWait '$INSTDIR\dotnetfx.exe /q:a /c:"install /q"'
or
ExecWait '$INSTDIR\dotnetfx.exe /q /c:"install /l c:\log_.txt /q"'
or
ExecWait '$INSTDIR\dotnetfx.exe /q /c:"install /q"'