Page 1 of 1

Installation of SQL server 2008 with Framework 4 installed

Posted: Mon Dec 12, 2011 6:37 am
by Balanced-Plus
Hi,

In my installer I check if Framework 2 is installed as a pre-requisite for SQL server 2008.
But when a server has Framework 4 installed (without having Framework 2 installed), than my installion can't proceed.
Framework 2 aparently can't be installed if Framework 4 is already installed.

How can I solve this?

Code: Select all

[DEFINE REGION: Check/Install Application Pre-Requisites]
 
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to 
Set Variable REBOOTBP to FALSE
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
if Variable BP_IS64 Equals TRUE
  Include Script: checkmsi45_x64
  Include Script: checknet20sp2_x64
  Include Script: checksql2008r2_x64
  else
  Include Script: checkmsi45
  Include Script: checknet2sp2
  Include Script: checksql2008r2_x86
end
[compiler end]
<<Code Folding Region>>
 
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
  Display Dialog: prereq, wait for dialog to return (modal)
  if Variable WIZARD Equals CANCEL
    Terminate Installation
  end
  Display Dialog: progressprereq, use as progress dialog (non-modal)
  [compiler if Variable BUILDMODE not Equals PATCH]
  if Variable NEEDSUPGRADE Equals TRUE
    Set Variable REMOVEOLD to 
    Set Variable ERROROLD to 
    Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
    if Variable REMOVEOLD Equals ERROR
      MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
      Terminate Installation
    end
    if Variable REMOVEOLD Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
        else
        Terminate Installation
      end
    end
    Set Variable MAINTENANCE to FALSE
  end
  [DEFINE WEB MEDIA Microsoft Windows Installer 4.5 (x64), Exclude from Build]
  if Variable BP_IS64 Equals TRUE
    Include Script: setupmsi45_x64
  end
  [DEFINE WEB MEDIA Microsoft .NET Framework 2.0 with Service Pack 2 (x64), Exclude from Build]
  if Variable BP_IS64 Equals TRUE
    Include Script: setupnet20sp2_x64
  end
  [DEFINE WEB MEDIA Microsoft SQL Server Express 2008 R2 (x64), Exclude from Build]
  if Variable BP_IS64 Equals TRUE
    Include Script: setupsql2008r2_x64
    Comment: Instellen Firewall, hiervoor wisselen naar 64 Bit modes.
    Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
    Read Registry Key HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.BALANCEDPLUS2008\Setup\SQLBinRoot into BP_SQL_PATH
    Does File Exist $BP_SQL_PATH$\sqlservr.exe (get result into variable BP_SQL_EXISTS)
    if Variable BP_SQL_EXISTS Equals TRUE
      if Variable BP_FIREWALL_ADVANCED Equals TRUE
        Run Program netsh advfirewall firewall add rule name="SQL Server (BALANCEDPLUS2008)" dir=in action=allow program="$BP_SQL_PATH$\sqlservr.exe" enable=yes profile=any  description="Allows inbound Microsoft SQL Server dynamic ports, set by BALANCEDPLUS2008 ERP Installer" (WAIT, get result into variable BP_FIRWALL_OK)
        Run Program netsh advfirewall firewall add rule name="SQL Server browser (BALANCEDPLUS2008)" dir=in action=allow protocol=UDP localport=1434 profile=any  description="Allows inbound Microsoft SQL Server browser, set by BALANCEDPLUS2008 ERP Installer" (WAIT, get result into variable BP_FIRWALL_OK)
        else
        Run Program netsh firewall add allowedprogram "$BP_SQL_PATH$\sqlservr.exe" "SQL Server (BALANCEDPLUS2008)" ENABLE (WAIT, get result into variable BP_FIRWALL_OK)
        Run Program netsh firewall set portopening UDP 1434 "SQL Server browser (BALANCEDPLUS2008)"  (WAIT, get result into variable BP_FIRWALL_OK)
      end
      else
      MessageBox: SQL Server (BALANCEDPLUS2008), $TITLE$ Setup - Warning: Not able to set an exception for the firewall. "SQL Server (BALANCEDPLUS2008)" not exists in the expected directory which is: $BP_SQL_PATH$\sqlservr.exe.
    end
    Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
  end
  [DEFINE WEB MEDIA Microsoft Windows Installer 4.5, Exclude from Build]
  if Variable BP_IS64 Equals FALSE
    Include Script: setupmsi45
  end
  [DEFINE WEB MEDIA Microsoft .NET Framework 2.0 with Service Pack 2, Exclude from Build]
  if Variable BP_IS64 Equals FALSE
    Include Script: setupnet2sp2
  end
  [DEFINE WEB MEDIA Microsoft SQL Server Express 2008 R2 (x86), Exclude from Build]
  if Variable BP_IS64 Equals FALSE
    Include Script: setupsql2008r2_x86
    Comment: Setze Firewall
    Read Registry Key HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.BALANCEDPLUS2008\Setup\SQLBinRoot into BP_SQL_PATH
    Does File Exist $BP_SQL_PATH$\sqlservr.exe (get result into variable BP_SQL_EXISTS)
    if Variable BP_SQL_EXISTS Equals TRUE
      if Variable BP_FIREWALL_ADVANCED Equals TRUE
        Run Program netsh advfirewall firewall add rule name="SQL Server (BALANCEDPLUS2008)" dir=in action=allow program="$BP_SQL_PATH$\sqlservr.exe" enable=yes profile=any  description="Allows inbound Microsoft SQL Server dynamic ports, set by BALANCEDPLUS2008 ERP Installer" (WAIT, get result into variable BP_FIRWALL_OK)
        Run Program netsh advfirewall firewall add rule name="SQL Server browser (BALANCEDPLUS2008)" dir=in action=allow protocol=UDP localport=1434 profile=any  description="Allows inbound Microsoft SQL Server browser, set by BALANCEDPLUS2008 ERP Installer" (WAIT, get result into variable BP_FIRWALL_OK)
        else
        Run Program netsh firewall add allowedprogram "$BP_SQL_PATH$\sqlservr.exe" "SQL Server (BALANCEDPLUS2008)" ENABLE (WAIT, get result into variable BP_FIRWALL_OK)
        Run Program netsh firewall set portopening UDP 1434 "SQL Server browser (BALANCEDPLUS2008)"  (WAIT, get result into variable BP_FIRWALL_OK)
      end
      else
      MessageBox: SQL Server (BALANCEDPLUS2008), $TITLE$ Setup - Warning: Not able to set an exception for the firewall. "SQL Server (BALANCEDPLUS2008)" not exists in the expected directory which is: $BP_SQL_PATH$\sqlservr.exe.
    end
  end
  [compiler end]
  Hide Dialog
