envdte

How to get expanded path from EnvDTE / VCProjectEngine

梦想与她 提交于 2020-01-16 16:58:59
问题 I am trying to write a tool to create a zip file containing all PDBs files from one Visual Studio 2010 solution. I can get every PDB filepath in the solution with the following code. However, the property value contains Visual Studio macro like $(TargetDir), $(TargetName) and so on. Is there a function in the EnvDTE API to expand those macros to their current values ? On the other hand, any other methods that would achieve my initial goal are also welcome ! Thanks System.Type t = System.Type

Adding controls to a form when I only have the reference to it’s EnvDTE

為{幸葍}努か 提交于 2020-01-06 12:50:30
问题 I am writing na Add-In for Visual Studio 2010, and I want it to add controls to an existing Form in an existing Project in an existing Solution, and I already have references to all of them. As I have the reference to the Project Item that represents the file of the form, I want a reference to the Form per se, then I’ll be able to do anything to it (changing properties, and adding controls). I have tried some approaches, though I must admit I haven’t ran out of tries. But since this is quite

Adding controls to a form when I only have the reference to it’s EnvDTE

亡梦爱人 提交于 2020-01-06 12:50:09
问题 I am writing na Add-In for Visual Studio 2010, and I want it to add controls to an existing Form in an existing Project in an existing Solution, and I already have references to all of them. As I have the reference to the Project Item that represents the file of the form, I want a reference to the Form per se, then I’ll be able to do anything to it (changing properties, and adding controls). I have tried some approaches, though I must admit I haven’t ran out of tries. But since this is quite

How to automatically attach process to a specific instance of VS?

我与影子孤独终老i 提交于 2020-01-05 12:56:58
问题 I am trying to attach a process to VS by using this code: DTE dte = (DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0"); EnvDTE.Processes pro = dte.Debugger.LocalProcesses; foreach (EnvDTE.Process p in pro) { if (p.ProcessID == num) { p.Attach(); return; } else { continue; } } My problem is that I can't control to which instance of VS it gets attach to. usually its the first VS window that I opened. How can I get a list of all the open VS instances? Thank you

EnvDTE partial class keyword

牧云@^-^@ 提交于 2020-01-05 06:37:27
问题 I'm introspecting on the code in a project using EnvDTE, and I want to be able to determine if they're a partial class, but it doesn't seem to exist in the namespace. Does anyone know how to do this? 回答1: This should help you out if(codeClass.ClassKind == vsCMClassKind.vsCMClassKindPartialClass) { // It is a partial class } 回答2: You can use the C# code model. Check this msdn article 来源: https://stackoverflow.com/questions/2144588/envdte-partial-class-keyword

How can I create new blank solution in vs 2008 programmatically?

我与影子孤独终老i 提交于 2020-01-04 04:39:17
问题 The design based approach is: New Project -> Other Project Type -> Visual Studio Solution -> Blank Solution I have to create a blank solution programmatically in C# and in this solution add new empty project and files. i found a lot of code on the web using DTE but they are adding my empty project in existing solution explorer so please give me some reference code. 回答1: You can create a new blank solution using DTE like this: string visualStudioProgID = "VisualStudio.Solution.9.0"; Type

How to register key binding code on VSIX package installation

耗尽温柔 提交于 2020-01-02 07:46:10
问题 I'd like to add keyboard shortcut to Visual Studio package only once, during its installation. Basically I know how to do it from the package code, for example: var dte = GetGlobalService(typeof(DTE)) as DTE2; if (dte != null) { dte.Commands.Item("Tools.Something").Bindings = "Global::Ctrl+T, Ctrl+S"; } The problem is, I'd like to invoke this code only once (I don't want to execute this code in package class constructor, because it will execute each time the package will be used first time

EnvDTE substitute in Visual Studio 2012

ⅰ亾dé卋堺 提交于 2019-12-30 01:20:51
问题 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

Finding a ProjectItem by type name via DTE

廉价感情. 提交于 2019-12-29 04:46:06
问题 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 a file name. Thanks! 回答1: I've been trying to do something similar, and have come up with the following, which simply searches through namespaces and classes until it hits the one you're looking for. It seems to work in most cases although when

Finding a ProjectItem by type name via DTE

烈酒焚心 提交于 2019-12-29 04:46:05
问题 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 a file name. Thanks! 回答1: I've been trying to do something similar, and have come up with the following, which simply searches through namespaces and classes until it hits the one you're looking for. It seems to work in most cases although when