Partilhar via


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>

Comments

  • Anonymous
    November 30, 2007
    Powershell script to get installed versions of the .NET Framework

  • Anonymous
    November 30, 2007
    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.

  • Anonymous
    November 30, 2007
    The comment has been removed

  • Anonymous
    December 01, 2007
    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?

  • Anonymous
    December 02, 2007
    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.

  • Anonymous
    December 03, 2007
    PingBack from http://www.techtoolblog.com/archives/the-daily-find-9

  • Anonymous
    December 10, 2007
    Too bad there wasn't a way to query WMI for a list of runtimes.

  • Anonymous
    December 10, 2007
    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.

  • Anonymous
    January 25, 2008
    The official deployment guides for system administrators and application developers have been posted

  • Anonymous
    January 25, 2008
    The official deployment guides for system administrators and application developers have been posted

  • Anonymous
    February 29, 2008
    There are a several prerequisite dependencies that must be satisfied on a Windows system that does not

  • Anonymous
    February 29, 2008
    There are a several prerequisite dependencies that must be satisfied on a Windows system that does not

  • Anonymous
    April 04, 2008
    The comment has been removed

  • Anonymous
    June 05, 2008
    The comment has been removed

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

  • Anonymous
    August 17, 2008
    PingBack from http://www.darklock.com/xna/?p=53

  • Anonymous
    August 18, 2008
    Question: I have downloaded both versions of the sample .NET Framework version detection code (described

  • Anonymous
    December 23, 2008
    Back when the .NET Framework 3.5 shipped, I posted a brief explanation about the size and contents of

  • Anonymous
    January 18, 2009
    PingBack from http://www.hilpers.it/2760061-presenza-framework-3-5-ed

  • Anonymous
    January 21, 2009
    PingBack from http://wadesword.org/Blog/?p=289

  • Anonymous
    January 31, 2009
    I posted some sample code a while back to demonstrate how to detect whether or not each version of the

  • Anonymous
    February 23, 2009
    Over the weekend, I posted an updated version of the .NET Framework setup verification tool that contains