Getting Start

  • Add VSAddinLibrary reference
  • Integration UI Setup of VS through a file configuration
    • Add file configuration to the project
    • Add configuration section in the configuration file
<configSections >
    <section name="vSAddinConfigurationSection"
             type="VSAddinLibrary.Config.VSAddinConfigurationSection, VSAddinLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
 
  <vSAddinConfigurationSection xmlns="VSAddinLibrary.Config" versionMajor="1" versionMinor="0">
 
 
  </vSAddinConfigurationSection>
  • Define menu bars in configuration section. For example:
<vSAddinConfigurationSection xmlns="VSAddinLibrary.Config" versionMajor="2" versionMinor="4">
    <commandBarsData>
      <commandBarData name="Tools">
        <commandBarPopupStrip>
          <commandBarEntry name="Doxygen" caption="Doxygen">
            <children>
              <commandBarEntry name="DoxygenConfig" caption="Doxygen Config" commandName="DoxygenConfig"/>
              <commandBarEntry name="NavigateFromHere" caption="Navigate From Here" commandName="NavigateFromHere"/>
              <commandBarEntry name="ShowBrowser" caption="Show Browser" commandName="ShowBrowser"/>
              <commandBarEntry name="Doxygen2" caption="Doxygen 2">
                <children>
                  <commandBarEntry name="DoxygenConfig" caption="Doxygen Config" commandName="DoxygenConfig"/>
                </children>
              </commandBarEntry>
            </children>
          </commandBarEntry>
        </commandBarPopupStrip>
      </commandBarData>
    </commandBarsData>
  </vSAddinConfigurationSection>
  • Modify Connect class.
    • Inherit from BaseConnect
    • Add the attribute UISetupConfiguration
/// <summary>The object for implementing an Add-in.</summary>
/// <seealso class='IDTExtensibility2' />
[UISetupConfiguration(true)]
public class Connect : BaseConnect
VSCommand Diagram.png
  • Design and implementation addin commands with interface IVSCommand and VSCommandManager
    • An addin command is a class that implements the interface IVSCommand
    • In the initialization of the add-in, command object are created and registered by VSCommandManager.AddCommand.
    • The implementation of IDTCommandTarget in inherited class BaseConnect find the registered command, and invokes IVSCommand methods in the add-in command class.
BaseConnect Diagram.png
  • How to create an Addin Commands to load by reflexion
    • Create a class that implements IVSCommand
    • Add the attribute [VSCommandDeclarationAttribute (true)] to the class add-in command
    • Add the attribute [LoadVSCommandReflection (true)] to the class Connect
/// <summary>The object for implementing an Add-in.</summary>
/// <seealso class='IDTExtensibility2' />
[LoadVSCommandReflection(true)]
[UISetupConfiguration(true)]
public class Connect : BaseConnect
  • If the add-command classes inherited from BaseVSCommand, we can load by reflexion the properties of our commands. The following table shows which properties can be defined by class attributes:
Properties Description Attribute
CommandName Allow to identify the command VSCommandDeclarationAttribute
Caption Define the caption of the command VSCommandCaptionAttribute
ToolTip Tool Tip message VSCommandToolTipAttribute
Icon TO DO


VSCommandAttributes Diagram.png





Last edited Sep 17, 2009 at 9:33 PM by jgallardo, version 3

Comments

No comments yet.