PDA

View Full Version : Checking for and Installing .Net Framework



BPWILL
07-30-2013, 07:27 AM
Just purchased 2013 professional, and I was amazed to see that when using the Release Wizard, the highest version of .Net to include is still only 2.0. This page of the release wizard states: "In Case .NET Framework support is not available on the target machine, or is an older version, install it using the options specified below"

This is what I want to do, but why can I only select up to version 2.0 here?

I would imagine that most machines would have the .net framework installed, but I need to install version 4.5 if it is not there.

Does adding it as a Prerequisite do this for me?

Searched the forum for this, but most pertinent questions were submitted years ago, or have no responses.

rguggisberg
07-30-2013, 07:56 AM
Go to 'Releases' and click on the '.NET/J#' tab in the window on the right.
See the note on the bottom and click on the link "Adding .NET Framework Redistributables to Projects."

BPWILL
07-30-2013, 08:22 AM
Thanks fopr the tip. This help text states:

"If your product requires that the .NET Framework be installed on the target system, you can add the .NET Framework redistributable to your project. If the target system does not have the .NET Framework, it is installed during your installation."

And later on, at the bottom, it says:

"To test whether the .NET Framework is already installed on the target system, you can use the built-in MsiNetAssemblySupport property. It is set to the version of a particular .NET DLL (fusion.dll) if the .NET Framework is installed, and it is not set if the .NET Framework is not installed."

Kind of vauge - implys I would know how to do this...

So do I need to test for it or not? Lets say that I wanted to ensure that at least .Net 3.5 was present. Following this help topic, I would add it on the redistributals tab. If the target machine has .Net 4.0 installed, would my installer install 3.5 as well? I'd assume if the version available was 2.5, it would be updated to 3.5.

phill_mn
07-31-2013, 08:52 AM
In 10+ years of InstallShield development I do not use any built-in InstallShield tools, rather I use information on Arron Stebner's blog (and other sources) to install the package by calling LaunchAppAndWait.
http://blogs.msdn.com/b/astebner/archive/2007/11/29/6608419.aspx

phill_mn
07-31-2013, 09:02 AM
Also in the case of .Net certain versions are side-by-side products and not updates. So yes typically we test for the version we need prior to installing the package (if it is not found). Installing .Net typically takes a long time so we don't want to install it if it is not necessary.

Another approach is to design the application so that it can use various version of .Net. In the simplest case this involves modifying the app.config file to support multiple versions of the framework. Then depending on which OS you target there may be a default configuration which already includes .Net. But if you target v6.1 Server class OS (or later) you will need to be prepared to install .Net using DISM.exe. (And DISM.exe should be used for configuring 6.0 or later workstation or server configurations, if needed.)