• 0

Check for .NET


Question

VB.NET 2003

---------------

Is it possible to make the application check for the .NET Framework on startup? How would I code it so that at least the .NET Framework check works on machines without it?

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Fastest way to check for the .NET Framework... check for the presence of:

%windir%\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll

(replace v1.1.4322 with the version of the Framework you are targetting, if necessary)

But I doubt this is really what you want, because I get the impression from your question that you want a .NET application to check for the presence of the .NET Framework before it runs, and it's not possible to do that. The best thing to do if your app requires the .NET Framework is to have its installer check for it before it installs your app.

Link to comment
Share on other sites

  • 0

Updating DOTNET 1.03 to 1.1 on Win XP

--------------------------------------------------------------------------------

I have a questiosn RE the installation of the succesive versions of DOT NET on my PC.

All versions installed and upgraded show on the Add/Remove panel:

MS NET 1.0.3575

MS NET 1.1

MS NET 1.1 (sp1)

Is this normal?

Shouldnt Net 1.1 replace 1.035?

Should I have uninstalled 1.035 before installing 1.1?

Thanks for the info

Alvaro

Link to comment
Share on other sites

  • 0
Updating DOTNET 1.03 to 1.1 on Win XP

--------------------------------------------------------------------------------

<snipped>

Ok, you've really got to stop putting those separaters from your header to your question. It makes me think your question is just part of your sig.

Anyway, no, the framework is made so that multiple versions can be installed at the same time (as long as they're the same language) for compatibility reasons. Although each version should be completely backwards compatible with others, sometimes it's necessary to take out a feature or mark one as obselete, etc...

You can, however, safely remove all previous versions prior to SP1, and your apps should run fine.

EDIT: Oh wait, those were two different guys. Why didn't you create your own thread alvarohig?

Link to comment
Share on other sites

  • 0

You should make an installer with Inno Setup and ISTool. Inno Setup is a great, freeware (even for commercial use) installer system. Inno Setup doesn't plaster the name "Inno Setup" anywhere in the setup, making a professional look.

You can download the QuickStart Pack, which installs both Inno Setup and ISTool, plus some other goodies, here.

Once you're done, add this code to the Code section:

//.NET Framework 1.1 check code

function CheckForFramework : boolean;
var
	regresult : cardinal;
begin
	RegQueryDWordValue (HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'Install', regresult)
	if regresult = 0 then
	begin
  Result := true;
	end
	else
  Result := false;
end;
//Internet Explorer check code

function GetIExplorerVersion(): String;
var
    sVersion:  String;
begin
    RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Internet Explorer', 'Version', Result );
    if ( Result = '' ) then
    begin
        RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Internet Explorer', 'IVer', sVersion );
        if ( sVersion &lt;&gt; '' ) then
        begin
 	 Result := '';
 	 case sVersion of
    '103':
        Result := '3.0';
    '102':
   	 Result := '2.5';
    '101':
   	 Result := '2.0';
    '100':
   	 Result := '1.0';
 	 end;
  end;
    end;
end;

function InitializeSetup(): Boolean;
var
    sIEVersion:  String;
    cIEMinVersionRegistry: String;
    cIEMinVersionShowed: String;
begin
    Result := true;
    cIEMinVersionRegistry := '5.00.2920.0000';
    cIEMinVersionShowed   := '5.01';
    sIEVersion := GetIExplorerVersion();
    if ( sIEVersion &lt;= cIEMinVersionRegistry ) then
    begin
  if ( sIEVersion = '' ) then
 	 sIEVersion := '';
 	 MsgBox( '&lt;&lt;&lt;put your app name here&gt;&gt;&gt; requires Internet Explorer 5.01 or later. Internet Explorer ' + sIEVersion + ' was detected. Please install Internet Explorer from this disc (if applicable) or download it from Windows Update.', mbError, MB_OK );
 	 Result := false;
	end;
end;

Finally, add this code to Files:

Source: &lt;&lt;&lt;path where you downloaded the .NET Framework 1.1&gt;&gt;&gt;; DestDir: {tmp}; Check: CheckForFramework; DestName: dnfx11.exe; Flags: nocompression

Make sure you fill in the stuff in the <<<>>>s to make sure it works.

Link to comment
Share on other sites

  • 0
There's an MSI sample on MSDN that automatically checks for the Framework before installing your app. Look into this (Y)

584707618[/snapback]

What makes the Inno Setup solution cooler is:

a) It installs the .NET Framework if necessary the same time it installs the app. The Microsoft solution installs the .NET Framework before the setup even starts. This means if the user doesn't already have the .NET Framework and starts the setup, then decides he/she wants to cancel, the .NET Framework will be left.

b) The Inno Setup solution will make the whole installer a single file. The MS solution gives you the MSI file, the INF file, the .NET Framework redist, the ANSI and Unicode versions of the Windows Installer redist, the .NET Framework redist bootstrap, and the Windows Installer redist bootstrap. If you want to package it up as a single file for web use, you've gotta use a 7-zip SFX or an IExpress package, which increases the time before the Welcome screen appears further. That brings me to c)...

c) Inno Setup can compress with ZIP, BZIP2, or 7-zip with no additional post-compile steps. No SFX required.

Link to comment
Share on other sites

  • 0
What makes the Inno Setup solution cooler is:

a) It installs the .NET Framework if necessary the same time it installs the app. The Microsoft solution installs the .NET Framework before the setup even starts. This means if the user doesn't already have the .NET Framework and starts the setup, then decides he/she wants to cancel, the .NET Framework will be left.

SO?!? :p It's a seperate product, not part of my app, it should remain installed :D

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.