May 4th, 2010

Detection keys for .NET Framework 4.0 and Visual Studio 2010

Heath Stewart
Principal Software Engineer

Now that Microsoft .NET Framework 4.0 and Visual Studio 2010 have been released, developers may wonder how to detect them on the system. As with previous releases, we support registry detection of either product family and Windows Installer component detection for Visual Studio. Detecting either product uses a separate set of supported keys.

.NET Framework 4.0

The .NET Framework has and continues to use registry keys and values under HKLM\Software\Microsoft\NET Framework Setup. To detect .NET Framework 4.0, you can check if the following key is present and the value is set to 1.

Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)

The core .NET Framework 4.0 package is English, so 1033 is always available. To detect specific language support, see the LCIDs listed in the table of supported languages. You can also detect if the full package is installed, which includes the core (Client) and extended support, such as ASP.NET.

Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)

For more information, see the .NET Framework 4.0 deployment guide for developers. Administrators may be interested in the .NET Framework deployment guide for administrators.

Visual Studio 2010

The detection keys for Visual Studio are used both to detect if the product is installed and what service pack level is installed. As with previous versions, these keys and values are under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing.

Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\$(var.ProductEdition)\$(var.LCID)
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)

The values for $(var.ProductEdition) include the following table. The for other products, this value corresponds to the ProductEdition property in the Property table of the Windows Installer package for that product. The locale IDs for $(Var.LCID) are listed here.

Visual Studio 2010 Ultimate VSTSCore
Visual Studio 2010 Premium VSTDCore
Visual Studio 2010 Professional PROCore
Visual Studio 2010 Shell (Integrated) IntShell

For Dev10 we have also added detection values to the edition keys so that you do not have to detect every single language for ever edition.

Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0\$(var.ProductEdition)
Name Install
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)

These registry keys and values are also used to detect the service pack level. Instead of checking for the Name registry value, check the SP registry value. Ignore SPIndex; Microsoft uses this internally. In addition to the registry keys above, we also set a version-dependent registry value listed below.

Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0
Name SP
Type REG_DWORD (32-bit integer)
Data 0x00000001 (1)

Keep in mind, however, that as with all shared resources the more shared a resource is the less accurate it may be. This is because there is no version policy for registry values and other resources that do not have versions like text files. If two languages were installed at different servicing pack levels – which is unsupported but possible – the value would be set by the last product to be installed or reinstalled (repaired). For more information, see the Visual Studio 2010 detection system requirements. This also includes information to use the CompLocator in your Windows Installer package as an alternative to registry detection.

Author

Heath Stewart
Principal Software Engineer

Heath is an application architect and developer, looking to help educate others to learn professional development. Besides designing and developing applications he enjoys writing about intermediate and advanced topics. Heath also consults for deployment packages and scenarios within Microsoft and for external customers.

0 comments

Discussion are closed.