Microsoft Knowledge Base Email Alertz

KBAlertz.com: This step-by-step article shows you how to use the .NET Framework Software Development Kit (SDK) and the Visual Studio .NET IDE to verify which version of the .NET Framework is installed on a client computer for application deployment purposes. NOTE:...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 315291 - Last Review: December 3, 2007 - Revision: 6.5

How to detect the installed version of the .NET Framework in a Visual Studio Setup and Deployment package

This article was previously published under Q315291

On This Page

INTRODUCTION

This step-by-step article describes how to use the Microsoft Visual Studio .NET IDE to verify the version of the .NET Framework that is installed on a client computer for software installation purposes.

Note This article does not show you how to programmatically detect the .NET Framework in a managed application. The scenario that is covered in this article is a deployment scenario where a developer is not sure of the version of the .NET Framework that is installed on the client computer. This article also does not show you how to detect if a service pack is installed in the .NET Framework.

MORE INFORMATION

Required knowledge

This article assumes that you are familiar with the following topic:

Visual Studio .NET deployment and setup projects

Detect the current installed version

To add a launch condition in the deployment project against the .NET Framework version registry key, follow these steps:
  1. Create a new Visual Studio Setup project from the Setup and Deployment project type.
  2. Start Solution Explorer, and then open Launch Conditions Editor from the Solution Explorer toolbox.
  3. In Launch Conditions Editor, right-click the Search Target Machine node, and then click Add Registry Search.
  4. Type an appropriate name for the search, such as "Search CLR version."
  5. Click the new search, and then press F4 to open Launch Condition Properties. Alternatively, on the main menu, click View, and then click Properties Window.
  6. Set the RegKey property to one of the following values:
    For the .NET Framework 1.0:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0

    For the .NET Framework 1.1:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.1

    For the .NET Framework 2.0:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v2.0
  7. Set the Value property as follows:
    • For the .NET Framework 1.0: "3705"
    • For the .NET Framework 1.1: "4322"
    • For the .NET Framework 2.0: "50727"
  8. In the Launch Conditions node, add a new launch condition. To do this, right-click the node, and then click Add Launch Condition. Give this condition an appropriate name, such as "CLR condition."
  9. Click the new condition, and then set the Condition property as follows:
    • For the .NET Framework 1.0:
      REGISTRYVALUE = "3321-3705"
    • For the .NET Framework 1.1:
      REGISTRYVALUE="3706-4322"
    • For the .NET Framework 2.0:
      REGISTRYVALUE="50727-50727"
  10. Set the Message property to an output message, such as "The .NET Framework 1.0 is not installed.", "The .NET Framework 1.1 is not installed.", or "The .NET Framework 2.0 is not installed."
  11. Build and test the deployment project.
Note For testing purposes on the computer that you use for development you may modify the registry as follows. For all of the examples the placeholder XXX is the version of the .NET Framework that you are testing.

Locate the following key for the .NET Framework 1.0:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0
Rename the previous key to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\XXXv1.0
Locate the following key for the .NET Framework 1.1:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.1
Rename the previous key to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\XXXv1.1
Locate the following key for the .NET Framework 2.0:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v2.0
Rename the previous key to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\XXXv2.0

Do not forget to rename the key after you complete your test.

REFERENCES

For additional information, visit the following Microsoft Developer Network (MSDN) Web sites:
Creating or adding deployment projects
http://msdn.microsoft.com/en-us/library/aa291133.aspx (http://msdn.microsoft.com/en-us/library/aa291133.aspx)

Adding items to a deployment project
http://msdn.microsoft.com/en-us/library/aa291131.aspx (http://msdn.microsoft.com/en-us/library/aa291131.aspx)

Properties for the Launch Conditions Editor
http://msdn.microsoft.com/en-us/library/aa291900.aspx (http://msdn.microsoft.com/en-us/library/aa291900.aspx)

Adding a launch condition in the Launch Conditions Editor
http://msdn.microsoft.com/en-us/library/aa301646.aspx (http://msdn.microsoft.com/en-us/library/aa301646.aspx)

APPLIES TO
  • Microsoft .NET Framework 1.0
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 2.0
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
Keywords: 
kbhowtomaster KB315291
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please