I was working on creating a GAT Package.  Somewhere in the process unregister recipe failed to work.   What a pain it was to figure out all the places that the GAT package resides.  Fortunately there was a post by Tom Hollander and in the comments there are a series of steps to take to manually unregister the  GAT and any other GAT item.

I have put this into a PowerShell script for future use.  There is still a step that I haven’t automated yet:

  1. Edit the RecipeFramework.xml document to remove any <GuidancePackage> and save the file.  The file is normally located at c:\Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework\RecipeFramework.xml
  2. Run the following script

 

##########################
# Use at your own risk.  This modifies the registry
#
# You will need the following information from the configuration file for the GAT
# under the GuidancePackage node:
#
# Guid – Set the guid variable to the guid attribute
# Name – Set the packageName variable to the Name attribute
#
# One of the things that I did was wild carded the packageName and the guid.  That way no errors will occur when looking for an exact match.
# Some registry keys may not be populated depending on the state of the GAT.
#################################

$guid = “{f0f92643-a3dd-4f51-a4b0-7c76b3f92207}”
$packageName = “Foo.Bar*”

#Placed the following key value in a temporary variable – Was getting a bad numeric constant error (bug in powershell)
$registryKey = “{77d93a80-73fc-40f8-87db-acd3482964b2}”

remove-item HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\$registryKey\Templates\$guid -recurse
remove-item HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\PseudoFolders\$guid -recurse
remove-item HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\$guid -recurse
remove-item HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\$guid -recurse
remove-item HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\$guid -recurse

remove-itemproperty -path HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\CSharp\Paths -Name $packageName
remove-itemproperty HKLM:\SOFTWARE\Microsoft\VisualStudio\8.0\Menus -Name $packageName

 

A couple of notes:

The whole $registryKey value thing kicked my butt.  This is a constant value in the registry and shouldn’t change, but don’t quote me.

Any improvements, let me know.

 

Technorati Tags: , , ,
Advertisements