问题
I've created some macros in VS 2010, I now want to migrate them so they are VSIXs and publish them in the gallery.
They are built on top of the DTE object instance provided in the VS macro editor.
How to implement this?
What is the replacement for the DTE object?
Update
I also want to configure the extension so that when it's installed on the users machine, it should also install a keyboard shortcut that when pressed, it should run that method in the extension.
Note that currently I'm using a blank extension project, where there are no files except the code file that contains the method to be fired, and the .vsixmanifest file.
I've posted a separated question of the above: How to make a shortcut to run a VSIX method?
回答1:
You can still reference DTE as a part of a VSIX extension. Just add a reference to the EnvDTE assembly. There's instructions here on how to get the object. If you have an IServiceProvider
, you can also GetService(typeof(SDTE))
to get it.
来源:https://stackoverflow.com/questions/10367439/easy-vsix-get-started