Questions tagged [envdte]

EnvDTE is an assembly-wrapped COM library containing the objects and members for Visual Studio core automation.

The MSDN Documentation for EnvDTE says

EnvDTE is an assembly-wrapped COM library containing the objects and members for Visual Studio core automation.

572 questions
12
votes
3 answers

How to find a ProjectItem by the file name

I'm developing a custom tool for the Visual Studio. The tool is assigned to the file, at the time when the file changed I receive name of this file and should generate some changes in the project. I need to find a ProjectItem by the received file…
Viacheslav Smityukh
  • 5,652
  • 4
  • 24
  • 42
12
votes
2 answers

Add-In events are never executed

I used the "Add-In for Visual Studio" wizard to create a new Addin project and now, I'm trying to add some event handlers: public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { …
main--
  • 3,873
  • 1
  • 16
  • 37
11
votes
1 answer

How can I get an ITextBuffer out of an EnvDTE.Window?

I have a managed syntax highlighter using the new VS extensibility API's and it gives me an ITextBuffer, which is great. In another part of my extension I am getting a DTE object and attaching to the active window changed event, which gives me an…
justin.m.chase
  • 13,061
  • 8
  • 52
  • 100
11
votes
3 answers

T4MVC "run custom tool" generates EnvDTO 7.0 vs 8.0 csc warning

I'm getting the following warning when I right click on T4MVC.tt and select "run custom tool" (i.e. rebuild by T4MVC.cs file). Warning 1 Compiling transformation: Assuming assembly reference 'EnvDTE, Version=7.0.3300.0, Culture=neutral,…
Tod Thomson
  • 4,773
  • 2
  • 33
  • 33
11
votes
5 answers

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

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…
Dennis
  • 1,810
  • 3
  • 22
  • 42
11
votes
3 answers

How to get notification when a successful build has finished?

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?
Dror Helper
  • 30,292
  • 15
  • 80
  • 129
11
votes
1 answer

Finding a ProjectItem by type name via DTE

Given a type name, is it possible to use DTE to find the ProjectItem that the type is located in? Something similar to how the Navigate To... dialog works in Visual Studio 2010. The closest I could find is Solution.FindProjectItem, but that takes in…
Igal Tabachnik
  • 31,174
  • 15
  • 92
  • 157
11
votes
4 answers

Event on Visual Studio project creation

I want to add functionality when the user creates project \ solution in Visual Studio 2010\2012. i.e. I need to perform C# code when a new project is created. I googled a lot but didn't find any event which is fired on\after project creation. Is…
11
votes
1 answer

Add project's reference to another project in same solution dynamically

I have a solution and three projects inside that which is all created dynamically. Now I have to add the first project's reference to the second and third one. When i tried the logic i'm able to build the project individually and when building the…
A Coder
  • 3,039
  • 7
  • 58
  • 129
11
votes
1 answer

Get all methods that are decorated with a specific attribute using T4/EnvDTE

I'd like to get a list of all public methods in my project that are decorated using MyAttribute using T4/EnvDTE. I know this can be done with reflection, but I don't want to load the assembly and reflect over it in a T4 template, rather, I want to…
Omar
  • 39,496
  • 45
  • 145
  • 213
11
votes
4 answers

Get full list of available commands for DTE.ExecuteCommand

I use VS2010 and Addin, using DTE.ExecuteCommand and commands like Build, Build.Cancel, Build.RebuildSolution, etc. You can get a command with DTE.Commands.Item("xxx") and guess if it is available with Command.IsAvailable. The list of commands is in…
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
11
votes
5 answers

Getting the current EnvDTE or IServiceProvider when NOT coding an Addin

I am coding up some design time code. I want to use this snippet: (Found here) var dte = (EnvDTE.DTE) GetService(typeof(EnvDTE.DTE)); if (dte != null) { var solution = dte.Solution; if (solution != null) { string baseDir =…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
11
votes
3 answers

How can I get nuget (powershell) to insert elements in the target csproj file

I'm writing a nuget package for a windows service, the idea is that my colleagues can create a windows service install the package and all of the default logging settings, entlib libraries and other house keep tasks will be set up for them. I've…
CianM
  • 397
  • 5
  • 17
10
votes
4 answers

Get ProjectItem path without using item.Document.FullName

I have a visual studio add-in project where I must iterate through the current project's items, utilizing the absolute (or relative) path to those files. The item.Document.FullName works, but only for files that are currently opened. Is there any…
Jason
  • 211
  • 5
  • 10
10
votes
1 answer

C # EnvDTE Moving projects from the Solution to SolutionFolder

It is necessary to move the project from the Solution to SolutionFolder. I am trying to remove the project from the solution and add it back into the folder using EnvDTE SolutionFolder.AddFromFile(Filepath line); because not found in the…
V. Dmitriy
  • 205
  • 1
  • 10
1
2
3
38 39