User Tag List

Results 1 to 6 of 6

Thread: How to terminate setup when no .NET Framwork is installed

  1. #1
    Clicker Install Creator Pro

    Join Date
    Jun 2009
    Location
    Germany
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to terminate setup when no .NET Framwork is installed

    Hi,

    its essential for my setup, that .NET Framework 4.0 is already installed before running the setup for my application.
    So how can I check that .NET Framework 4.0 is installed, and if not, force setup to terminate with an appropriate message for the user.

    Something like

    "Please install .NET Framework 4.0 and then run setup again"

    thanks

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,404
    Mentioned
    168 Post(s)
    Tagged
    2 Thread(s)
    Why not running the installer of .NET Framework instead? The Pro version of IC has "Run only if .NET Framework xx is not installed" options (in the View / Run tab). You could add the .NET Framework installer to your installer and select this option for this file.

  3. #3
    Clicker Install Creator Pro

    Join Date
    Jun 2009
    Location
    Germany
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two reasons why this option is not a solution for me.

    First, I need to run a program at the end of the setup (option "Run when installer exits"). It is not the app to be installed, but an app which prepares license specific things, which needs administrator privileges.
    If the installer of .NET Framework is integrated as you supposed it ends with a request for reboot, and if the user chose "Reboot immediately" then the setup is terminated before reaching the end, and my program ist not executed.

    Second, the program I need to run at installers exit, itself need .NET Framework 4.0. So even if the user chose "Reboot later", the framework is not ready for use by an application. The reboot seems to be essential to run an app based on the framework.

    So what do you suggest ?

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Quote Originally Posted by Fritz_Bilda View Post
    There are two reasons why this option is not a solution for me.

    First, I need to run a program at the end of the setup (option "Run when installer exits"). It is not the app to be installed, but an app which prepares license specific things, which needs administrator privileges.
    If the installer of .NET Framework is integrated as you supposed it ends with a request for reboot, and if the user chose "Reboot immediately" then the setup is terminated before reaching the end, and my program ist not executed.

    Second, the program I need to run at installers exit, itself need .NET Framework 4.0. So even if the user chose "Reboot later", the framework is not ready for use by an application. The reboot seems to be essential to run an app based on the framework.

    So what do you suggest ?
    Personally, I would suggest wrap the installer with an AutoIt Script (or similar).
    I've had to do it in the past with an installer made by a 3rd party that had integrated .Net framework 4.0 but it required internet access, which some clients did not have, or only had access through a proxy server.

    Here is an edited version of the script that I made:
    Code:
    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Outfile=.\Install.exe
    #AutoIt3Wrapper_Res_LegalCopyright=Robert Brandon © 2012
    #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
    
    $Title = "" ; Autoit version of to ICP's #title macro. Needs to be defined here. e.g. $Title = "Microsoft Office 2010"
    
    ;Initialise variables
    Local $key, $count = 0, $Installed = 0, $regkey = "HKLM\SOFTWARE\Microsoft\.NETFramework\Policy\", $RunOnce = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
    
    ;Check all subkeys in "HKLM\SOFTWARE\Microsoft\.NETFramework\Policy\"
    While 1
        $count += 1
        $key = RegEnumKey($regkey, $count)
        If @error Then ExitLoop
    
        ;If there is a subkey titled "v4.0", then .NET Framework 4.0 is already installed
        If $key = "v4.0" Then
            $Installed = 1
            ExitLoop
        EndIf
    WEnd
    
    ;Extract Setup file to %temp%
    ProgressOn($Title & " Install Program", "Please Wait", "Extracting " & $Title & " Setup Files...")
    FileInstall(".\Setup.exe", @TempDir & "\Setup.exe", 1)
    ProgressOff()
    
    ;If .NET Framework 4.0 is installed, then run the setup file
    If $Installed = 1 Then
        RunWait(@TempDir & "\Setup.exe")
        Exit
    ;If .NET Framework isn't installed, then extract and run it.
    Else
        If MsgBox(0x40024, $Title & " Install Program", $Title & " requires .NET Framework v4.0 to be installed." & @CRLF & "Would you like to install it now?") <> 6 Then
            MsgBox(0x40030, $Title & " Install Program", "Setup aborted.")
            Exit
        EndIf
    
        ;Extract .NET Framework v4 Installer to %temp%
        ProgressOn($Title & " Install Program", "Please Wait", "Extracting .NET Framework v4.0 Setup Files...")
        FileInstall(".\dotNetFx40_Full_x86_x64.exe", @TempDir & "\dotNetFx40_Full_x86_x64.exe", 1)
        ProgressOff()
    
        ;Run .NET Framework v4 Installer (passive = no prompts, but a progress bar is displayed)
        $Return = RunWait(@TempDir & "\dotNetFx40_Full_x86_x64.exe /passive /norestart")
    
        ;DotNET 4.0 Return codes:
        Switch $Return
            Case 0
                ;DotNET Installed Successfully
                RunWait(@TempDir & "\Setup.exe")
                Exit
            Case 1641
                ;A restart is required
                MsgBox(0x40020, $Title & " Install Program", "A restart is required to continue " & $Title & "'s installation." & @CRLF & "Click ""OK"" to restart and continue installation on next reboot.")
    
                ;Run setup automatically on next reboot
                RegWrite($RunOnce, $Title, "REG_SZ", @TempDir & "\Setup.exe")
    
                ;Restart computer
                Run(@ComSpec & " /c shutdown.exe -r -f -t 0", @SystemDir, @SW_HIDE)
                Exit
            Case 3010
                ;A restart is Required
                MsgBox(0x40020, $Title & " Install Program", "A restart is required to continue " & $Title & "'s installation." & @CRLF & "Click ""OK"" to restart and continue installation on next reboot.")
    
                ;Run setup automatically on next reboot
                RegWrite($RunOnce, $Title, "REG_SZ", @TempDir & "\Setup.exe")
    
                ;Restart computer
                Run(@ComSpec & " /c shutdown.exe -r -f -t 0", @SystemDir, @SW_HIDE)
                Exit
            Case 1602
                ;Installation Cancelled
                MsgBox(0x40048, $Title & " Install Program", "Installation cancelled.")
                Exit
            Case 1603
                ;A fatal error occurred during installation.
                MsgBox(0x40016, $Title & " Install Program", "A fatal error occurred during .NET Framework v4.0 installation.")
                Exit
            Case 5100
                ;Your computer does not meet the system requirements for the .NET Framework v4.
                MsgBox(0x40016, $Title & " Install Program", "Your computer does not meet the system requirements for .NET Framework v4.0.")
                Exit
            Case 5101
                ;Internal state failure.
                MsgBox(0x40016, $Title & " Install Program", ".NET Framework v4.0 Install internal state failure.")
                Exit
            Case Else
                ;An unknown error occurred during installation.
                MsgBox(0x40016, $Title & " Install Program", "An unknown error occurred during .NET Framework v4.0 installation.")
                Exit
        EndSwitch
    EndIf
    What the above script does is:
    1. Check to see if .NET Framework v4.0 is installed
    2. Extract Setup.exe to %temp%
    3. If .NET Framework v4.0 is already installed, run Setup.exe
    4. If .NET Framework v4.0 is NOT installed, extract the .NetFramework v4.0 installer (found here: http://www.microsoft.com/en-us/downl....aspx?id=17718) to %temp% and run it "passively"
    5. If no restart is required, the run Setup.exe afterwards
    6. If a restart is required, add Setup.exe to the user's RunOnce registry key so that it runs on next boot, and then restart the computer
    7. If the .NET Framework v4.0 installer fails for some other reason, notify the user of that reason.


    To use the script, get AutoIt v3 (http://www.autoitscript.com/site/autoit/downloads/). copy the above code into it, modify the $Title variable to the name of your software and save it. Store the software install file (Setup.exe) and the .NET framework v4.0 setup file (dotNetFx40_Full_x86_x64.exe)(link above) in the same directory as the script.
    Compile the script, test, and away you go. (Setup.exe and dotNetFx40_Full_x86_x64.exe will both be included INSIDE the compiled script- Install.exe- so you only need to distribute the one file)

    The script *should* do what you want to. Hopefully ICv3 will include the above functionality.

    Please let me know if it works for you (modified version is untested), or if you have any issues getting it set up.

  5. #5
    Clicker Install Creator Pro

    Join Date
    Jun 2009
    Location
    Germany
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi SethAluma,

    thanks for this support.
    I've implemented it as you suggested.
    Your script sample was a good base to start.

    The only problems I had, that the switchcase statement, to evaluate the returnvalue of the .NET Framework installer, sometimes didn't work as expected. Although the returnvalue was one of the Case Values (checked by a messagebox output immediately after) the corresponding case statement was not executed.
    Have you also made such experiance with AutoIT scripting engine ?

    Finally it works, but there are some rumours remaining, whether this failure could suddenly happen again on customers side for whatever reasons.

    Anyway, thanks again

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    No problem, Fritz_Bilda. Thank you for commenting back

    I've been working with AutoIt for about 2 years now. I've made several applications with it to make my job easier (for example, I've recently made a script that turns RTF AutoIt code into highlighted BBCode for easy reading here- see below for the output. A couple of mouse clicks and it's done, instead of several minutes colour-coding everything).

    I modified that script quite a bit from my original one (which worked) but since I didn't have a program to run or a computer without .NET Framework v4.0 installed nearby, I was unable to test it myself.

    Is there anything that you needed to change to get it working? Which return code was returned, and did it just not do anything in the case statement, or did it do the wrong statement?
    If it was displaying the MsgBox, but Run() and RunWait() aren't working (which happened to me recently in a script) you could try replacing them with ShellExecute() and ShellExecuteWait():
    Code:
    ;Replace
    RunWait(@TempDir & "\Setup.exe")
    ;With
    ShellExecuteWait(@TempDir & "\Setup.exe")
    
    ;And
    Run(@ComSpec & " /c shutdown.exe -r -f -t 0", @SystemDir, @SW_HIDE)
    ;With
    ShellExecute(@ComSpec, "/c shutdown.exe -r -f -t 0", @SystemDir, "open", @SW_HIDE)
    
    If you don't like CASE statements, it can easily be re-written using IF/IFELSE's: (I've also added in checking if RunWait failed to run the dotnet installer)
    Code:
    If @error Then
       ;DotNET Installer failed to run
       MsgBox(0x40016, $Title & " Install Program", ".NET Framework v4.0 Installer failed to run." & @CRLF & "Please install .NET Framework 4.0 and then run setup again.")
       Exit
    ElseIf $Return = 0 Then
       ;DotNET Installed Successfully
       RunWait(@TempDir & "\Setup.exe")
       Exit
    ElseIf $Return = 1641 Then
       ;A restart is required
       MsgBox(0x40020, $Title & " Install Program", "A restart is required to continue " & $Title & "'s installation." & @CRLF & "Click ""OK"" to restart and continue installation on next reboot.")
       
       ;Run setup automatically on next reboot
       RegWrite($RunOnce, $Title, "REG_SZ", @TempDir & "\Setup.exe")
    
       ;Restart computer
       Run(@ComSpec & " /c shutdown.exe -r -f -t 0", @SystemDir, @SW_HIDE)
       Exit
    ElseIf $Return = 3010 Then
       ;A restart is Required
       MsgBox(0x40020, $Title & " Install Program", "A restart is required to continue " & $Title & "'s installation." & @CRLF & "Click ""OK"" to restart and continue installation on next reboot.")
    
       ;Run setup automatically on next reboot
       RegWrite($RunOnce, $Title, "REG_SZ", @TempDir & "\Setup.exe")
    
       ;Restart computer
       Run(@ComSpec & " /c shutdown.exe -r -f -t 0", @SystemDir, @SW_HIDE)
       Exit
    ElseIf $Return = 1602 Then
       ;Installation Cancelled
       MsgBox(0x40048, $Title & " Install Program", "Installation cancelled.")
       Exit
    ElseIf $Return = 1603 Then
       ;A fatal error occurred during installation.
       MsgBox(0x40016, $Title & " Install Program", "A fatal error occurred during .NET Framework v4.0 installation.")
       Exit
    ElseIf $Return = 5100 Then
       ;Your computer does not meet the system requirements for the .NET Framework v4.
       MsgBox(0x40016, $Title & " Install Program", "Your computer does not meet the system requirements for .NET Framework v4.0.")
       Exit
    ElseIf $Return = 5101 Then
       ;Internal state failure.
       MsgBox(0x40016, $Title & " Install Program", ".NET Framework v4.0 Install internal state failure.")
       Exit
    Else
       ;An unknown error occurred during installation.
       MsgBox(0x40016, $Title & " Install Program", "An unknown error occurred during .NET Framework v4.0 installation.")
       Exit
    EndIf
    

Similar Threads

  1. "Do Not Install If Later Version is Installed" feature. No warning, files installed.
    By TheDonald in forum Install Creator and Patch Maker
    Replies: 8
    Last Post: 1st August 2013, 07:40 PM
  2. Mochiscore setup
    By Evilized79 in forum SWF/Flash Export Module Version 2.0
    Replies: 11
    Last Post: 7th August 2010, 06:28 PM
  3. Terminate process example
    By Mathias in forum File Archive
    Replies: 12
    Last Post: 29th September 2007, 01:47 AM
  4. Online Setup
    By SylvainSSiri in forum Install Creator and Patch Maker
    Replies: 3
    Last Post: 21st June 2007, 06:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •