The AddIn class is the host item for application-level add-ins that you create by using Visual Studio Tools for Office. When you create an add-in project, Visual Studio Tools for Office automatically creates a class named ThisAddIn, which derives from AddIn. The ThisAddIn class provides a starting location in which you can write your code. You can access the object model of the host application by using the Application field of the ThisAddIn class. For more information about the ThisAddIn class, see Programming Application-Level Add-Ins and AddIn Host Item.
To run code when the add-in is loaded or unloaded, add code to the ThisAddIn_Startup and ThisAddIn_Shutdown methods in the ThisAddIn class. These methods are default event handlers for the Startup and Shutdown events. For more information, see Visual Studio Tools for Office Project Events.