Skip to main content

Calling Built-in, or Add-in functionality from another Visual Studio Add-in or Macro

As a part of the Visual Studio add-in I'm creating for code formatting I'm calling 2 built-in functions.

  • "Edit.RemoveAndSort"
  • "Edit.FormatDocument"

These 2 are functions I use all the time as I code to keep things neat and tidy. I've found it great to automate these within my addin so that I don't have to worry quite so much about accidentally messing up indents and such.

What I got to thinking though, was what if I could automate calls outside of built-in functionality? One of the main purposes of the add-in is to appease StyleCop...not that it's necessary. But, what about after doing a full format, I call stylecop on the individual document? Or if I run over the entire solution, telling stylecop to run over everything? And what about other add-ins that have been mentioned previously such as GhostDoc?

After asking a question about such a thing on the MSDN forums I actually found that it was a lot easier than I expected. An MSDN Moderator, Wesley Yao, pointed me to this post on 'Dr. eX's Blog' about the EnableVSIPLogging registry entry.

Using this and finding the canonical name, I can call any menu item functionality installed into Visual Studio's menu system.

  1.     EnvDTE.Window ideWindow = projectItem.Open(Constants.vsViewKindCode);
  2.     ideWindow.Activate();
  3.     ideWindow.SetFocus();
  4.     ideWindow.DTE.ExecuteCommand("Tools.RunStyleCop", String.Empty);

I'll be toying with this a bit to see about hooking into more functionality in order to make a well-rounded code-formatting solution.

I've still got a ways to go before doing any sort of release on the add-in. I need to look into mocking some of the visual studio interfaces for unit tests and I need to look into separating some of the functionality out into a class library so I can more easily backport it to 2005 and port it to 2010. I also need to research into VSPackage which I believe doesn't require any sort of port. I also need to do a UI for choosing which tasks to enable.

Comments

search Bhulekh UP land

search Bhulekh UP land records online

Calling Built-in

These two functions have greater functionalities in coding. I am trying to know about it in the internet and your post is bestessays good in explaining about their functionalities in clearly manner.

Uber Driver Signin

Uber driver sign-on bonus when you use our most current Uber driver invite code at signup. Uber Driver Signin

Very nice and helpful

Very nice and helpful information has
aussie essays been given in this article.

Email marketing

I have very much interested in knowing new things in coding. I have always followed many websites for learning new topics. Your posted information is really useful for me to know more about functions.

because I could not stop for death

These two functions have the

These two functions have the great functionality. I have used this in coding and execute the program. This post really help me to get an idea about these to function's usage.

moonlight sonata

24option is a popular

24option is a popular brokerage firm in the Binary Options Market that has been operating for four years now and has several users around. Many users question whether 24option is legit or just another fake system. 24option reviews

The MSBSHSE will officially

The MSBSHSE will officially declare the Maharashtra SSC Result 2017 on the web portal. entrance test results

The information in the 70-461

The information in the 70-461 braindumps exam dumps is updated and in line with the latest syllabus. You never find Examsleader’s IT braindumps deficient of anything.

While working with codes, it

While working with codes, it is really a tough task. I remembered my college days when I used to take help from assignment master for help in my coding subjects.

Thanks

Thanks for sharing, post with us. central machinery drill press manual

Learn professional digital

Learn professional digital marketing course/training in Hyderabad and upgrade your career by taking SEO/SMM/SEM/Adwords certification training Seo training Hyderabad 

These two capacities have the

These two capacities have the considerable usefulness. I have utilized this in coding and execute the program. This post truly help me to get a thought regarding these to capacity's utilization. While working with codes, it is truly an intense undertaking. I recalled my school days when I used to take assistance from CourseworkGeek for help in my coding subjects.

tariq

Hey – great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?

Hey – great blog, just

Hey – great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?

tariq

I feel a lot more people need to read this, very good info! . . . . . .

these two capacities have the

these two capacities have the significant usefulness. i have applied this in coding and execute the program. This submit truly help me to get a thought concerning these to potential's utilization. while running with codes, it's miles honestly an intense venture. I recalled my college days once I used to take assistance from write my essay for assist in my coding topics.

I would like to thank you for

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

diherbal

Magnificent items from you, man. I have bear in mind your stuff previous to and you are simply too great. obat herbal kanker otak

I actually like what you have acquired right here, certainly like what you are stating and the way through which you say it. obat alami kanker hati

You make it entertaining and you still take care of to stay it sensible. obat herbal sinusitis

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <asp>, <c>, <cpp>, <cs>, <css>, <drupal5>, <drupal6>, <html4strict>, <java>, <javascript>, <jquery>, <php>, <python>, <ruby>, <sql>, <xml>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.