Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2006, 01:48 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Testing if .NET framework installed

What's the most straightforward method for testing for installation of the correct version of the .NET framework?

I have an app I'm working on that requires the 2.x framework. If it's not installed , I'd like the program to gracefully and silently exit rather than popping up the error box.

It would be nice if it could also notify me of the error -- perhaps exiting with a unique errorlevel that I could test for in the script that will run the app.

Thanks!

D.



 
Old March 1st, 2006, 08:36 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How to detect the installed version of the .NET Framework in a Visual Studio Setup and Deployment package: http://support.microsoft.com/default...;EN-US;Q315291

You might want to check out these related topics:

Application Deployment Prerequisites (.NET Framework SDK Guide):
http://msdn2.microsoft.com/en-us/library/h4k032e1.aspx

Deploying .NET Framework Applications: http://msdn2.microsoft.com/en-us/library/6hbb4k3e(VS.80).aspx

- A.Kahtava
 
Old March 2nd, 2006, 01:13 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for that information, however those articles apply to application deployment and specifically state that they do not address how to make the determination programmatically (which is what I need).

D.

 
Old March 2nd, 2006, 07:20 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the first article it is revealed to use that that the version of .NET is stored in the Windows Registry. As we continue reading through the article we see:

The Registry Key for the .NET Framework 1.0:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramewor k\policy\v1.0
The Registry Key for the .NET Framework 1.1:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramewor k\policy\v1.1
The Registry Key for the .NET Framework 2.0:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramewor k\policy\v2.0

Now we can now build a routine to check the registry keys using the Microsoft.Win32 namespace.


- A.Kahtava
 
Old March 2nd, 2006, 07:25 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Related links:

Working with Registry in .NET: http://www.codeproject.com/csharp/dotnet_registry.asp

All (you wanted to know) about the Registry with C#: http://www.codeproject.com/csharp/registry1.asp

- A.Kahtava





Similar Threads
Thread Thread Starter Forum Replies Last Post
Does asp.net atlas should be installed in web serv arulkumar ASP.NET 2.0 Basics 1 February 12th, 2007 08:45 AM
Visual Studio .NET 2003 with .NET 2 Framework testsubject VS.NET 2002/2003 1 July 27th, 2006 03:25 PM
running .net apps w/o installing .net framework connect2sandep General .NET 2 June 24th, 2005 04:45 AM
Is .NET framework req. to install .NET application tact_259 VS.NET 2002/2003 2 May 20th, 2004 08:20 PM
.net could not be installed quetzalcoatl VS.NET 2002/2003 0 December 23rd, 2003 12:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.