Inno Setup script not install. Displays error: "Internal error: .Net Framework not found" [duplicate] - inno-setup

I have a component that requires .NET 4.0 to run, how can my Inno Setup installer verify that it is installed, and if not, prompt the user to install it?

The InitializeSetup function is called when the Inno Setup executable is run. Inserting this code for a custom script should do what you want:
function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
// 'v1.1' .NET Framework 1.1
// 'v2.0' .NET Framework 2.0
// 'v3.0' .NET Framework 3.0
// 'v3.5' .NET Framework 3.5
// 'v4\Client' .NET Framework 4.0 Client Profile
// 'v4\Full' .NET Framework 4.0 Full Installation
// 'v4.5' .NET Framework 4.5
// 'v4.5.1' .NET Framework 4.5.1
// 'v4.5.2' .NET Framework 4.5.2
// 'v4.6' .NET Framework 4.6
// 'v4.6.1' .NET Framework 4.6.1
// 'v4.6.2' .NET Framework 4.6.2
// 'v4.7' .NET Framework 4.7
// 'v4.7.1' .NET Framework 4.7.1
// 'v4.7.2' .NET Framework 4.7.2
// 'v4.8' .NET Framework 4.8
//
// service -- Specify any non-negative integer for the required service pack level:
// 0 No service packs required
// 1, 2, etc. Service pack 1, 2, etc. required
var
key, versionKey: string;
install, release, serviceCount, versionRelease: cardinal;
success: boolean;
begin
versionKey := version;
versionRelease := 0;
// .NET 1.1 and 2.0 embed release number in version key
if version = 'v1.1' then begin
versionKey := 'v1.1.4322';
end else if version = 'v2.0' then begin
versionKey := 'v2.0.50727';
end
// .NET 4.5 and newer install as update to .NET 4.0 Full
else if Pos('v4.', version) = 1 then begin
versionKey := 'v4\Full';
case version of
'v4.5': versionRelease := 378389;
'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
'v4.5.2': versionRelease := 379893;
'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
'v4.6.1': versionRelease := 394254; // 394271 before Win10 November Update
'v4.6.2': versionRelease := 394802; // 394806 before Win10 Anniversary Update
'v4.7': versionRelease := 460798; // 460805 before Win10 Creators Update
'v4.7.1': versionRelease := 461308; // 461310 before Win10 Fall Creators Update
'v4.7.2': versionRelease := 461808; // 461814 before Win10 April 2018 Update
'v4.8': versionRelease := 528040; // 528049 before Win10 May 2019 Update
end;
end;
// installation key group for all .NET versions
key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
// .NET 3.0 uses value InstallSuccess in subkey Setup
if Pos('v3.0', version) = 1 then begin
success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
end else begin
success := RegQueryDWordValue(HKLM, key, 'Install', install);
end;
// .NET 4.0 and newer use value Servicing instead of SP
if Pos('v4', version) = 1 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
end else begin
success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
end;
// .NET 4.5 and newer use additional value Release
if versionRelease > 0 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
success := success and (release >= versionRelease);
end;
result := success and (install = 1) and (serviceCount >= service);
end;
function InitializeSetup(): Boolean;
begin
if not IsDotNetDetected('v4.6', 0) then begin
MsgBox('MyApp requires Microsoft .NET Framework 4.6.'#13#13
'Please use Windows Update to install this version,'#13
'and then re-run the MyApp setup program.', mbInformation, MB_OK);
result := false;
end else
result := true;
end;
(Code taken from here: http://www.kynosarges.de/DotNetVersion.html)
First, it checks for the presence of a registry entry that indicates the version of the .NET framework that is installed. If the registry entry is not present, it prompts the user to download the .NET framework. If the user says Yes, it opens the download URL. (You may have to change the version it specifies in the script to version 4.0.)
I also came across [this article on CodeProject][1], which may be a more comprehensive and customizable way of doing what you're looking for, although it may take more work to understand and will have to be modified to work with version 4.0.

#Cody Gray - Thanks for your solution. Very helpful!
In case anyone is interested, here is my take on his function using enumeration values instead of strings. This change is purely a matter of personal preference. The code includes the changes for v4.5 and seems to work properly based on my limited testing.
David
[Code]
//
// Enumeration used to specify a .NET framework version
//
type TDotNetFramework = (
DotNet_v11_4322, // .NET Framework 1.1
DotNet_v20_50727, // .NET Framework 2.0
DotNet_v30, // .NET Framework 3.0
DotNet_v35, // .NET Framework 3.5
DotNet_v4_Client, // .NET Framework 4.0 Client Profile
DotNet_v4_Full, // .NET Framework 4.0 Full Installation
DotNet_v45); // .NET Framework 4.5
//
// Checks whether the specified .NET Framework version and service pack
// is installed (See: http://www.kynosarges.de/DotNetVersion.html)
//
// Parameters:
// Version - Required .NET Framework version
// ServicePack - Required service pack level (0: None, 1: SP1, 2: SP2 etc.)
//
function IsDotNetInstalled(Version: TDotNetFramework; ServicePack: cardinal): boolean;
var
KeyName : string;
Check45 : boolean;
Success : boolean;
InstallFlag : cardinal;
ReleaseVer : cardinal;
ServiceCount : cardinal;
begin
// Registry path for the requested .NET Version
KeyName := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\';
case Version of
DotNet_v11_4322: KeyName := KeyName + 'v1.1.4322';
DotNet_v20_50727: KeyName := KeyName + 'v2.0.50727';
DotNet_v30: KeyName := KeyName + 'v3.0';
DotNet_v35: KeyName := KeyName + 'v3.5';
DotNet_v4_Client: KeyName := KeyName + 'v4\Client';
DotNet_v4_Full: KeyName := KeyName + 'v4\Full';
DotNet_v45: KeyName := KeyName + 'v4\Full';
end;
// .NET 3.0 uses "InstallSuccess" key in subkey Setup
if (Version = DotNet_v30) then
Success := RegQueryDWordValue(HKLM, KeyName + '\Setup', 'InstallSuccess', InstallFlag) else
Success := RegQueryDWordValue(HKLM, KeyName, 'Install', InstallFlag);
// .NET 4.0/4.5 uses "Servicing" key instead of "SP"
if (Version = DotNet_v4_Client) or
(Version = DotNet_v4_Full) or
(Version = DotNet_v45) then
Success := Success and RegQueryDWordValue(HKLM, KeyName, 'Servicing', ServiceCount) else
Success := Success and RegQueryDWordValue(HKLM, KeyName, 'SP', ServiceCount);
// .NET 4.5 is distinguished from .NET 4.0 by the Release key
if (Version = DotNet_v45) then
begin
Success := Success and RegQueryDWordValue(HKLM, KeyName, 'Release', ReleaseVer);
Success := Success and (ReleaseVer >= 378389);
end;
Result := Success and (InstallFlag = 1) and (ServiceCount >= ServicePack);
end;

If you don't care if the "Full" or just the "Client" version of .NET 4 is installed:
try
ExpandConstant('{dotnet40}');
// Installed
except
// Not installed
end;

Thanks to everyone for the existing solutions, they work great.
Still, I didn't need to support every framework version, but only one at a time, and no "ancient" ones (.NET 4.0 or older). I don't need to check for service releases too.
So, the code gets a lot simpler, and I find the reduced noise preferrable:
[Code]
// http://www.kynosarges.de/DotNetVersion.html
function IsDotNetDetected(): boolean;
var
key: string;
install, release: cardinal;
success: boolean;
begin
key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full'
// success: true if the registry has been read successfully
success := RegQueryDWordValue(HKLM, key, 'Install', install);
success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
// install = 1 if framework is installed
// 461808 -> .NET 4.7.2 461814 before Win10 April 2018 Update
// see https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
// for details
result := success and (install = 1) and (release >= 461808);
end;
function InitializeSetup(): Boolean;
begin
if not IsDotNetDetected() then begin
MsgBox('MyApp requires Microsoft .NET Framework 4.7.2.'#13#13
'Please install it and then re-run this setup program.', mbInformation, MB_OK);
result := false;
end else
result := true;
end;
You just need to replace in the code above the version constant (461808) with the value you need from the Microsoft reference page and update the error message accordingly.

I found out that this functionality has been part of the framework since at least innosetup version 6.0.5. Therefore, you do not necessarily have to code the function yourself.
Function: IsDotNetInstalled
Here is a short example:
[Setup]
AppName=".NET Framwork Test"
AppVersion=0.0.0.1
DefaultDirName={tmp}\MyApp
[Code]
function InitializeSetup(): Boolean;
begin
Result := IsDotNetInstalled(net45, 0);
if Result then begin
MsgBox('Min .NET Framwork is installed', mbInformation, MB_OK);
end else begin
MsgBox('Min .NET Framwork is not installed', mbInformation, MB_OK);
end;
end;

Related

Detecting if WebView2 Runtime is installed with Inno Setup

There is a good discussion about this here on the Microsoft website:
Detect if a suitable WebView2 Runtime is already installed
In part, it states:
Inspect the pv (REG_SZ) regkey for the WebView2 Runtime at both of the
following registry locations. The HKEY_LOCAL_MACHINE regkey is used
for per-machine install. The HKEY_CURRENT_USER regkey is used for
per-user install.
For WebView2 applications, at least one of these regkeys must be
present and defined with a version greater than 0.0.0.0. If neither
regkey exists, or if only one of these regkeys exists but its value is
null, an empty string, or 0.0.0.0, this means that the WebView2
Runtime isn't installed on the client. Inspect these regkeys to detect
whether the WebView2 Runtime is installed, and to get the version of
the WebView2 Runtime. Find pv (REG_SZ) at the following two locations.
The two registry locations to inspect on 64-bit Windows:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
The two registry locations to inspect on 32-bit Windows:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
My installer uses elevation so I have limited my checks to HKEY_LOCAL_MACHINE. I believe this was the correct thing to do. This is my attempt at writing this function:
function IsWebView2RuntimeNeeded(): boolean;
var
Version: string;
RuntimeNeeded: boolean;
VerifyRuntime: boolean;
begin
{ See: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed }
RuntimeNeeded := true;
VerifyRuntime := false;
{ Since we are using an elevated installer I am not checking HKCU }
if (IsWin64) then
begin
{ Test x64 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end
else
begin
{ Test x32 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end;
end;
{ Verify the version information }
if (VerifyRuntime) then
begin
if (not Version = '' and not Version = '0.0.0.0') then
Log('WebView2 Runtime is installed');
RuntimeNeeded := false;
else
Log('WebView2 Runtime needs to be downloaded and installed');
end;
end;
Result := RuntimeNeeded;
end;
But it will not compile and says:
Column 40 type mismatch.
It doesn't like this line:
if (not Version = '' and not Version = '0.0.0.0') then
I am not confident writing native Pascal Script so I appreciate guidance on correcting or improving this code so that it works efficiently.
I am comfortable with the other aspects of actually downloading the file and starting its installer because I can follow the principle for the other downloads in my setup script. It is just putting this actual test together to verify if the WebView2 runtime is installed or not.
I was able to glean some advice from one of the comments to this question on another website:
How to write an if and statement?
My current code is now:
function IsWebView2RuntimeNeeded(): boolean;
var
Version: string;
RuntimeNeeded: boolean;
VerifyRuntime: boolean;
begin
{ See: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed }
RuntimeNeeded := true;
VerifyRuntime := false;
{ Since we are using an elevated installer I am not checking HKCU }
if (IsWin64) then
begin
{ Test x64 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end
else
begin
{ Test x32 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end;
end;
{ Verify the version information }
if (VerifyRuntime) then
begin
if (Version <> '') and (Version <> '0.0.0.0') then
begin
Log('WebView2 Runtime is installed');
RuntimeNeeded := false;
end
else
Log('WebView2 Runtime needs to be downloaded and installed');
end;
end;
Result := RuntimeNeeded;
end;
I also had to add the begin and end keywords to that if statement. Feel free to update or add your own answer if you can see a more efficient way to write this code. For example, the original article I linked to mentioned an alternative (GetAvailableCoreWebView2BrowserVersionString). I assume we can't use that approach.

Update an InnoSetup Installation - Update Previous Install Dir

I am creating installers for either full application and patch.
For the full app installer (300MB+), versioning is x.x.0 (ex. 1.1.0).
And for the patch (10MB+) it is x.x.x (ex. 1.1.1).
The installation folder is formatted like this: "App Name ".
Example - App Name 1.1.0, App Name 1.1.1
There should only be 1 version of the app that resides in the machine, so for full version installs - when the app is detected to be previously installed, the existing app is uninstalled first.
So the scenario is like this:
User installs a full app - 1.1.0 (OK)
Directory App Name 1.1.0 is created
User installs a patch - 1.1.1 (OK)
UsePreviousAppDir=true so it writes on top of directory App Name 1.1.0
App Name 1.1.0 is renamed to App Name 1.1.1 as part of CurStepChanged() when CurStep is ssPostInstall.
User installs a full app - 1.2.0 (NOK - expected to uninstall the prev version 1.1.1 and install this new version 1.2.0)
If UsePreviousAppDir is true, directory App Name 1.1.0 is created. This is because this is what Innosetup remembers as the "previous app" (since we only renamed the patch).
If UsePreviousAppDir is false, directory App Name 1.2.0 is created. And the prev version App Name 1.1.1 is not uninstalled because the previous install was pointing to App Name 1.1.0.
How can I configure my ISS file so that when I do a full install after a patch install, it can still find the renamed directory and uninstall it?
For reference, here is my code for renaming in patch installer:
{ ///////////////////////////////////////////////////////////////////// }
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssPostInstall) then begin
RenameFile(ExpandConstant('{app}'), ExpandConstant('{app}\..\{#MyAppName} {#MyAppVersion}'))
end;
end;
And for my uninstall script (full version):
{ ///////////////////////////////////////////////////////////////////// }
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
{ ///////////////////////////////////////////////////////////////////// }
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
{ ///////////////////////////////////////////////////////////////////// }
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
{ Return Values: }
{ 1 - uninstall string is empty }
{ 2 - error executing the UnInstallString }
{ 3 - successfully executed the UnInstallString }
{ default return value }
Result := 0;
{ get the uninstall string of the old app }
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
{ ///////////////////////////////////////////////////////////////////// }
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;
And my [UninstallDelete] section in the patch installer, in case user wants to uninstall the entire thing:
[UninstallDelete]
Type: filesandordirs; Name: "{app}\..\{#MyAppName} {#MyAppVersion}"
Thanks!

Inno Setup check version of external application

What I'm trying to achieve is to check if Node.js is already is installed, and if so I wanna check for the version being up to date, let's say 8.x.x
From the question below I already achieved the initial check for it being installed at all. My Code looks pretty similar to the answer of the question.
Using Process Exit code to show error message for a specific File in [Run]
Now I'm struggling with reading the actual output of the node -v command (Expected result a string containing the version).
Is there a way to achieve that?
Running an application and parsing its output is rather inefficient way to check, if it exists and its version. Use FileSearch (node.exe is added to PATH) and GetVersionNumbers functions instead.
[Code]
function CheckNodeJs(var Message: string): Boolean;
var
NodeFileName: string;
NodeMS, NodeLS: Cardinal;
NodeMajorVersion, NodeMinorVersion: Cardinal;
begin
{ Search for node.exe in paths listed in PATH environment variable }
NodeFileName := FileSearch('node.exe', GetEnv('PATH'));
Result := (NodeFileName <> '');
if not Result then
begin
Message := 'Node.js not installed.';
end
else
begin
Log(Format('Found Node.js path %s', [NodeFileName]));
Result := GetVersionNumbers(NodeFileName, NodeMS, NodeLS);
if not Result then
begin
Message := Format('Cannot read Node.js version from %s', [NodeFileName]);
end
else
begin
{ NodeMS is 32-bit integer with high 16 bits holding major version and }
{ low 16 bits holding minor version }
{ shift 16 bits to the right to get major version }
NodeMajorVersion := NodeMS shr 16;
{ select only low 16 bits }
NodeMinorVersion := NodeMS and $FFFF;
Log(Format('Node.js version is %d.%d', [NodeMajorVersion, NodeMinorVersion]));
Result := (NodeMajorVersion >= 8);
if not Result then
begin
Message := 'Node.js is too old';
end
else
begin
Log('Node.js is up to date');
end;
end;
end;
end;
function InitializeSetup(): Boolean;
var
Message: string;
begin
Result := True;
if not CheckNodeJs(Message) then
begin
MsgBox(Message, mbError, MB_OK);
Result := False;
end;
end;
Since Inno Setup 6.1, you can use GetVersionComponents instead of GetVersionNumbers to avoid the bit magics.
For a similar question, see Checking if Chrome is installed and is of specific version using Inno Setup.

How to install .net framework 4.5 after download completes from web using innosetup?

I want to download and install the .netframework 4.5 from web using innosetup.
I followed these procedure,
1.I downloaded and installed InnoTools Downloader.
2.In InitializeWizard i declared
itd_init;
itd_addfile('http://go.microsoft.com/fwlink/?LinkId=225702',expandconstant('{tmp}\dotNetFx45_Full_x86_x64.exe'));
itd_downloadafter(10);
Where 10 is the curpageId.
And in
NextButtonClick(CurPageID: Integer) i added ,
if CurPageId=104 then begin
`filecopy(expandconstant('{tmp}\dotNetFx45_Full_x86_x64.exe'),expandconstant('{app}\dotNetFx`45_Full_x86_x64.exe'),false);
end
*Now what i need to do is,i want to check whether .net framework 4.5 is installed in my pc or not, using the function how can i check *,
function Framework45IsNotInstalled(): Boolean;
var
bVer4x5: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
strVersion: String;
iPos: Cardinal;
ErrorCode: Integer;
begin
Result := True;
bVer4x5 := False;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then
begin
bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', strVersion);
if (True = bSuccess) then
Begin
iPos := Pos('4.5.', strVersion);
if (0 < iPos) then bVer4x5 := True;
End
end;
if (True = bVer4x5) then begin
Result := False;
end;
end;
where i need to check this condition, in my side downloading and installing of .netframework 4.5 is happening fine,the only condition i need to check whether .net framework 4.5 is installed or not,before calling this **itd_downloadafter(10)Where 10 is the curpageId.**.
Then only download wont happen, if .netframework is already exist in my enduser pc.
How can i achieve this task? any ideas?
The release version numbers in the registry for .NET 4.5 are highlighted in MSDN: http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
Your code needs to be modified to look at the 'Release' key in the registry as specified in the MDSN article above and can be simplified just to check for this value.
function Framework45IsNotInstalled(): Boolean;
var
bSuccess: Boolean;
regVersion: Cardinal;
begin
Result := True;
bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion);
if (True = bSuccess) and (regVersion >= 378389) then begin
Result := False;
end;
end;
end;
For a more complete example of checking .NET version numbers with Inno Setup you can also look at the code in this very useful article: http://kynosarges.org/DotNetVersion.html

How to change the downloadpath in InnoSetup?

I want to download and install the .net framework 4.5 with silent installation in innosetup,using below condition i will check whether .netframework 4.5 available or not, if not i will download from web using shellexec. here i attached the code.
function Framework45IsNotInstalled: Boolean;
var
bVer4x5: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
strVersion: String;
iPos: Cardinal;
ErrorCode: Integer;
begin
Result := True;
bVer4x5 := False;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then
begin
bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', strVersion);
if (True = bSuccess) then
Begin
iPos := Pos('4.5.', strVersion);
if (0 < iPos) then bVer4x5 := True;
End
end;
if (True = bVer4x5) then begin
Result := False;
end;
ShellExec('', 'http://go.microsoft.com/fwlink/?LinkId=225702','{app}', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
Now my doubt is,while starting the download it opens the web browser, and it doesn't install the .net framework automatically, user need to install manually,i want innosetup to install automatically after download is happening, installation should happen in silent manner.Can i get any idea to achieve this task??
When using ShellExec() to tell the default browser to download something, then you have no control over what it does.
If you want to be able to run it afterwards, you will need to use an integrated downloader like InnoTools Downloader, or just ask the user to run it the install.

Resources