{"id":2293,"date":"2006-04-07T20:19:00","date_gmt":"2006-04-07T20:19:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2006\/04\/07\/detecting-patches-in-net-2-0-and-visual-studio-2005\/"},"modified":"2006-04-07T20:19:00","modified_gmt":"2006-04-07T20:19:00","slug":"detecting-patches-in-net-2-0-and-visual-studio-2005","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/detecting-patches-in-net-2-0-and-visual-studio-2005\/","title":{"rendered":"Detecting Patches in .NET 2.0 and Visual Studio 2005"},"content":{"rendered":"<p>Aaron Stebner\n<a href=\"http:\/\/blogs.msdn.com\/astebner\/archive\/2004\/09\/18\/231253.aspx\">posted\nsome sample code<\/a> to detect whether the .NET Framework 1.0, 1.1, or 2.0 were\ninstalled and at what service pack level they are. Basically, the .NET Framework\ninstallation writes a common, version-specific registry key in the following\nlocation along with an SP level registry value. The sample below for an English\n(United States) installation of .NET 2.0 is shown using the registry file\nformat.<\/p>\n<p><font face=\"monospace\">[HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv2.0.50727]<br \/>\n&#8220;Install&#8221;=dword:00000001<br \/>\n&#8220;MSI&#8221;=dword:00000001<br \/>\n&#8220;SP&#8221;=dword:00000000<\/p>\n<p>[HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv2.0.507271033]<br \/>\n&#8220;Install&#8221;=dword:00000001<br \/>\n&#8220;MSI&#8221;=dword:00000001<br \/>\n&#8220;SP&#8221;=dword:00000000<\/font><\/p>\n<p>To detect if service pack 1 is installed, check that\nthe &#8220;SP&#8221; value is 1.<\/p>\n<p>If you need to detect a specific hotfix patch you should\nnote the KB article number and follow the specific steps to determine if the\nhotfix\nis installed. Also note which SP level (including RTM) the hotfix targets.<\/p>\n<ol>\n<li>Check the service pack level as described above.\n<ul>\n<li>If the SP value in the registry is greater then the target SP level\n\t\tof the hotfix, the changes made by the hotfix are installed. Please note that\n\t\tthere are rare exceptions to this rule. You are finished detecting for a\n\t\tspecific patch.<\/li>\n<li>If the SP value in the registry is equal to the target SP level of\n\t\tthe hotfix, proceed with the following steps.<\/li>\n<\/ul>\n<\/li>\n<li>Check for the KB article number under <font face=\"monospace\">HKEY_LOCAL_MACHINESoftwareMicrosoftUpdates[ProductName]<\/font>,\n\twhere <font face=\"monospace\">[ProductName]<\/font> is the value of the ProductName property in the Property\n\ttable of the application set <i>.msi<\/i> file. Below is another sample\n\tregistry format file for a patch targeting the release of .NET Framework\n\t2.0. You would want to check that the value &#8220;Installed&#8221; in bold exists. The\n\texample is for a fictitious KB123446.<\/li>\n<\/ol>\n<p><font face=\"monospace\">[HKEY_LOCAL_MACHINESOFTWAREMicrosoftUpdatesMicrosoft .NET Framework 2.0KB123456]<br \/>\n<b>&#8220;Installed&#8221;=dword:00000001<br \/>\n<\/b>&#8220;UninstallCommand&#8221;=&#8221;C:\\WINDOWS\\system32\\msiexec.exe \/promptrestart \/uninstall {633ECF8F-DAD3-4E23-AAD6-52D6386C9099} \/package {7131646D-CD3C-40F4-97B9-CD9E4E6262EF}&#8221;<br \/>\n&#8220;ARPLink&#8221;=&#8221;HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\KB123456.T1_1ToU60_1&#8221;<br \/>\n&#8220;InstallerVersion&#8221;=&#8221;3.01&#8221;<br \/>\n&#8220;PublishingGroup&#8221;=&#8221;Developer Division Customer Product-lifecycle Experience&#8221;<br \/>\n&#8220;Publisher&#8221;=&#8221;Microsoft Corporation&#8221;<br \/>\n&#8220;PackageVersion&#8221;=&#8221;1&#8221;<br \/>\n&#8220;PackageName&#8221;=&#8221;Hotfix for Microsoft .NET Framework 2.0 (KB123456)&#8221;<br \/>\n&#8220;ReleaseType&#8221;=&#8221;Hotfix&#8221;<br \/>\n&#8220;Type&#8221;=&#8221;Update&#8221;<br \/>\n&#8220;InstalledDate&#8221;=&#8221;4\/7\/2006&#8221;<br \/>\n&#8220;Description&#8221;=&#8221;This Hotfix is for Microsoft .NET Framework 2.0. \\n<br \/>\nIf you later install a more recent service pack, this Hotfix will be uninstalled automatically. \\n<br \/>\nFor more information, visit http:\/\/support.microsoft.com\/kb\/123456&#8243;<br \/>\n&#8220;AppliedToSP&#8221;=&#8221;R1&#8221;<br \/>\n&#8220;InstalledBy&#8221;=&#8221;Heath Stewart&#8221;<\/font><\/p>\n<p>When a new hotfix patch supersedes. or replaces, an older installed hotfix patch, the registry\ndetection keys described above will not be deleted. The superseding patch does\nnot write the detection keys of superseded patches, however. This is a change\nfrom .NET Framework 1.0 and 1.1 but we are working to make patch detection\ncommon throughout products from Microsoft and are pushing toward patch detection as\nprovided by Windows Installer for Windows Installer-installed patches.<\/p>\n<p>If you rely on a fix within a certain file, you can also check the file\nversion and compare the component parts of the dotted-quad version format. For\nWindows Installer packages, you can use the\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/drlocator_table.asp\">\nDrLocator table<\/a>, along with the\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/signature_table.asp\">\nSignature table<\/a> and the\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/appsearch_table.asp\">\nAppSearch table<\/a> to set a property if a file version is within a given range\nof version numbers. If you rely on the\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/launchcondition_table.asp\">\nLaunchCondition table<\/a> to check for the existence of the property to be set\nif the file exist within the given version range, make sure to schedule the\nstandard\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/appsearch_action.asp\">\nAppSearch action<\/a> before the standard\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/launchconditions_action.asp\">\nLaunchConditions action<\/a>.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Aaron Stebner posted some sample code to detect whether the .NET Framework 1.0, 1.1, or 2.0 were installed and at what service pack level they are. Basically, the .NET Framework installation writes a common, version-specific registry key in the following location along with an SP level registry value. The sample below for an English (United [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[13,14,20,45],"class_list":["post-2293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-detection","tag-development","tag-installation","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>Aaron Stebner posted some sample code to detect whether the .NET Framework 1.0, 1.1, or 2.0 were installed and at what service pack level they are. Basically, the .NET Framework installation writes a common, version-specific registry key in the following location along with an SP level registry value. The sample below for an English (United [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=2293"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2293\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=2293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=2293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=2293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}