I have an existing project running under .NET 4.
I am looking for a way to install .NET Framework 4 if it isn't installed.
With the extracted files from the standard installation, I can run setup.exe /passive to do the installation automatically, or just quit if it's already installed.
The issue is calling the installer, then wait for it to complete before running the project that requires it.
Obviously I can't do this using a previous version of .NET. My application is for Windows 7 or 8 only.
On 7, the original installation of Windows contains only up to .NET 3.5, while Windows 8 doesn't contain 3.5. So if I compile a loader under 2.0, it still wants 3.5 in order to run under Windows 8.
I tried a VB script, but it complains that it can't wait for the .NET framework installation to complete.
I also considered PowerShell, but that isn't part of Windows 7.
VB Script code follows..
dim dir
dim prog
dim args
Set objArgs = WScript.Arguments
args = ""
For Each strArg in objArgs
args = args & " " & strArg
Next
set objShell = WScript.CreateObject ("WScript.Shell")
dir = objShell.CurrentDirectory
prog = dir & "\Net\Setup.exe /passive"
Run prog, true
prog = dir & "\Setup.exe " & args
Run prog, false
Sub Run(ByVal sFile, ByVal wait)
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run sFile, 1, wait
Set shell = Nothing
End Sub
Andy