ccposton

Registration Code

Discussion created by ccposton on Nov 3, 2011
Latest reply on Nov 4, 2011 by Neil
This is a silly question that I hope someone can really answer: I have written an application that uses several (more than 20) custom commands and tools. They all work great but I noticed when I first started building them that they worked whether I included the following registration code or not - so I've left it out.  I have no intention of ever making any of these controls installable.  They exist solely for this program. Do I need this boilerplate or not?  Does anyone know the answer?

    
#region COM Registration Function(s)
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(Type registerType)
{
  // Required for ArcGIS Component Category Registrar support
  ArcGISCategoryRegistration(registerType);
  //
  // TODO: Add any COM registration code here
  //
}

[ComUnregisterFunction()]
[ComVisible(false)]
static void UnregisterFunction(Type registerType)
{
  // Required for ArcGIS Component Category Registrar support
  ArcGISCategoryUnregistration(registerType);
  //
  // TODO: Add any COM unregistration code here
  //
}

/// <summary>
/// Required method for ArcGIS Component Category registration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryRegistration(Type registerType)
{
  string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
  ControlsCommands.Register(regKey);
}

/// <summary>
/// Required method for ArcGIS Component Category unregistration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryUnregistration(Type registerType)
{
  string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
  ControlsCommands.Unregister(regKey);
}
#endregion

Outcomes