Automate the renaming of classes in Visual Studio 2013 using the SDK and VS API

139 views Asked by At

How do I rename classes with an API call, from within a Visual Studio 2013 plugin we are building?

We are already adding files and generating code to a project from within the plugin, but how to can we open the rename refactoring dialogue?

The plugin is an entity editor for a custom ORM system. Here is a screenshot

1

There are 1 answers

0
Carlos Quintero On

You can execute any command such as "Refactor.Rename", etc. using either DTE.ExecuteCommand("mycommand") or by command guid and id:

HOWTO: Execute a command by Guid and Id from a Visual Studio package. http://www.visualstudioextensibility.com/articles/packages/

To learn the command names go to "Tools" > "Customize..." and then "Keyboard" button.