Поделиться через


Get started programming VSTO Add-ins

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Important

VSTO relies on the .NET Framework. COM add-ins can also be written with the .NET Framework. Office Add-ins cannot be created with .NET Core and .NET 5+, the latest versions of .NET. This is because .NET Core/.NET 5+ cannot work together with .NET Framework in the same process and may lead to add-in load failures. You can continue to use .NET Framework to write VSTO and COM add-ins for Office. Microsoft will not be updating VSTO or the COM add-in platform to use .NET Core or .NET 5+. You can take advantage of .NET Core and .NET 5+, including ASP.NET Core, to create the server side of Office Web Add-ins.

You can use VSTO Add-ins to automate Microsoft Office applications, extend features of the application, and customize the user interface (UI) of the application. For information about how VSTO Add-ins compare to other types of Office solutions you can create by using Visual Studio, see Office solutions development overview (VSTO).

Applies to: The information in this topic applies to VSTO Add-in projects. For more information, see Features available by Office application and project type.

Create VSTO Add-in projects

Create VSTO Add-in projects by using one of the VSTO Add-in project templates in the New Project dialog box. These templates include required assembly references and project files. Visual Studio provides VSTO Add-in project templates for most applications in Office.

For more information about how to create a VSTO Add-in project, see How to: Create Office projects in Visual Studio. For more information about the project templates, see Office project templates overview.

Develop VSTO Add-in projects

When you create a VSTO Add-in project, Visual Studio automatically creates a ThisAddIn.vb (in Visual Basic) or ThisAddIn.cs (in C#) code file. This file contains the ThisAddIn class, which provides the foundation for your VSTO Add-in. You can use members of this class to run code when the VSTO Add-in is loaded or unloaded, to access the object model of the host application, and to extend features of the application. For more information, see Program VSTO Add-Ins.

Automate applications by using the Object models

The object models of Microsoft Office applications expose many types that you can program against in a VSTO Add-in. You can use these types to automate the application. For example, you can programmatically create and send an e-mail message in Outlook, or you can open a document and add content in Word. For more information about how to access the object model of the host application in code, see Program VSTO Add-Ins.

For more information about the object models of specific Microsoft Office applications, see the following topics:

Customize the user interface of applications

There are several different ways to customize the UI of the host application by using a VSTO Add-in:

Next steps

To learn how to create VSTO Add-ins, see the following walkthroughs:

See also