0
votes

I designed an c# application and made an installer for it using NSIS to perform:

  1. Check if the required .net framework version is installed on the user machine.
  2. If not,It installs it.
  3. Create a directory for the program on program file
  4. Create an .exe for the program on the desktop

The problem in task 2 where it cannot install it. Here the code

    Name "MeetingRegulator"
OutFile "setup.exe"
!define NETVersion "4.0.30319"
!define NETInstaller "dotNetFx40_Full_x86_x64.exe"
Section "MS .NET Framework v${NETVersion}" SecFramework
  IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NETVersion}" NETFrameworkInstalled 0
  File /oname=$TEMP\${NETInstaller} ${NETInstaller}

  DetailPrint "Starting Microsoft .NET Framework v${NETVersion} Setup..."
  ExecWait "$TEMP\${NETInstaller}"
  Return

  NETFrameworkInstalled:
  DetailPrint "Microsoft .NET Framework is already installed!"

SectionEnd
InstallDir $PROGRAMFILES\MeetingRegulator
DirText "ãä ÝÖáß Þã ÈÅÎÊíÇÑ ãßÇä ÊËØíÈ ÇáÈÑäÇãÌ"
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File ÇáÅÌÊãÇÚÇÊ.exe
SectionEnd ; end the section

section "creat desktop icon "
SetOutPath $DESKTOP
File ÇáÅÌÊãÇÚÇÊ.exe
sectionend
1
What exactly is the problem? Does the installer run? Does it fail? Does it fail in detecting valid versions? - Karl-Johan Sjögren
it always says that the .net version is installed already while it is not installed. - Boulis

1 Answers

0
votes

Here is my code for .NET Framework 4.5. It downloads and installs (or can optionally run from Setup media, such as a CD or USB stick): http://nsis.sourceforge.net/Download_and_Install_dotNET_45

Yes I know you're looking for .NET 4.0, but .NET 4.5 will run .NET 4.0 apps