envdte

Add an Item to the visual studio folder right-click menu within AddIn

若如初见. 提交于 2019-11-27 02:57:41
问题 I want to add a menuitem to the right-click=>Add menu in visual studio 2012 solution explorer. When click the custom item I can add a project with my template. I developed a Visual Studio Add-In to do it but I get into some trouble. I am able to add a menuitem to the right-click menu but I can't get it to meet my requirement. The menuitem should be the submenu of "Add". Not a root item. I also need the menuitem to show only when I right-click on a folder named "Areas". I don't want it to show

Get the reference of the DTE2 object in Visual C# 2010

醉酒当歌 提交于 2019-11-27 01:40:49
问题 I want to get a reference to the current solution, using the DTE2 object with C# in Visual Studio 2010. I first tried the following code: var dte = Marshal.GetActiveObject("VisualStudio.DTE.10.0") as EnvDTE80.DTE2; But when I open 2 solutions, and this code is in the first solution, I get NOT a reference to the current solution, but a reference to the last solution I loaded. I need the current solution... Searching on the internet, I found the following solution in How do you get the current

Get types used inside a C# method body

大城市里の小女人 提交于 2019-11-26 16:54:24
问题 Is there a way to get all types used inside C# method? For example, public int foo(string str) { Bar bar = new Bar(); string x = "test"; TEST t = bar.GetTEST(); } would return: Bar, string and TEST. All I can get now is the method body text using EnvDTE.CodeFunction. Maybe there is a better way to achieve it than trying to parse this code. 回答1: I'm going to take this opportunity to post up a proof of concept I did because somebody told me it couldn't be done - with a bit of tweaking here and

Adding solution-level items in a NuGet package

一曲冷凌霜 提交于 2019-11-26 15:36:06
问题 I want to add solution folders and solution items (not projects) to a solution file via a NuGet package. I imagine this would be accomplished through Powershell. I've looked through the documentation for NuGet, Powershell, and EnvDTE and can't figure out: Which commands/methods I would use? Which standard script I would do this in, Init.ps1, Install.ps1, or somewhere else? 回答1: Here is a PowerShell script that will create a solution folder called Parent and another solution folder called