Welcome to MSDN Blogs Sign in | Join | Help

Updated sample code that can detect the .NET Framework 3.5

Now that the .NET Framework 3.5 has been released, I have posted an updated version of the .NET Framework detection sample code that I previously published.  The updated version includes logic to detect the presence of the .NET Framework 3.5 and also .NET Framework 3.0 service packs, which was missing from previous versions of this sample code.

You can download updated versions of the sample code at the following locations:

For reference, the registry locations used in this sample code to detect the .NET Framework 3.0 service pack level and the .NET Framework 3.5 are listed below.

To detect the .NET Framework 3.0 service pack level:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0]
SP = <value>

Note - this SP value will not exist at all if you only have the original release of the .NET Framework 3.0.  This value was added starting in the .NET Framework 3.0 SP1 and will be updated for future service packs.

To detect the .NET Framework 3.5 final release:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]
Install = 1
Version = 3.5.21022.08

To detect the .NET Framework 3.5 service pack level:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5]
SP = <value>

Note - this SP value does exist in the final release of the .NET Framework 3.5, and will be set to 0.  Future service packs will increment this value as appropriate.

<update date="4/8/2009"> Fixed broken links to the sample code. </update>

 

Published Thursday, November 29, 2007 9:35 PM by astebner

Comments

Friday, November 30, 2007 10:03 AM by Jason Haley

# Interesting Finds: November 30, 2007

Friday, November 30, 2007 1:04 PM by Meta-Code

# Powershell script to get installed versions of the .NET Framework

Powershell script to get installed versions of the .NET Framework

Friday, November 30, 2007 2:15 PM by someone

# re: Updated sample code that can detect the .NET Framework 3.5

Hey I have a different question. What happened to the update.exe switches like "/nobackup", "/forcerestart", "/promptrestart" and "/overwriteoem" etc etc. There were so many switches for Update.exe. Are they all removed in Windows Vista? Both pkgmgr.exe and wusa.exe have very limited number of switches.

Friday, November 30, 2007 2:49 PM by astebner

# re: Updated sample code that can detect the .NET Framework 3.5

Hi Someone - Update.exe is only used on OS's before Windows Vista.  There are a different set of switches, and it looks like not all of the ones offered by update.exe are available from pkgmgr or wusa.  I'm not sure why there is such a big discrepancy, but in at least some of the cases, the command line switches are not relevant anymore because the Windows Vista OS is installed and serviced using an entirely new installation technology.

There is more information about wusa at http://support.microsoft.com/kb/934307, included supported command line switches.  Wusa is essentially a wrapper around some of the same things that pkgmgr can do.  Pkgmgr can be run with /? to see the syntax of the command line switches, but using it directly requires some specific knowledge about how Windows Vista OS components/packages are composed and it isn't advised to try to run it directly in most cases.

Saturday, December 01, 2007 8:37 AM by someone

# re: Updated sample code that can detect the .NET Framework 3.5

I don't see how particularly /forcerestart, /warnrestart, /promptrestart, /overwriteoem, /nobackup, /forceappsclose are all not relevant anymore. Also, the new servicing stack seems to have introduced additional time before, while and after applying any update/hotfix instead of reducing/eliminating it. After every small update/hotfix which is today frequently being delivered over Windows Update, I see the "Configuring updates...please wait" screen for quite some time before logon. Can you blog about what exactly Windows Vista is doing during that time and whether a user can do anything to speed it up? In fact I cannot see how the entirely new servicing stack improves upon the older one except that now its possible to service the image "offline". According to http://technet2.microsoft.com/WindowsVista/en/library/77bd6146-1dae-4f3f-b172-4aa5fc876bdc1033.mspx, package manager does not seem to backup files to %Windir% like Update.exe. What happens then if a user does SFC.EXE and original unpatched files are restored from the Vista DVD? Usually pre-Vista, SFC restored updated/patched files from the backed up location. How is this handled in Vista if no backup is made before patching?

Monday, December 03, 2007 12:06 AM by astebner

# re: Updated sample code that can detect the .NET Framework 3.5

