Did you know… You can create toolbar buttons to quickly toggle your favorite VS Settings? – #372
I never knew we put in object model support for the Import / Export Settings feature. When I was testing the feature, I remember being told there wasn’t time in the schedule to do it. Obviously priorities changed after I moved onto the next feature area, and I never got the memo. I so could have used this tip for the entire past year or two or three…
Let’s say you want Visual Studio to have different window layout at the snap of your fingers. Or even better, you want to toggle VS in and out of a “presentation mode.” (This doesn’t have to be just for Window Layouts and Fonts and Colors. This could work for any settings captured by the Import / Export Settings wizard.)
I’ve mapped the Coffee Mug Icon to the General Development Settings * and the Video Camera Icon to my settings whenever I give presentations. Now I can quickly toggle between presentation mode and work mode.
here’s how you can do it:
- Go to Tools – Macros – Macros IDE, and in the Project Explorer, create a Module file (or just use MyMacros-Module1 if it’s not being used.)
- Paste in the following code and of course tweak your file path and file names.
Public Sub ImportPresentationMode()
DTE.ExecuteCommand("Tools.ImportandExportSettings",
"-import:""C:\Users\saraf\Documents\Visual Studio 2008\
Settings\VisualStudioTipsAndTricksDemo.vssettings""")
End Sub
Public Sub ImportGenericEnvironment()
DTE.ExecuteCommand("Tools.ImportandExportSettings",
"-import:""C:\Program Files\Microsoft Visual Studio 9.0\
Common7\IDE\Profiles\General.vssettings""")
End Sub
- With the macros create, to go Tools – Customize, and on the Commands tab, select Macros in the Categories section to find the macros you just created in Step 2.
- And simply drag and drop those macro commands to the toolbar of your choice, or create your own VS Settings toolbar (on the Toolbar page of this dialog.)
After making this customization, I recommend restarting VS to write out any necessary info about the command bars before doing exporting your new customizations.
*Note: I use General Development Settings because it is my baseline default. However if you want to do this toggle back and forth like i’m doing, you will need to add these toolbar button customizations to your General.settings file. Otherwise, you’ll do the toggle, and you’ll import the VS Installed general settings, and the buttons will disappear. Yes, I obviously did this to myself the first time.
Thanks to James’s whitepaper on VS 2005 IDE Tips and Tricks that made me aware of this.
https://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx
Technorati Tags: VS2005Tip,VS2008Tip
Comments
Anonymous
December 05, 2008
That's a snazzy tip there... I also just read the one in the sidebar about drag and droping code (#033 - I know it's an older one, but I saw it hanging out in the sidebar and jsut had to click it.)... and have a further tip on that. Did you know... you can collapse an entire region (sub, function, any collapsable block of code), select it.... and then drag the entire region to a new location? That's probably the biggest drag and drop feature I use the most... I'll collapse all my functions/subs/event handlers, then I can arrange them into the regions where they belong. It's a handy way to be able to select several subs without the need to scrolling, scrolling, scrolling.Anonymous
December 05, 2008
Great tip! I use a black background for coding, but I have a settings file saved with a dimgray background for copying and pasting code into documents. Switching back and forth was painful until now. Can you expand on the General.settings file by chance though? I lost my settings just as you did, but I don't know about General.settings. Is it actually General.settings, or is it General.vssettings? Thanks!Anonymous
December 08, 2008
The long lines of code are being cut off by your style sheet. At least they don't show up in IE and I can't select them to make them visible either.Anonymous
March 31, 2009
Quickly Change Profiles in Visual StudioAnonymous
April 19, 2009
本篇包括tip371-tip380http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-37.html#371、从...