vs-extensibility

Detect the Visual Studio version inside a VSPackage

笑着哭i 提交于 2019-11-30 13:53:21
问题 How can I check/detect which Visual Studio version is running under my VSPackage? I cannot get from the registry because the computer could have several versions installed, so I guess there is an API that is able to get it. Anybody knows how to get it from a managed Visual Studio package using C#? 回答1: You could try to get version via automation DTE object . In MPF you could get it in this way: EnvDTE.DTE dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE)); There are some other

Visual Studio Extend IDE - the Exception Assistant

人走茶凉 提交于 2019-11-30 12:44:06
The aim here is to incorporate StackOverflow popular answers into Visual Studio's Exception Assistant. I have trawled the web without luck, the only information I could find about customizing the Exception Assistant is this link below that shows how to add links to the "Troubleshooting Tip" area: http://abhijitjana.net/2011/01/07/exception-occurred-get-troubleshooting-tips-from-your-favorites-blogs/ My question is it possible to tap into other areas of the Exception Assistant such as: Actions, View Details? I also found that adding links to Troubleshooting Tip area is limited: http://social

Detect the Visual Studio version inside a VSPackage

感情迁移 提交于 2019-11-30 08:52:51
How can I check/detect which Visual Studio version is running under my VSPackage? I cannot get from the registry because the computer could have several versions installed, so I guess there is an API that is able to get it. Anybody knows how to get it from a managed Visual Studio package using C#? You could try to get version via automation DTE object . In MPF you could get it in this way: EnvDTE.DTE dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE)); There are some other related things to retrieve DTE object - via Project.DTE , also read this thread if you're getting null for DTE.

Programmatically getting the current Visual Studio IDE solution directory from addins

不羁的心 提交于 2019-11-30 06:10:01
I have some tools that perform updates on .NET solutions, but they need to know the directory where the solution is located. I added these tools as External Tools, where they appear in the IDE Tools menu, and supplying $(SolutionDir) as an argument. This works fine. However, I want these tools to be easier to access in the IDE for the user through a custom top level menu (for which I created a Visual Studio integration package project) and through a context menu on solution nodes (for which I created a Visual Studio add-in project). I'm looking for a way to get the current solution directory

Accessing attribute info from DTE

廉价感情. 提交于 2019-11-30 05:48:07
I have coded something like the following: [Attrib(typeof(MyCustomType))] public class TargetType { // ..... } I want to use EnvDTE to get a reference to the CodeElement referenced by the typeof . I know how to get a reference to the attribute argument, and I can use Value , but that gives me the string typeof(MyCustomType) . If I use Value , I have to break down the string and then try to find the type, which gets hairy if there are two types with the same name but different namespaces. Is there an easier way to do this? Is there an easier way to do this? No, I don't think so, atleast for a <

DTE2 events don't fire

冷暖自知 提交于 2019-11-30 02:44:34
问题 While trying to develop my first VS Addin, I am having issues in firing DTE2 events. Basically, the DocumentOpened and LineChanged events don't fire for some reason. What important part did I miss? namespace TestAddin { public class Connect : IDTExtensibility2 { private AddIn _addInInstance; private DTE2 _applicationObject; public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2) application; _addInInstance =

How to get the details of the selected item in solution explorer using vs package

怎甘沉沦 提交于 2019-11-29 21:00:39
问题 I am trying to create a VS package in which, I have added a menu command to the context menu, so it appears when you right click an item in the solution explorer. Now on clicking the command, I want to show a pop up with the details of the item, on which you right clicked and invoked the command. Now how would I get information about the selected item? Is there any service I can use in order to get any details about the item? 回答1: private static EnvDTE80.DTE2 GetDTE2() { return

Visual Studio Extend IDE - the Exception Assistant

≯℡__Kan透↙ 提交于 2019-11-29 18:20:37
问题 The aim here is to incorporate StackOverflow popular answers into Visual Studio's Exception Assistant. I have trawled the web without luck, the only information I could find about customizing the Exception Assistant is this link below that shows how to add links to the "Troubleshooting Tip" area: http://abhijitjana.net/2011/01/07/exception-occurred-get-troubleshooting-tips-from-your-favorites-blogs/ My question is it possible to tap into other areas of the Exception Assistant such as: Actions

Programmatically getting the current Visual Studio IDE solution directory from addins

末鹿安然 提交于 2019-11-29 05:50:12
问题 I have some tools that perform updates on .NET solutions, but they need to know the directory where the solution is located. I added these tools as External Tools, where they appear in the IDE Tools menu, and supplying $(SolutionDir) as an argument. This works fine. However, I want these tools to be easier to access in the IDE for the user through a custom top level menu (for which I created a Visual Studio integration package project) and through a context menu on solution nodes (for which I

Accessing attribute info from DTE

自古美人都是妖i 提交于 2019-11-29 05:07:22
问题 I have coded something like the following: [Attrib(typeof(MyCustomType))] public class TargetType { // ..... } I want to use EnvDTE to get a reference to the CodeElement referenced by the typeof . I know how to get a reference to the attribute argument, and I can use Value , but that gives me the string typeof(MyCustomType) . If I use Value , I have to break down the string and then try to find the type, which gets hairy if there are two types with the same name but different namespaces. Is