.NET - Detect framework

From ISXKB

(Difference between revisions)
Jump to: navigation, search
m (MSKB link)
Current revision (14:41, 2 January 2011) (view source)
m (External links)
 
(8 intermediate revisions not shown.)
Line 1: Line 1:
 +
Detect if the .NET framework is installed, and open a browser window with the download URL if it is not.
 +
Code provided by AG and Matej Cerk
Code provided by AG and Matej Cerk
<pre>
<pre>
-
 
[Setup]
[Setup]
AppName=NETFramewrok
AppName=NETFramewrok
Line 13: Line 14:
function InitializeSetup(): Boolean;
function InitializeSetup(): Boolean;
var
var
-
    ErrorCode: Integer;
+
  ErrorCode: Integer;
-
    NetFrameWorkInstalled : Boolean;
+
  NetFrameWorkInstalled : Boolean;
-
    Result1 : Boolean;
+
  Result1 : Boolean;
begin
begin
-
+
  NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.0');
-
NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.0');
+
  if NetFrameWorkInstalled then
-
if NetFrameWorkInstalled =true then
+
  begin
-
begin
+
    Result := true;
-
Result := true;
+
  end else
-
end;
+
  begin
-
+
    NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.1');
-
if NetFrameWorkInstalled = false then
+
    if NetFrameWorkInstalled then
-
begin
+
    begin
-
NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.1');
+
      Result := true;
-
if NetFrameWorkInstalled =true then
+
    end else
-
begin
+
    begin
-
Result := true;
+
      Result1 := MsgBox('This setup requires the .NET Framework. Please download and install the .NET Framework and run this setup again. Do you want to download the framwork now?',
-
end;
+
        mbConfirmation, MB_YESNO) = idYes;
-
 
+
      if Result1 =false then
-
if NetFrameWorkInstalled =false then
+
      begin
-
begin
+
        Result:=false;
-
Result1 := MsgBox('This setup requires the .NET Framework. Please download and install the .NET Framework and run this setup again. Do you want to download the framwork now?',
+
      end else
-
mbConfirmation, MB_YESNO) = idYes;
+
      begin
-
if Result1 =false then
+
        Result:=false;
-
begin
+
        ShellExec('open',
-
Result:=false;
+
          'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe',
-
end
+
          '','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
-
else
+
      end;
-
begin
+
    end;
-
Result:=false;
+
  end;
-
ShellExec('open',
+
-
'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe',
+
-
'','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
+
-
                end;
+
-
            end;
+
-
end;
+
end;
end;
-
 
</pre>
</pre>
== See also ==
== See also ==
-
[http://support.microsoft.com/kb/315291 MSKB - How to detect the installed version of the .NET Framework]
+
*[[Acrobat Reader - Detect installed version]]
 +
*[[DirectX - How to detect DirectX version]]
 +
*[[MDAC - How to detect version of MDAC installed]]
 +
*[[Visual FoxPro]]
 +
 
 +
== External links ==
 +
*[http://support.microsoft.com/kb/315291 MSKB - How to detect the installed version of the .NET Framework]
 +
*[http://www.codeproject.com/KB/install/dotnetinstallerforinno.aspx .NET Framework 1.1 Installer for Innosetup] at CodeProject
 +
*[http://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx .NET Framework 1.1/2.0/3.5 Installer for InnoSetup] by stfx at CodeProject
 +
* [http://tonaday.blogspot.com/2010/12/innosetup.html .NET Framework 1.1..4.0, VC++2010, SQL 2008 R2 Express Installer for InnoSetup] (Based on 'stfx at CodeProject') by Ton
 +
* [http://zerosandtheone.com/blogs/vb/archive/2008/06/23/vb-net-install-your-app-and-the-net-framework-using-inno-setup.aspx .NET : Install your app and the .NET framework using INNO Setup] at Zerosandtheone
 +
* [http://priyank.co.in/install-dot-net-framework-using-inno-setup Detect & Install .NET 3.5 Framework using Inno Setup.] By Priyank Bolia
 +
* [http://www.kynosarges.de/DotNetVersion.html Check .NET Version with Inno Setup] Kynosarges, detect from .NET 1.1 up to .NET 4.0
[[Category:Applications]]
[[Category:Applications]]

Current revision

Detect if the .NET framework is installed, and open a browser window with the download URL if it is not.

Code provided by AG and Matej Cerk

[Setup]
AppName=NETFramewrok
AppVerName=NETFramewrok
DefaultDirName={pf}\NETFramewrok
DisableStartupPrompt=true
 
[Code]

function InitializeSetup(): Boolean;
var
  ErrorCode: Integer;
  NetFrameWorkInstalled : Boolean;
  Result1 : Boolean;
begin
  NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.0');
  if NetFrameWorkInstalled then
  begin
    Result := true;
  end else
  begin
    NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v1.1');
    if NetFrameWorkInstalled then
    begin
      Result := true;
    end else
    begin
      Result1 := MsgBox('This setup requires the .NET Framework. Please download and install the .NET Framework and run this setup again. Do you want to download the framwork now?',
        mbConfirmation, MB_YESNO) = idYes;
      if Result1 =false then
      begin
        Result:=false;
      end else
      begin
        Result:=false;
        ShellExec('open',
          'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe',
          '','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
      end;
    end;
  end;
end;

See also

External links

Personal tools
Ads: