After a bit of research I could find how to add an extra step to let innosetup download the .NET runtime for you.
1: [Code]
2: var
3: dotnetRedistPath: string;
4: downloadNeeded: boolean;
5: dotNetNeeded: boolean;
6: memoDependenciesNeeded: string;
7:
8: procedure isxdl_AddFile(URL, Filename: PChar);
9: external 'isxdl_AddFile@files:isxdl.dll stdcall';
10: function isxdl_DownloadFiles(hWnd: Integer): Integer;
11: external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
12: function isxdl_SetOption(Option, Value: PChar): Integer;
13: external 'isxdl_SetOption@files:isxdl.dll stdcall';
14:
15: const
16: dotnetRedistURL = 'http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe';
17:
18: function InitializeSetup(): Boolean;
19:
20: begin
21: Result := true;
22: dotNetNeeded := false;
23:
24: // Check for required netfx installation
25: if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then begin
26: dotNetNeeded := true;
27: if (not IsAdminLoggedOn()) then begin
28: MsgBox('<Application Name> needs the Microsoft .NET Framework to be installed by an Administrator', mbInformation, MB_OK);
29: Result := false;
30: end else begin
31: memoDependenciesNeeded := memoDependenciesNeeded + ' .NET Framework' #13;
32: dotnetRedistPath := ExpandConstant('{src}\dotnetfx.exe');
33: if not FileExists(dotnetRedistPath) then begin
34: dotnetRedistPath := ExpandConstant('{tmp}\dotnetfx.exe');
35: if not FileExists(dotnetRedistPath) then begin
36: isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
37: downloadNeeded := true;
38: end;
39: end;
40: SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
41: end;
42: end else
43: begin
44: memoDependenciesNeeded := 'The Microsoft .NET 2.0 Framework is already installed.' #13 'The <Application Name> Installer may now proceed.' #13;
45: end;
46:
47: end;
48:
49: function NextButtonClick(CurPage: Integer): Boolean;
50: var
51: hWnd: Integer;
52: ResultCode: Integer;
53:
54: begin
55: Result := true;
56:
57: if CurPage = wpReady then begin
58:
59: hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
60:
61: // don't try to init isxdl if it's not needed because it will error on < ie 3
62: if downloadNeeded then begin
63:
64: isxdl_SetOption('label', 'Downloading Microsoft .NET 2.0 Framework');
65: isxdl_SetOption('description', <Application Name> installer needs to install the Microsoft .NET 2.0 Framework. Please wait while it is downloaded to your computer.');
66: if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
67: end;
68: if (Result = true) and (dotNetNeeded = true) then begin
69: if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
70: // handle success if necessary; ResultCode contains the exit code
71: if not (ResultCode = 0) then begin
72: Result := false;
73: end;
74: end else begin
75: // handle failure if necessary; ResultCode contains the error code
76: Result := false;
77: end;
78: end;
79: end;
80: end;
81:
82: function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
83: var
84: s: string;
85:
86: begin
87: if memoDependenciesNeeded <> '' then s := s + 'Dependencies to install:' + NewLine + memoDependenciesNeeded + NewLine;
88: s := s + MemoDirInfo + NewLine + NewLine;
89:
90: Result := s
91: end;
92:
93: function FrameWorkName(Param: String): String;
94: var
95: Names: TArrayOfString;
96: I: Integer;
97: FrameworkInstall: Cardinal;
98: begin
99: Result := '';
100: if RegGetSubkeyNames(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP', Names) then begin
101: for I := 0 to GetArrayLength(Names) - 1 do begin
102: RegQueryDwordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\'+Names[I], 'Install', FrameworkInstall);
103: if FrameworkInstall = 1 then begin
104: Result := Names[I];
105: end;
106: end;
107: end;
108: end;