I need to install DotNet 4.0 as an optional prerequisite for a specific (rare) feature in a basic MSI application on Windows 7. Setting it as a feature prerequisite installs it too late. Setting it as a full installer prerequisite works, but is too broad an option. Attempting to run the standalone DotNet 4.0 installer silently as a CA prior to the execution sequence of my product installer fails.
With this last option, I was using the suggested command line parameters /q /norestart, but then I changed that to /norestart /showfinalerror /passive /SkipInstallerRunCheck, this gave me the following error message: "Access Denied" with no other useful information. I'm running the main installer with Admin privilages.
How can I get DotNet 4.0 installed from within my Installer package without running it as a Prerequisite?
____________________
Expanded Information:
I have a requirement to make SQL Server Express 2012 available in my installer as an optional extra if the Server feature is selected for installation. Various other databases may be used and it is possible for the Server to be installed on one machine and remotely access a DB on another machine, hence why this is optional.
I cannot bundle SQL Server as a prerequisite even if I could work out how to add the various parameters (usernames and password, sa password, instance name etc.), but I need to install it prior to the execution sequence running, after the Server feature has been selected and the user has decided not to go with the other options. It needs to be installed and the service running prior to the main installer running which then adds a Database. I finally worked out the silent install parameter list to run the standalone SQL Server Express 2012 installer as a CA at the end of the UI sequence. I thought I had it working, but QA discovered on Windows 7 that it needs the prereq DotNet 4.0 installed.
Now DotNet 4.0 is actually bundled with the standalone SQL Server Express 2012 installer. But it will only install DotNet 4.0 if you run the SQL Server installer standalone. Running it from within my installer, silently fails (apparantly) during the install DotNet phase, but will install SQL Server if DotNet 4.0 is already installed on the system. I can install DotNet 4.0 as an installer prerequisite and the bundled SQL Server Express 2012 installs correctly. But that is no good, I only want to install this for certain Server installs. I tried setting it up as a Server feature prerequisite, but it doesn't seem to run before my SQL Server CA. So I went down the path of using a standalone DotNet 4.0 installer and running it as a CA prior to the SQL Server CA. Except although it runs fine from the command line, when I run it from within my installer it bombs out with "Access Denied" with no further information other than a list of generic help links which are no good.
I added the /SkipInstallerRunCheck parameter to both CAs and to the property sheet of the main installer. This was essential to getting the SQL Server CA running and I assumed it was needed for DotNet too, but I suspect it is the parameter in the main installer property sheet that is actually effective, but whatever, if it works for one it should work for both. The SQL Server CA definitely works if DotNet 4.0 is preinstalled.