end
<<Code Folding Region>>

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Tue Dec 13, 2011 2:45 am
by giaviv
How would you solve this if it weren't for IA? Would you require the user to remove his 4 and install 2 instead?

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Tue Dec 13, 2011 4:15 am
by Balanced-Plus
SQL Server doesn't need Framework 2 if version 4 is already installed.
So in that case the pre-requisite can be skipped.

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Tue Dec 13, 2011 10:56 pm
by giaviv
In that case, you would have to find a way to check if .NET 2 is specifically installed.
Try posting on a Microsoft forum asking how this could be done.

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Wed Dec 14, 2011 12:09 am
by Balanced-Plus
Can't I just check if Framework 4 is installed?
If it is installed there is no need for installing Framework 2.

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Wed Dec 14, 2011 6:32 pm
by giaviv
Oh - absolutely! I didn't realize that was what you were trying to do.

Add .NET 4 as a prerequisite, and check the checknet4 script added to your project to see how it checks if .NET 4 is installed - you can do the same thing!

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Wed Dec 14, 2011 11:00 pm
by Balanced-Plus
Yes, but how do I setup
If NOT (Framework 2 installed) AND NOT (Framework 4 installed) then
INSTALL Framework 2

It's not needed to install both.

Re: Installation of SQL server 2008 with Framework 4 install

Posted: Thu Dec 15, 2011 11:10 am
by giaviv
Use the script in checknet2 to check for .NET 2 in a var called NET2 for example, and same for NET4.
Then if not NET2 and not NET4, call setup NET2 after setting .NET 2 as a prerequisite.