envdte

Visual Studio 2008 Publish fails, can't load dll (envdte.dll)

女生的网名这么多〃 提交于 2019-12-25 08:36:42
问题 I started to get this error after I had installed and uninstalled various MS SDKs Error: Publish failed with the following error: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

OnBuildBegin does not fire in Visual Studio Macro until I run it from Macro Explorer

穿精又带淫゛_ 提交于 2019-12-24 10:45:06
问题 I have the following Visual Studio Macro: Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports MyMacros.EnvironmentEvents Imports System.Diagnostics Public Module Module1 Private WithEvents buildEvents As EnvDTE.BuildEvents = EnvironmentEvents.BuildEvents Public Sub BuildEvents_OnBuildBegin() Handles buildEvents.OnBuildBegin Dim projectItem As ProjectItem = DTE.Solution.FindProjectItem("T4MVCVB.tt") projectItem.Save() End Sub End Module I can run it from the Macro explorer,

Are there any document window focus events?

大兔子大兔子 提交于 2019-12-24 00:38:21
问题 This one has been a bit of a pain due to a similarly named feature in Visual Studio (which I won't mention here for the sake of people searching). What I'd like to do is to listen to events regarding which document window has focus I wish my extension to behave differently depending which SolutionItem is open and has focus. I'd assume there is an event somewhere which will inform me when this focus changes. I've found where I can listen to when a document opens and closes, but not when a

How to Get List of Open Web Pages in Visual Studio Using EnvDTE

纵然是瞬间 提交于 2019-12-23 15:44:32
问题 As part of a NuGet installation we need to open a web page when the installation completes. Our requirement is to: Open web page in Visual Studio in a new window if the page is not already open in another window. Opening a web page by itself is straight forward: ... DTE.ItemOperations.Navigate(WebPageUri.ToString(), EnvDTE.vsNavigateOptions.vsNavigateOptionsNewWindow); ... The problem has been finding a way to get a list of the currently open web pages, so that we can decide if a page needs

Import/Export VS settings programmatically?

此生再无相见时 提交于 2019-12-23 12:50:04
问题 Is there a way to import/export Visual Studio settings via a Visual Studio Extension, i.e., via the Visual Studio API? I want to export some specific settings to a local file, just like the VS Import and Export Settings Wizard does, however, without UI interaction of course. 回答1: There is a Visual Studio Command named Tools.ImportandExportSettings You can execute the Command with DTE2.ExecuteCommand Import/Export example: dte2.ExecuteCommand("Tools.ImportandExportSettings", "/export:\"C:/temp

Get Access property of a CodeElement

只谈情不闲聊 提交于 2019-12-23 12:37:02
问题 I'm writing an Add-in for VS 2010. Can't find answer for a question - How can i get the Access property of a CodeElement if it has that one. I was trying reflection, but no results. Ex. CodeElement is a class method public void GetAccess (CodeElement codeElement) { object code = codeElement; Type t = code.GetType(); t.GetProperty("Access") = vsCMAccess.vsCMAccessPublic; } But it doesnt work.. Help, please! 回答1: Access is only available on some types of CodeElements, so you'll need to check

Current type of the build action from Visual Studio - Microsoft.VisualStudio.Shell.Interop

扶醉桌前 提交于 2019-12-22 11:35:09
问题 In some extension we implement the IVsUpdateSolutionEvents2 and IVsSolutionBuildManager2 used for registering caller with the AdviseUpdateSolutionEvents For example, this called before any build actions have begun: public int UpdateSolution_Begin(ref int pfCancelUpdate) { ... } However, also need getting the status or type of the current build action, for example: build/rebuild/clean/deploy Available & known variants: BuildEvents With the Events.BuildEvents i can subscribe to OnBuildBegin,

Visual Studio serialization error when T4 uses DTE to open generated file

旧时模样 提交于 2019-12-22 07:45:30
问题 We have a C# T4 file named GenerateProxies.tt which calls several command-line codegen utilities. Using the System.Diagnostics Process class, we redirect the standard output to the T4 output text file (GenerateProxies.txt) so that we can review the command-line output for errors. I added the following simple code to the end of the T4 so that Visual Studio will open the generated text file as the last step in the process (the workingDirectory variable is declared and populated earlier in the

How do I programmatically find out the Action of each StartUp Project in a solution?

断了今生、忘了曾经 提交于 2019-12-22 04:41:30
问题 Under Solution->Properties, I can set multiple start-up projects: I know that I can get the list of projects marked with "Start" (by using EnvDTE: solution.SolutionBuild.StartupProjects ), but how do I get the list of projects whose action is "Start without debugging"? They do not appear in the list. 回答1: I don't think this is documented and available officially, but here are some information: This is stored in the solution's .SUO file by the Visual Studio built-in package. The SUO file has

Change the Debug properties of Visual Studio project programmatically by EnvDTE

橙三吉。 提交于 2019-12-21 16:19:14
问题 Is it somehow possible to change the project properties in debug section programmatically by EnvDTE classes? I know how to get the DTE instance and work with some of the settings, but I am blind or the debug section is just not accessible. I started from here http://msdn.microsoft.com/en-us/library/envdte.project.dte.aspx 回答1: EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0"); Project project = dte2.Solution.Projects.Item(1);