ISWIX, LLC View Christopher Painter's profile on LinkedIn profile for Christopher Painter at Stack Overflow, Q&A for professional and enthusiast programmers

Tuesday, November 21, 2006

Using InstallShield 12 to Install .NET Framework 3.0

Microsoft recently released .Net Framework v3.0. Regardless of the fact that the next release of Visual Studio codenamed ORCAS is not yet released ( and therefore you are very unlikely to need to deploy any WinFX applications yet), one installation vendor has made a big deal of their `exclusive` support to target the new framework. They point to this as one of the reasons that makes them the `only viable alternative` to InstallShield. Well to quote a famous proverb:

"Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime."

InstallShield 12 comes with a series of `Setup Prerequisites`. In a nutshell, these are XML project files that describe the contents, conditions, execution and other attributes of a redistributable package that you need your setup.exe bootstrapper to install prior to running your main MSI installation package. Additionally there is a Setup Prerequisite Editor that allows developers to fully define their own prerequisites.

So let's walk through creating our own Setup Prerequisite:

Download the full redistributable from Microsoft. While it's downloading review this whitepaper that tells you everything you need to know to implement the setup prerequisite.

Open up your InstallShield project and select Tools Prerequisite editor. First do a File Save As. Next we'll start with the properties tab. Add in a description:


Next click on the conditions tab and add our conditions. Were going to tell it to install when a certain registry key is missing and the OS is XP or 2003.


Now let's add the file we downloaded from Microsoft.

Now we teach InstallShield how to install the package silently and check to see if a reboot is needed.

Finally, let's set some attributes that complete describing the installation story to InstallShield.


Next we save the prereq and add it to our Project.


Now it's time to build and deploy to a test machine that doesn't have .Net 3.0.


That's all there is to it. When you run your setup.exe the redist is installed and then your MSI package is installed. When you run setup.exe again it skips installing .Net and goes to servicing your install.

13 comments:

  1. Creating the prereq works fine, but is there a way to include the files in a single exe? If I don't want to distribute the ISSetupPrerequisites folder (because we have a single exe file hosted on a web site), how do I bundle it all together?

    ReplyDelete
  2. When you build your MSI that consumes your Setup Prereq, use the Release Manager settings to build it as a single EXE. It'll be big ( because it contains your MSI and your prereq ) but at runtime it will extract itself to a temp folder and present the same user experience.

    It is also possible to host your prereq on a website and tell your setup.exe to find it. This your user downloads a smaller setup.exe and the prereq is only downloaded if it needs to be.

    ReplyDelete
  3. I need to install MSXML 6.0 before the SQL 2005 Express pre-requisite and I saw your comments to a post on how to do this on the InstallShield Community.

    The photo that shows checking to see if the program is installed by looking for a registry key had the full path chopped off. What was the full path in the field? And do you have an idea what registry key I would look for for MSXML 6.0? I have ..Microsoft\MSXML 6.0 Parser and SDK\CurrentVersion and
    ..Microsoft\MSXML60\Setup in my registry.

    Thanks, Diane

    ReplyDelete
  4. Thanks for the info. I just don't understand how to do: "When you build your MSI that consumes your Setup Prereq, use the Release Manager settings to build it as a single EXE. It'll be big ( because it contains your MSI and your prereq ) but at runtime it will extract itself to a temp folder and present the same user experience." - How do I build an MSI that consumes my setup prereq through installshield?
    Dina L.

    ReplyDelete
  5. I'm sorry for not being more detailed in explaining how to consume the setup prereq. Under Application Data | Redistributables filter on "Setup Prerequisite" objects. Now select your prereq and that will cause it to be consumed when you build your release.

    ReplyDelete
  6. Thanks a lot. I got the prereq (for SQL Server 2005) in the installation. However, when I compile the ise file as SingleImage, the prereq does not become part of the setup.exe file like I want. There is a separate folder: ISSetupPrerequisites, which I don't want. Like "Shadow" mentioned above, I want it to be a single setup.exe (even if it is very large). I even tried right-clicking on the prereq, selecting properties & setting the Build Location to "Extract from Setup.exe", but it doesn't seem to help. Is there something else I need to do bundle the prereq within the setup.exe file?

    Thanks in advance,
    Dina L.

    ReplyDelete
  7. When you run the release wizard, select web media type and then One Executable - All files are included in Setup.exe. Then a couple screens later select Extract Setup Prereqs from Setup.exe.

    You'll also want to select the "Cache installation on local machine" option as repairs are pretty hard to do with out having access to the MSI file that did the install.

    Also keep in mind proper manifesting/elevation of setup.exe on Vista machines otherwise you won't have priv to cache the MSI.

    ReplyDelete
  8. Thank you for posting this Christopher. I've been looking for a way to do this with the .NET 3.5 Framework. My company doesn't want to upgrade to IS2008 unless it is necessary.

    ReplyDelete
  9. I've found that you can do this by dropping in the file found here:

    http://knowledge.macrovision.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=Q113761&sliceId=

    Then right click and download the files needed, they will install to here:

    C:\Program Files\Macrovision\IS12\SetupPrerequisites\Microsoft .net\3.5\Full

    - dotnetfx3.5.exe
    - helper.exe

    Once this is done use the same type of logic you have used, but the reg key is this:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5

    The other settings are all there already.

    ReplyDelete
  10. I wrote this article in November of 2006 and Macrovision later released their own .NET prereq. Their implementation was a little bit different and there is nothing in it that prevents it from being consumed by InstallShield 12 as the PRQ XML syntax is the same.

    Technically you might be in redist violation because of the included Helper.exe but there is no technical reason why it can't be done and they haven't really done anything ( like protect the download or have setup.exe create a IS2008 Mutex that the Helper.exe checks for at runtime ) to prevent people from doing this.

    ReplyDelete
  11. OasisLiveForeverJuly 9, 2009 at 9:59 PM

    Hi all,

    I used this method to install .NET Framework 3.5 SP1 with Installshield 12. It works very well but I'm not able to to prompt the user for a reboot only if required.

    I use a ScheduleReboot Action wi th no conditions, but this always prompts the user for a reboot even if .NET Framework 3.5 SP1 it's already installed.

    Is there a way to prompt the user for a reboot only if required? It seems that the return code 3010 it's ignored by Installshield.

    I was wondering if I can put a conditition in ScheduleReboot action that is based on the return code of .NET Framework 3.5 SP1 prerequisite.

    ReplyDelete
  12. I used this method to make .NET framework 3.5 as a prerequisite for my application. This works good.
    Actually my application installer is 1 single EXE wherein i download the .NET 3.5 bootstrapper exe from the internet. Once the boot strapper finishes installing the framework , instead of continuing with actual installation process , the installer quits. I have to execute the application installer again to complete the application installation process.

    Could you please suggest what you think could be causing the application installer to quit right after installing pre requisites instead of continuing further.

    ReplyDelete
  13. Are prereqs supported in Installshield 2010, Installscript based projects? I tried adding .Net 3.5 as a prereq and it didn't get installed.

    ReplyDelete