Hi Someone - I didn't work on the team that created the Vista servicing stack, so I can't answer all of your questions unfortunately.  Windows Vista stores a copy of each OS file, including each version installed by patches, in %windir%\winsxs, and it is not possible to cause Windows Vista to downgrade to unpatched files using sfc.exe without installing the hotfix that contains the newer versions of the files.  Because of that, I don't think the /nobackup or /overwriteoem switches make sense any more.  I'm not sure about some of the other switches.

There are some performance issues with the servicing stack that are being worked on for future hotfixes or service packs of Windows Vista.  There isn't really anything the user can do to speed up the "configuring updates" dialog - that time is being spent by the servicing stack configuring the hotfixes on the system.

Monday, December 03, 2007 11:05 AM by The Daily Find #9 - TechToolBlog

# The Daily Find #9 - TechToolBlog

Monday, December 10, 2007 1:25 PM by dalkema

# re: Updated sample code that can detect the .NET Framework 3.5

Too bad there wasn't a way to query WMI for a list of runtimes.

Monday, December 10, 2007 1:37 PM by astebner

# re: Updated sample code that can detect the .NET Framework 3.5

Hi Dalkema - There are not any pre-built WMI queries to detect the .NET Framework version.  However, the versions of the .NET Framework can be detected by looking up registry values, which I think is a fairly straightforward way of detecting product install state.  Are there some advantages gained by supporting WMI queries for this type of detection as opposed to registry detection?  I am asking because I don't have much experience using WMI.

Friday, January 25, 2008 8:05 PM by Aaron Stebner's WebLog

# .NET Framework 3.5 deployment guides have been published on MSDN

The official deployment guides for system administrators and application developers have been posted

Friday, January 25, 2008 8:20 PM by Noticias externas

# .NET Framework 3.5 deployment guides have been published on MSDN

The official deployment guides for system administrators and application developers have been posted

Friday, February 29, 2008 9:01 PM by Aaron Stebner's WebLog

# Prerequisites for running XNA Framework 2.0-based games on Windows

There are a several prerequisite dependencies that must be satisfied on a Windows system that does not

Friday, February 29, 2008 9:25 PM by Noticias externas

# Prerequisites for running XNA Framework 2.0-based games on Windows

There are a several prerequisite dependencies that must be satisfied on a Windows system that does not

Friday, April 04, 2008 9:19 PM by Aaron Stebner's WebLog

# How to automate the install of the .NET Framework 3.0 OS component on Windows Vista and Windows Server 2008

Windows Vista and Windows Server 2008 include the .NET Framework 2.0 and 3.0 as OS components. However,

Thursday, June 05, 2008 1:18 PM by Aaron Stebner's WebLog

# Unified .NET Framework Troubleshooting Guide

Details about the .NET Framework 2.0 setup packaging Available command line switches for .NET Framework

Monday, July 07, 2008 8:44 PM by Aaron Stebner's WebLog

# Mailbag: How can I detect the presence of the .NET Framework 2.0 or later in my MSI-based installer?

Question: I am creating an application that is built on the .NET Framework 2.0, and I am attempting to

Sunday, August 17, 2008 4:53 PM by The Dark Side of XNA &raquo; Railgun Setup Build

# The Dark Side of XNA &raquo; Railgun Setup Build

Monday, August 18, 2008 8:57 PM by Aaron Stebner's WebLog

# Mailbag: How to create a Visual Studio project to compile the sample .NET Framework detection code

Question: I have downloaded both versions of the sample .NET Framework version detection code (described

Tuesday, December 23, 2008 4:21 PM by Aaron Stebner's WebLog

# Links to information about .NET Framework package sizes and web-based detection logic

Back when the .NET Framework 3.5 shipped, I posted a brief explanation about the size and contents of

# Presenza Framework 3.5 ed eventuale installazione | hilpers

# Wade&#8217;s Word &raquo; Find Dot Net Frameworks on Win32 PC using C++

Saturday, January 31, 2009 11:59 PM by Aaron Stebner's WebLog

# How to create a Visual Studio project to compile the sample .NET Framework detection code

I posted some sample code a while back to demonstrate how to detect whether or not each version of the

Monday, February 23, 2009 10:18 PM by Aaron Stebner's WebLog

# Updated .NET Framework setup verification tool with product filtering is now available

Over the weekend, I posted an updated version of the .NET Framework setup verification tool that contains

Anonymous comments are disabled
 
Page view tracker