envdte

How can an Empty Visual C++ project be created programmatically?

南笙酒味 提交于 2019-12-10 10:59:19
问题 I wanted to know how to use the template for an Empty Visual C++ project to programmatically create a new solution with this empty project. The code (C#) I have right now is: string VSProgID = "VisualStudio.Solution.10.0"; Type solnObjType = System.Type.GetTypeFromProgID(VSProgID, true); Solution4 soln = (Solution4) System.Activator.CreateInstance(solnObjType, true); soln.Create(@"C:\NewSoln", "New"); soln.SaveAs(@"C:\NewSoln\New.sln"); string emptyVCProjPath = soln.GetProjectTemplate(

Visual Studio Extension: Access VS Options from arbitrary DLL

喜夏-厌秋 提交于 2019-12-10 10:46:19
问题 I'm currently developing my first VS extension, which needs to provide some options to the user. Following https://msdn.microsoft.com/en-us/library/bb166195.aspx, it was rather easy to come up with my own options page. However, I have not yet found out how to read my options. The solution structure of my extension is as follows: MySolution MyProject (generates a DLL from C# code) MyProjectVSIX Following the tutorial cited above, I have added a VS Package to my VSIX project and configured it

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

我与影子孤独终老i 提交于 2019-12-08 18:56:44
问题 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 = (Document)vsDTE.ActiveDocument; var textDocument = (TextDocument)document.Object("TextDocument"); var editPoint = textDocument.StartPoint.CreateEditPoint(); var text = editPoint.GetText(textDocument.EndPoint.CreateEditPoint()); panel.clear().add_SourceCodeViewer(

Get ProjectItem path without using item.Document.FullName

 ̄綄美尐妖づ 提交于 2019-12-08 16:01:13
问题 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 other way to access this information in the DTE object? 回答1: Is this what you're looking for? myProjectItem.Properties.Item("FullPath").Value 回答2: Even I was looking for a solution to get the project name based on the document or file Name. I found

Can one cast an EnvDTE.Project into a VCProject

…衆ロ難τιáo~ 提交于 2019-12-08 06:28:18
I have seen two posts so far that concern my question. I am wondering how can one cast an EnvDTE.Project into a VCProject. In this post , fun4jimmy 's answer does that exactly in the following line of code (taken from his answer) : VCProject vcProject = project.Object as VCProject; I have tried doing the same thing in my solution : using EnvDTE; using Microsoft.VisualStudio.VCProjectEngine; [...] private List<string> BuildAssembliesAndReturnTheirName(EnvDTE80.DTE2 dte) { Solution sln = dte.Solution; bool isDirty = false; foreach (Project project in sln.Projects) { VCProject vcProject = project

Can one cast an EnvDTE.Project into a VCProject

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 05:04:37
问题 I have seen two posts so far that concern my question. I am wondering how can one cast an EnvDTE.Project into a VCProject. In this post, fun4jimmy 's answer does that exactly in the following line of code (taken from his answer) : VCProject vcProject = project.Object as VCProject; I have tried doing the same thing in my solution : using EnvDTE; using Microsoft.VisualStudio.VCProjectEngine; [...] private List<string> BuildAssembliesAndReturnTheirName(EnvDTE80.DTE2 dte) { Solution sln = dte

Creating a tree of Solution Folders using DTE and Package Manager Console

自闭症网瘾萝莉.ら 提交于 2019-12-08 04:35:47
问题 I would like to create a tree of solution folders using Visual Studio Package Manager Console and powershell, like this: Solution +--- F1 +--- F2 +--- F3 I can create the first folder using this command: PM> $dte.Solution.AddSolutionFolder('F1') And I can create the second folder using these commands: PM> $f1 = $dte.Solution.ProjectItems.Item(2) PM> $f1interface = get-interface $f1.Object ([EnvDTE80.SolutionFolder]) PM> $f1interface.AddSolutionFolder('F2') And I can get a reference to F2 (I

How can I reload a visual studio project thru a nuget powershell script

断了今生、忘了曾经 提交于 2019-12-07 22:50:32
问题 In Solution Explorer 'DependentUpon' project items are normally disabled as children of the other item (ex. web.config / web.Debug.config). The problem I have is when items are dynamically added via nuget/powershell at package install, Solution Explorer doesn't reload the project so the items don't show as dependent. Manually closing and reopening the solution or unload/reload the project fix the issue. I'd like to automate the Project Reload as part of the install.ps1 powershell script but

Create a solution and add a project using “VisualStudio.DTE.10.0”

寵の児 提交于 2019-12-07 18:41:05
问题 I'm trying to create a VS2010 solution and add a project from a stand-alone app (not an add-in). I can create an instance of VS2010, but I'm not able to determine how to create a project properly...I can only find an example of how to create a project using the EnvDTE80 object, which later causes an exception because the project file is in an earlier format and needs to be upgraded. I have this: EnvDTE80.DTE2 dte2; object obj; System.Type t; t = System.Type.GetTypeFromProgID("VisualStudio.DTE

Open DTE solution from another program (not add-in)

时光毁灭记忆、已成空白 提交于 2019-12-07 15:55:40
问题 Is it possible to modify a solution, and use envdte tools, from a command-line project ? I have an add-in that modifies a solution. But... the changes are required for over a hundred projects... So I'd like to make a c# program that has the same logic, only it iterates through all solution files. The add-in starts with EnvDTE.Solution solution = (EnvDTE.Solution)application.Solution; where DTE2 application is passed from the add-in... How can I get the same solution, which then I query for