by Bob T Bunny » Sun Aug 19, 2012 3:34 pm
I can see potential issues with any solution that InstallAware tries to create at build time. The software, when creating the installation, doesn't know what the target OS is going to be. Partivularly if you're doing a single .exe install (as our company does) it'll need to wrap the installs for .Net 2, 3, 3.5, for Windows 2000, XP, Vista, 7, Windows 8, all into the one .exe.
My solution has been to detect Windows 8 at runtime (during the installation) and use dism.exe (Deployment Image Servicing and Management tool) built into Windows 8, to install all the missing .Net Frameworks.
The logic goes something like this.
Early on in the main installation:
Set Variable DOTNETWIN8 to TRUE
Edit the CheckNet20, CheckNet30, CheckNet35 (whatever bits your installation needs) put the following (most of it is already there)
Set Variable DOTNET20 to TRUE
Check/Install .Net Framework (check v2.0....
if Variable DOTNET20 Equals FALSE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$....
-- comment: The next few lines, to the first End, are new.
Set Variable ISWIN8 to FALSE
Get System Setting Windows 8 into ISWIN8
if Variable ISWIN8 Equals TRUE
-- comment: This stops the usual .Net v2 from trying to install
Set Variable DOTNET20 to TRUE
-- comment: This makes the Windows 8 .Net 2, 3 and 3.5 install at the right time
Set Variable DOTNETWIN8 to FALSE
end
end
And finally, make a new script called setupnetwin8, to be Included where the other .Net's are installed.
if Variable DOTNETWIN8 Equals FALSE
Set Variable ISWIN8 to FALSE
Get System Setting Windows 8 into ISWIN8
if Variable ISWIN8 Equals TRUE
Set Variable IS64BIT to FALSE
Get System Setting Windows in 64bit Mode into IS64BIT
if Variable IS64BIT Equals TRUE
Set x64 - Native 64bit Windows...
end
Set Variable PROGRESSTEXT to Installing Microsoft .Net Framework 3.5 (includes 2.0 and 3.0)
Run Program dism.exe /online /enable-feature /featurename:NetFx3 (WAIT)
if Variable IS64BIT Equals TRUE
Set Win32 - Native 32bit Windows...
end
end
end
And that should just about do it. Essentially, you're changing each Check .Net script to check for Windows 8, and set 1 common variable if it's needed, and stopping the usual .Net install from running. Then it runs the 32 or 64bit version of dism.exe (it won't work if your installation is in 32bit mode on a 64bit machine) to install.
As it stands, the .Net 3.5 installation will be downloaded off the internet, presumably from Microsoft. I like this idea, as it means that in 2 years time, new Windows 8 machines should be fully patched when the download happens. There's nothing worse than having a customer install your program, then find they have to reboot 3 times to catch up with Windows Updates...
For anyone who wants to take it a step further, you might like to find the dism package on the Windows 8 installation CD, wrap it up in a FileBag, and put it online repackaged for downloading. You would then need to modify the dism.exe command to specify the FileBag location as the source. Remember to wrap both the 32bit and 64bit installations, and run the right dism.exe on the right installation accordingly.
E & OE. Enjoy...
Bob