共用方式為


How to: Run Add-Ins on the Command Line

Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions. For more information about upgrading, see FAQ: Converting Add-ins to VSPackage Extensions.

As an alternative to using the Add-In Manager to start add-ins, you can configure an add-in to load by using the Devenv command line. This can be useful, for example, if you want to perform an operation outside of the Visual Studio integrated development environment (IDE) and still initiate an add-in, such as for unattended builds or Windows system tools.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and ExportSettings on the Tools menu. For more information, see Customizing Development Settings in Visual Studio.

To run an add-in on the command line

  1. After creating or loading the add-in, open the Add-in Manager.

  2. Check the box in the Command Line column for the add-in.

    Checking this box notifies Visual Studio that the add-in can be invoked via the command line as well as through the Add-in Manager.

  3. Exit Visual Studio.

  4. In a Command Prompt window, start Visual Studio by invoking devenv.exe with the /Command (devenv.exe) switch, followed by the full command name of the add-in. For example:

    devenv /command MyAddin.Connect.MyAddin

Note

By default, the command name of the add-in is equal to <AddInSolutionName>.Connect.<AddInSolutionName>, and appears in Connect.cs as the commandName parameter of the Exec method. You can also verify the command name by starting to type the name of the add-in into the Commands window in Visual Studio, and using Intellisense to fill in the rest.

See Also

Reference

Devenv Command Line Switches