envdte

How to use DTE in PowerShell?

Deadly 提交于 2019-12-21 08:27:07
问题 I am trying to use PowerShell to automate the process of creating an n-tier solution based on a seed (think EDMX file or DbContext) configuration. I want to be able to open a skeleton solution, get the active instance, and populate project files with auto-generated code. I'm trying to transcode the example provided here to powershell, however, I am getting errors. Here is the PowerShell code I am testing: First, I execute a little function to reference the DTE assemblies. $libs = "envdte.dll"

Capture VS local variables while debugging in EnvDTE

北城以北 提交于 2019-12-21 06:06:42
问题 Is it possible to capture the debug data that's used by the locals and debug window, using EnvDTE for a .vsix visual studio extension? Or is it possible through another method? I would like to create a custom Locals window that we can modify to display some of our more heavy content as we like, without sacrificing the original Locals window for power users. The ideal solution would be to grab the data being sent to the locals window so I could build my own tree. 回答1: Turns out this is

Add-In events are never executed

家住魔仙堡 提交于 2019-12-20 09:58:22
问题 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) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _applicationObject.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; _applicationObject.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone; _applicationObject.Events

DTE.ExecuteCommand and wait

泄露秘密 提交于 2019-12-19 16:49:13
问题 I would like use macros for publishing my webapplication project. The little problem is, DTE.ExecuteCommand run asynchronously, and I need to wait until the command is done. Example: DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate() DTE.ActiveWindow.Object.GetItem("04 - Products\04 - Products.WSS").Select(vsUISelectionType.vsUISelectionTypeSelect) DTE.ExecuteCommand("ClassViewContextMenus.ClassViewProject.Publish") '// now I want copy (and overwrite) some files, but AFTER

Getting EnvDTE.DTE instance outside Visual Studio IDE

感情迁移 提交于 2019-12-19 03:24:35
问题 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 = (EnvDTE.DTE)Marshal.GetActiveObject("VisualStudio.DTE.12.0"); string solDir = dte.Solution.FullName; solDir=solDir.Substring(0, solDir.LastIndexOf("\\")); dte.Solution.AddFromTemplate(path, solDir+"\\TestProj", "TestProj", false); It is working when I run the

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

假如想象 提交于 2019-12-18 05:40:12
问题 Is there a macro that does it? Which DTE objects to use? 回答1: (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. 回答2: Here's a quick implementation of 1800 INFORMATION's idea: Sub

How to get notification when a successful build has finished?

徘徊边缘 提交于 2019-12-18 04:04:12
问题 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? 回答1: 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. 回答2: Typically,

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

陌路散爱 提交于 2019-12-18 04:02:59
问题 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 use the existing code files as the source. The following is boilerplate code I found on the internet that gets a reference to the current project <#@ template debug="true" hostspecific="true" language="C#" #> <#@ assembly name="EnvDTE" #> <#@

Add code analysis ruleset through nuget package

六眼飞鱼酱① 提交于 2019-12-18 02:51:09
问题 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

Accessing Projects via DTE in C# T4 Template

浪尽此生 提交于 2019-12-17 18:56:15
问题 I'm currently trying to iterate over all of my projects (sharepoint) to get all feature guids into an file. there i want to prefix them with the projects name. My problem is DTE.Solution.Item and DTE.Solution.Projects.Item (or the enumerators for foreach) will not take an integer as parameter and foreach returns an object which is not castable to Project. Here is my code snippet: var hostServiceProvider = (IServiceProvider) Host; var dte = (DTE) hostServiceProvider.GetService(typeof(DTE));