envdte

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 <

EnvDTE substitute in Visual Studio 2012

允我心安 提交于 2019-11-30 05:29:48
Until now, I have been successfully using EnvDTE to manage Visual Studio Toolbox. There are customized DLLs to deal with different Visual Studio versions: EnvDTE.dll - common VS automation (probably works on all versions) EnvDTE80.dll - to deal with VS 2005 EnvDTE90.dll - to deal with VS 2008 EnvDTE100.dll - to deal with VS 2010 However, there is no EnvDTE110 for VS 2012. Does that mean these is different way of VS automation than using these COM wrapper libraries? If so, how to for example work with VS 2012 projects and Toolbox remotely other way than using EnvDTE ? I think you are

How to put breakpoint in every function of .cpp file?

偶尔善良 提交于 2019-11-29 09:19:04
Is there a macro that does it? Which DTE objects to use? (This is not quite what you're asking for, but almost:) You can put a breakpoint on every member function of a class in Visual Studio by bringing up the New Breakpoint dialog and entering: CMyClass::* See http://blogs.msdn.com/b/habibh/archive/2009/09/10/class-breakpoint-how-to-set-a-breakpoint-on-a-c-class-in-the-visual-studio-debugger.aspx for more details. Here's a quick implementation of 1800 INFORMATION's idea: Sub TemporaryMacro() DTE.ActiveDocument.Selection.StartOfDocument() Dim returnValue As vsIncrementalSearchResult While True

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

How to get notification when a successful build has finished?

风流意气都作罢 提交于 2019-11-29 03:57:31
I'm writing an VS add-in and I need to run a certain method after a successful build. I've tried using dte.Events.BuildEvents.OnBuildDone but that event happens even if the build failed. Is there a property or some other event I should use? The OnBuildDone event cannot tell you what happened. Some projects in the solution might have built properly, some didn't. You'll need OnBuildProjConfigDone instead. Fires for each project, the Success argument tells you if it worked. Typically, you need to handle multiple projects being built. This could be a solution build, or building a project that is

Add code analysis ruleset through nuget package

孤者浪人 提交于 2019-11-28 23:41:55
I'm trying to build a NuGet package that adds our company's code analysis dictionary automatically and updatable. The rule set is added in the content folder and now I want to use the install.ps1 script to add the rule set in the project file. I figured out the way to go would be to use the envDTE, but I can't find much useful documentation about it other then this overwhelming object graph in which I can't find the CodeAnalysisRuleset node. http://msdn.microsoft.com/en-us/library/za2b25t3(v=vs.100).aspx Am I pursuing the right path? Is there any relevant tutorial/documentation on how to use

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

自闭症网瘾萝莉.ら 提交于 2019-11-28 07:01:50
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 solution directory from a VSPackage? : // Get an instance of the currently running Visual Studio IDE

Get types used inside a C# method body

馋奶兔 提交于 2019-11-27 14:41:54
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. 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 there, it'd be relatively trivial to extend this to extract out all referenced Types in a method - apologies

Adding solution-level items in a NuGet package

匆匆过客 提交于 2019-11-27 11:28:29
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? Matt Ward Here is a PowerShell script that will create a solution folder called Parent and another solution folder called Child inside that one. It also adds a project file (MyProject.csproj) inside the Child solution folder