Conditionally download and install prerequisites - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Conditionally download and install prerequisites

Hi,

Here's what I would ideally like to do:

When the setup starts, I want to detect any installed versions of the .Net framework. I already know how to do this by looking in the registry. I have different merge modules for my software, and by specifying a condition on each feature I can install a specific merge module.

I am installing different versions of my software, one for each version of the .Net CLR (1.1, 2.0, 3.0). Depending on what is available on the user's machine, I want to offer the user the choice:
- if nothing is available, then suggest to install .Net 3.0 and then the 3.0 version of my software (but still allow the user to choose a previous version if required)
- if several versions are available, install to the highest version
- if only 1 version is available, install that version

I have looked into prerequisites, but that does not exactly do what I want: if I set .Net 1.1 as a prerequisite, and the user has v2.0, then he shouldn't have to install the older 1.1 version. The software should just install the 2.0 version instead. I can also not set .Net 2.0 as a prerequisite, because then my users who have 1.1 will not be able to install to their CLR.

I do not want to include all 3 versions of the .Net framework because then my MSI would be too big to download. Ideally the setup would detect what is available, and if necessary download only the requested version of .Net from the internet.

As a side note, my hosting provider does not allow me to put EXE files on my website (for security reasons). MSI files may be allowed, I have not yet checked that.

But ideally I would like to put the .Net runtimes on my website as ZIP files, so that I not only get around this security problem but also have smaller downloads.

Can this be done using Advanced Installer? How would I go about this?

Thanks

Mat
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

For the prerequisite, you can take this approach:
- add the .NET Framework 3.0 installation package as a prerequisite
- configure the Install Conditions to search for all three versions of .NET Framework (1.1, 2.0 and 3.0); you can use the conditions for the predefined .NET Framework prerequisites
- use the "Install if all of the above searches fail" option

This way .NET Framework 3.0 will be installed only if no version is present on the target machine.

For the main package, you can take a similar approach:
- use the "Search" page to recreate the searches you use for the Install Conditions of the prerequisites
- condition the installation of the features in your package based on the result of the searches

For example, the feature which corresponds to the 2.0 version of .NET Framework will be installed only if the result of the search for the 2.0 version of .NET Framework was successful (the property of the search is not empty).

You can read more about the "Search" page here:
http://www.advancedinstaller.com/user-guide/search.html
But ideally I would like to put the .Net runtimes on my website as ZIP files, so that I not only get around this security problem but also have smaller downloads.
Currently Advanced Installer doesn't support archived prerequisites. However, we have on our TODO list a feature which will allow the bootstrapper to download 7Zip archives which contain the installation package of the prerequisite.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Thanks Cosmin, that option "Install if searches fail" should do the trick.

1) Do you happen to know if this will work for MSI files, or does it only work with EXEs? Are there any MSIs available for .Net, or do I need to build one myself using Advanced Installer?

2) I would also like to distribute my own Framework the same way. We have a common software framework that is required by all of our products. In the setup for each of our products I would like to configure our framework as a prerequisite.

The problem is going to be that for a URL prerequisite I need to specify an MD5 checksum. I presume the MSI is going to verify if the prerequisite file is still the same file that the current setup was compiled against.

This is OK for the .Net framework because these files will remain constant. But we release new updates of our own framework every couple of weeks. Our existing products still work with all those framework versions.

So if the user does not have the framework installed, I just want to automatically download whatever is the most current version. I suspect this will fail if someone is using an older product setup since the MD5 checksum will be different?

Is there any way I can tell the setup to not do the checksum?

Thanks

Mat
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
1) Do you happen to know if this will work for MSI files, or does it only work with EXEs?
If you are referring to the prerequisite installation package please note that both EXE and MSI are supported. Also, note that the .NET Framework installation package is MSI-based (it uses an EXE bootstrapper).
So if the user does not have the framework installed, I just want to automatically download whatever is the most current version. I suspect this will fail if someone is using an older product setup since the MD5 checksum will be different?
Currently this is not supported by Advanced Installer because the size and MD5 checksum are used to detect if the prerequisite was downloaded correctly. However, I have added on our TODO list an improvement which will allow you to always download the latest version of a prerequisite.

Until the feature is included in Advanced Installer, the only solution is to use a specific version of the prerequisite.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Thanks Cosmin.

Since my hosting provider does not allow me to put EXE or MSI files anywhere on my website (only ZIP), I figured I'd simply point the prerequisite URL to the Microsoft site that supplies the .NET runtime.

For .NET 2.0, this URL is the following: http://go.microsoft.com/fwlink/?LinkId=37283

This downloads the entire file OK, but it saves it as "LinkId=37283" instead of "dotnetfx.exe". As a result, the setup fails with the error message "This file does not have a program associated with it for performing this action".

Could you perhaps add a "Save As FileName" option in the prerequisite URL dialog, so that I can specify the proper filename?

This would actually solve the problem with my hosting provider as well, because I could then store the exe's on my own website (without the exe extension).

In the meantime, can I achieve this somehow through custom actions?

Thanks

Mat
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
For .NET 2.0, this URL is the following: http://go.microsoft.com/fwlink/?LinkId=37283
This downloads the entire file OK, but it saves it as "LinkId=37283" instead of "dotnetfx.exe".
This is because the Internet browser redirects this address (it does not point directly to installation package for .NET Framework 2.0). Please try using this link:
http://www.microsoft.com/downloads/info ... tnetfx.exe
Could you perhaps add a "Save As FileName" option in the prerequisite URL dialog, so that I can specify the proper filename?
I'm afraid that we cannot modify this behavior because the link is redirected (you need to use a direct link to the file).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”