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
8
votes
2 answers

How to get enum type in a T4 template

In the process of writing a T4 text template I ran into an issue I'm struggling to get by. I need to know the type of the enum I'm processing. I have enums that are based on byte and ushort. I need the T4 text template to write code to cast the enum…
Robin Theilade
  • 193
  • 1
  • 7
8
votes
2 answers

Platform Toolset property in Visual Studio property sheets

The property is not exposed via project property sheets. It's unfortunate, as I have to run through several projects spread over several solutions to change this value if you are upgrading a compiler (to VS 2013 in my case). I…
ForeverLearning
  • 6,352
  • 3
  • 27
  • 33
8
votes
3 answers

Getting EnvDTE.DTE instance outside Visual Studio IDE

I am creating a project automation tool in Visual Studio 2013 where I have my own project template and I am trying to add it to an existing solution programatically.I am using the following code in a console application. EnvDTE.DTE dte =…
AnandhaSundari M
  • 1,098
  • 2
  • 10
  • 23
8
votes
1 answer

Visual Studio Extension: Wait for all projects to complete loading with IVsSolutionEvents OnAfterOpenSolution

I am looking for an event/interface to use that notifies me once all projects have loaded in a solution after opening a solution. I have implemented OnAfterOpenSolution in IVsSolutionEvents2 interface. This gets called immediately after the solution…
8
votes
1 answer

Programmatically add function to existing C#-file with EnvDTE

I want to programmatically add a function (a TestMethod) to an existing C#-file. After some googling I have found the library EnvDTE and CodeModel.AddFunction-Method, but I can't find a good example of what I want. I would like to add a function…
Mathieu
  • 3,073
  • 1
  • 19
  • 25
8
votes
2 answers

EnvDTE substitute in Visual Studio 2012

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…
Libor
  • 3,285
  • 1
  • 33
  • 41
8
votes
2 answers

In VisualStudio DTE, how to get the contents of the ActiveDocument?

I'm scripting inside VisualStudio and am trying to get the contents of the currently ActiveDocument. This is my current solution: var visualStudio = new API_VisualStudio_2010(); var vsDTE = visualStudio.VsAddIn.VS_Dte; var document =…
Dinis Cruz
  • 4,161
  • 2
  • 31
  • 49
7
votes
1 answer

How to obtain the absolute position of text cursor in Visual Studio 2010 extension

I've developed an IntelliSense-like Dialog, which should appear on a specific key-stroke. (My project is a VS-Package, my dialog will be opened as a command) The problem is, I don't know how to display my dialog at the current cursor-position. There…
7
votes
2 answers

Adding a custom build step with a nuget package

I am developing a nuget package which will set up the current project to use my company's assembly versioning standard. I've got it doing everything I want (so far) smoothly apart from adding in a custom build step. Historically this has been done…
Antony Scott
  • 21,690
  • 12
  • 62
  • 94
7
votes
1 answer

How can I perform "Go To Definition" programmatically in Visual Studio?

Given a string that represents a specific class/field/property (eg MyNameSpace.MyClass or System.String.Length), how can I programmatically cause Visual Studio to go to that class/field/property (ie, make Visual Studio do the same thing that would…
Omer Raviv
  • 11,409
  • 5
  • 43
  • 82
7
votes
1 answer

Using the EnvDTE assembly

Is it possible to use the EnvDTE assembly in a non-extension project (e.g. a Class Library project)? If so, how would I access the ConfigurationManager.ActiveConfiguration property? This question answers exactly what I want, but I couldn't get the…
talles
  • 14,356
  • 8
  • 45
  • 58
7
votes
2 answers

CodeType get generic parameters

We're using the Visual Studio CodeModel and have some problems to get the generic parameters of a CodeType. How to obtain them without parsing the FullName ourselves? It is hinted (although not marked an answer) in How can I get the generic…
D.R.
  • 20,268
  • 21
  • 102
  • 205
7
votes
2 answers

Remove project from solution via Package Manager Console

I am trying to use powershell within the Package Manager Console to script the removal of a project from a solution and I am having a surprisingly hard time. I can easily add a project by PM> $dte.Solution.AddFromFile("C:\Dev\Project1.csproj") Now I…
DeveloperRob
  • 155
  • 1
  • 9
7
votes
1 answer

How to add a reference to another project in my solution through Visual Studio automation

I create a new solution and add some projects to it via the Solution2.AddFromTemplate. Now before I can build my solution successfully, I need to add a project reference from one of the projects to the other. I'm trying to navigate the VS automation…
MvdD
  • 22,082
  • 8
  • 65
  • 93
7
votes
1 answer

Unable to cast DTE, project or solution to VCProject and VCCodeModel

I am trying to get some information about c+= programs, through code. I have had some success with EnvDTE, now I need to use VCProject and VCCodeModel and I am running into casting problems (hope that is all...) In the working class, I have a DTE…
Thalia
  • 13,637
  • 22
  • 96
  • 190