170 likes | 392 Views
Extending Visual Studio 2003. Building a VS Add-in. Visual Basic Pro User Group May 6, 2004. Who Am I?. Paul Sturgill Psturgill@Commonwealth.com Commonwealth Financial Network Language of choice: VB.NET . Agenda. How can we extend VS 2003? Automation Object Model
E N D
Extending Visual Studio 2003 Building a VS Add-in Visual Basic Pro User Group May 6, 2004
Who Am I? • Paul Sturgill • Psturgill@Commonwealth.com • Commonwealth Financial Network • Language of choice: VB.NET Paul Sturgill - Building a Visual Studio Add-in
Agenda • How can we extend VS 2003? • Automation Object Model • What makes VS 2003 extensible? • Demos • Extensibility future – VS 2005 features • Creating your own extensible application Paul Sturgill - Building a Visual Studio Add-in
Introduction • How can we extend Visual Studio 2003? • What are our options? • VS Add-in is a COM component • DTE is a COM wrapper Paul Sturgill - Building a Visual Studio Add-in
What makes VS extensible? Interfaces!! Paul Sturgill - Building a Visual Studio Add-in
Interfaces • Extensibility.IDTExtensibility2 • OnAddInsUpdate – List of add-ins change • OnBeginShutdown – IDE shuts down • OnStartupComplete – IDE startup complete • OnDisconnection – Add-in unloads from IDE • OnConnection – Add-in is loaded into IDE • IDTCommandTarget • Exec – invokes Add-in behavior (menu item) • QueryStatus – listing available add-ins Paul Sturgill - Building a Visual Studio Add-in
NEVB Demo Add-in • Features: • Code manipulation • IDE Event tracking • Launched Window application • Tool Window Paul Sturgill - Building a Visual Studio Add-in
Start Demos Paul Sturgill - Building a Visual Studio Add-in
Visual Studio 2005 (Whidbey) • Main goal is less COM • No more Regsvr32 • Use XML file to define an Addin • No more shim control for Toolwindow • New CreateToolWindow2 method • Toolbar accepts different types of controls • Combo box, checkbox, etc… not just buttons Paul Sturgill - Building a Visual Studio Add-in
3 Steps to creating Pluggable Software Define Common Interface Implement Interface Create hosting application Paul Sturgill - Building a Visual Studio Add-in
Define Custom Interface Public Interface ICustomAddin Function Start() as Boolean Function Stop() as Boolean End Interface *Equivalent to IDTExtensibility2 Interface Paul Sturgill - Building a Visual Studio Add-in
Implementation of Interface Public Class MyCustomAddin Implements ICustomAddin Public Function Start() as Boolean Implements ICustomAddin.Start ‘ Do something here when the add-in starts End Function Public Function Stop() as Boolean Implements ICustomAddin.Stop ‘ Do something here when the add-in stops End Function End Class *Equivalent to custom VS Add-in Paul Sturgill - Building a Visual Studio Add-in
Hosting Application Dim assem As Reflection.Assembly = Reflection.Assembly.LoadFrom(“c:\plugins\mycustomplugin.dll”) Dim oAddin As Object Dim iAddin As PluginLibrary.iCustomAddin oAddin = assem.CreateInstance(“MyCustomAddin.MyCustomAddin”) iAddin = CType(oAddin, PluginLibrary.ICustomAddin) iAddin.Start() * Equivalent to Visual Studio as a hosting application Paul Sturgill - Building a Visual Studio Add-in
Summary • VS Extensibility • Macros • Add-ins • VSIP – Visual Studio Industry Partner • Visual Studio 2005 enhancements • Add-in contest runs to 5/31/2004 http://weblogs.asp.net/rosherove/ Paul Sturgill - Building a Visual Studio Add-in
Where to Get More Information • Microsoft VSIP Program • http://msdn.microsoft.com/vstudio/extend/ • Writing Add-Ins for Visual Studio .NET • Les Smith (Apress) • Yahoo User Group • http://groups.yahoo.com/group/vsnetaddin/ • Microsoft Sample Downloads • http://www.microsoft.com/downloads/details.aspx?FamilyId=EE1C9710-6DF7-4F3F-A5AE-425A478DDEEB&displaylang=en Paul Sturgill - Building a Visual Studio Add-in
Feedback • Please send feedback to Psturgill@Commonwealth.com Paul Sturgill - Building a Visual Studio Add-in