visual-studio-addins

How to use app.config with Visual Studio add-in?

一世执手 提交于 2019-12-08 06:07:15
问题 I'm building a simple VS2008 add-in. What is the best practice for storing custom run-time settings? Where do you store the app.config and how do you access it from the add-in? 回答1: Try something like this with System.IO.IsolatedStorageFile (haven't tested sample code.. it's just to show the idea) Writing using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForAssembly()) { using (StreamWriter stream = new StreamWriter(new IsolatedStorageFileStream("YourConfig.xml", FileMode

How to get the current line number at break/exception in Visual Studio add-in?

不问归期 提交于 2019-12-07 11:12:25
问题 I'm messing around with the Visual Studio add-in API trying to see if something I want to do is possible. One thing I am doing right now is something like: public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) { _applicationObject.Events.DebuggerEvents.OnExceptionThrown += DebuggerEvents_OnExceptionThrown; handled = false; if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { if(commandName == "MyAddin1

Is there an event triggered when dte.Solution.SolutionBuild.StartupProjects changes?

前提是你 提交于 2019-12-07 08:00:33
问题 I am building a visual studio 2010 Add-in for internal use in my company. I would like to customize the main window caption to display the name of the current start up project. I can set the caption of the main window with the following code: DTE d = GlobalClass.dte2 as DTE; IntPtr hWnd = new System.IntPtr(d.MainWindow.HWnd); if (d.Solution.SolutionBuild.StartupProjects != null) { object[] sStartUpProject = (object[])d.Solution.SolutionBuild.StartupProjects; string Caption = d.MainWindow

Get current TFS connection in a Visual Studio addin

那年仲夏 提交于 2019-12-07 06:26:06
问题 I'm working on a Visual Studio 2010 add-in, and I'm trying to figure out how to determine the currently connected TFS server. I'm guessing I need to use DTE, but I'm having a brain cramp figuring out where to get the info. 回答1: I suggest you check out the Microsoft.TeamFoundation.VersionControl.Client.Workstation.GetLocalWorkspaceInfo method, in result you have an object and access ServerUri property See this documentation on MSDN for more details. 回答2: Robaticus originally edited the

How do I write to the output window in Visual Studio 2010 AddIn?

落花浮王杯 提交于 2019-12-06 20:56:28
问题 I'm writing a simple Visual Studio 2010 Add-In to do a common copying job here at work (getting dlls from libs sln). I want the progress of the copying to be written to the output window. I tried Trace.WriteLine(...) expecting that to make it, but it doesn't when I run the add-in in the debugger. I have not tried it any other way yet. I found some examples of doing that in Visual Studio 2008, but the required libs are not available to reference. Can anyone point me to how to write to the

How to search for the name of the UserProperty in Outlook.MailItems, not their value

大城市里の小女人 提交于 2019-12-06 14:56:18
BACKGROUND: Currently I am searching Outlook.MailItems where their UserProperty (here, "IsProcessed") is equal to its propertyValue (here, true or false). string propertyValue = "true"; string filter = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/IsProcessed LIKE \'%" + propertyValue + "%\'"; I am using this filter string in advancedSearch link to doc PROBLEM STATEMENT: My usecase is to search if these mailItems have any UserProperty assigned where name of UserProperty = "IsProcessed". Is there any way to do so using similar DASL filter string? Thanks. No,

VS 2010 addin: getting selected text in the editor

限于喜欢 提交于 2019-12-06 13:33:54
问题 Coders, I am developing an add in for VS2010 and I am trying to get the selected text in the code editor. so far, i have been searching many webpages and thy all seems to use DTE.ActiveDocument which causes an error in my code. I have written two versions of a method that suppose to return a selected text in the editor but I still get the same error over and over: the error is: An object reference is required for the non-static field, method, or property 'EnvDTE._DTE.ActiveDocument.get' and

How would I retrieve the fully qualified name of an identifier in a VS macro?

耗尽温柔 提交于 2019-12-06 05:11:55
问题 I'm trying to resolve the fully qualified name of a c# identifier at a certain point (cursor) of a code window, using a Macro (or even an Add-in) in Visual Studio 2008. For example, if the cursor is in "Rectangle", I would like "System.Drawing.Rectangle" returned. I've tried FileCodeModel.CodeElements and .CodeElementFromPoint but they only retrieve the containing method or class (and others). If this can't be done using a macro or add-in (even though VS does know the information via

Visual studio save development state

你离开我真会死。 提交于 2019-12-06 04:39:28
问题 Is there any Visual Studio addin/thing that will save the current set of open windows, bookmarks, and breakpoints, etc? Whenever I return to an issue, it takes a while to find reopen the appropriate classes, reset breakpoints, etc. Something that could load previously saved states for each issue would save a lot of time on issues that need to be readdressed several times in response to feedback. 回答1: As stated on visualstudio.uservoice such a feature kinda exists. You can group breakpoints by

Developing Visual Studio addins for multiple versions of Visual Studio

十年热恋 提交于 2019-12-06 03:59:44
问题 I've been given the task of developing some extensions for Visual Studio for our internal use. These will have to support a couple of different versions of Visual Studio (VS2008, 2010 and 2012 - VS2005 would be a nice to have but not essential). I'd like to develop these in as consistent a way as possible, reusing as much of the code as possible, while fitting it into the existing project structure for these kinds of tools, which is a Visual Studio 2012 .sln. What's the best / easiest way of