Share a custom made Visual Studio 2010 toolbar - visual-studio-2010

I've created a new Toolbar in Visual Studio 2010 and added some custom buttons to it (mainly utilising the External commands).
I'd now like to share that toolbar with others, or be able to "save" it so that I could re-import at a later date.
I know that you can use the Import and Export Settings Wizard to back-up all your settings and re-import them elsewhere, but it does not allow you to Export a single toolbar instance.
Can anyone point me in the right direction of how I might be able to do this? I don't mind if it's just a settings file I have to save, a VS Extension I have to write, or an installer package I have to create - I'd just like to be able to share my toolbar!

I'm working in 2008, but in the Import Export Settings Wizard, limiting it to
General Settings > Menu and Command Bar Customizations
will narrow it down to just your toolbars.
The settings file is all just XML so you can look at stripping out your personal preferences and leaving just the elements of your custom toolbar.

Related

Cannot import window layouts into VS2013 from VS2012

I'm having trouble importing window layouts from Visual Studio 2012 to Visual Studio 2013.
I'm getting this error message, when I try to import *.vssettings file exported from VS2012 to VS2013:
Your settings were imported, but there are some warnings.
Warning 1: Category 'Window Layouts'
({eb4ba109-a9db-4445-bd09-e7604bcdce84}) could not be migrated because
the author of the category did not provide support for migration.
I had same problem with importing window layouts from VS2010 to VS2012. I thought there was some kind of breaking change that prevented direct importing, so I just recreated my preferred window layout in VS2012.
So basically I have to recreate my preferred window layout once again in VS2013. Does anyone have any suggestion how to solve this?
By the way, I've tried to reset settings in VS2013 (Tools -> Import and Export Settings -> Reset all settings...) and then try import settings from VS2012, but no change.
Edit: what's weird, is that I can create a window layout in VS2013, export it, reset settings in VS and then import back settings with that window layout and the import is successful (imported window layout gets applied).
Does this mean Microsoft completely dropped support for migrating window layouts from one version of Visual Studio to another? I would understand, if the imported window layout contains layout information for non-existing windows (like VS2012 -> VS2010 import). But standard way of migrating settings (to newer version of software) should be supported, right?
It's a bug in the Visual Studio settings migration feature, the window layouts are actually directly compatible between VS2010/VS2012/VS2013. The solution is actually really easy: Manually export just the window layout from VS2010, change the version number in the file, then import it into VS2013, and it'll work.
For the step by step solution to this problem, do the following:
Open Visual Studio 2010
From the main menu, select "Tools->Import and Export Settings"
Select "Export selected environment settings" and press "Next"
Select only the "General Settings->Window Layouts" option from the settings tree, and press "Next"
Name the file how you want and select "Finish"
Open the exported settings file in a text editor, and change the second line from this:
<ApplicationIdentity version="10.0"/>
To this:
<ApplicationIdentity version="12.0"/>
Or set the version string to 11.0 for Visual Studio 2012.
Open Visual Studio 2013
From the main menu, select "Tools->Import and Export Settings"
Select "Import selected environment settings" and press "Next"
Save your current settings if desired, and press "Next"
Select "Browse" and locate the modified settings file, then press "Next"
Press "Finish"
I came across this question while searching for a solution myself. I couldn't find an answer anywhere, so hopefully this will help anyone else who comes across this problem.
EDIT: I've now seen a case with a colleague where there was something in his window layout settings that wasn't directly compatible with Visual Studio 2012, so this solution failed for him. If you get errors migrating your window layout, I'd suggest resorting to "slicing and dicing" the window layout to narrow down which part(s) are causing the error.

Browser links are not showing in Visual Studio 2013

I am using Visual Studio 2013. I don't no what happened to VS,now it is not showing Browsers list.How to overcome from this problem please suggest me.
Include screenshot of the project / solution list. I believe somehow you are opening a .csproj project file for a non MVC application even though it has all the code files that look like a MVC application. For instance someone may have created a windows form application and imported all the MVC / .cs files from a MVC ASP .NET project.
If you included that screenshot we could see the icon next to the project to rule that out as a potential cause.
Alternatively you can try reset your visual studio 2013 settings by doing the following:
1.On the Tools menu, click Import and Export Settings.
2.On the Welcome to the Import and Export Settings Wizard page, click Reset all settings and then click Next.
3.If you want to save your current settings combination, click Yes, save my current settings, specify a file name, and then click Next.
—or—
If you want to delete your current settings combination, choose No, just reset settings, overwriting my current settings, and then click Next. This option does not delete default settings, which will still be available the next time you use the wizard.
4.In Which collection of settings do you want to reset to, select a settings collection from the list.
5.Click Finish.

Save and restore code clippings in Visual Studio Toolbox

I occasionally give demos and training at my office. I have seen and used the technique where you drag code into the Visual Studio toolbox, so that you can later drag it into a code file during a demo.
My question:
I would like to be able to save and later reload tabs (each tab contains a demo/tutorial of code snips), so that I can get rid of clippings that I am not using, but still get them back.
Anyone know how to do that in Visual Studio? (using VS 2012 Professional)
Note: I have seen this article that describes where they are saved: Where does Visual Studio save code blocks that are dragged on the Toolbox
However, I am looking for a way to restore the snippets without restoring my entire set of vs settings.
If you still have the tool box options available in VS, in theory you can export just the toolbox contents through Tools > Import and Export Settings... and import them later.
On the Import and Export Settings Wizard, choose Export..., click Next >. In the Choose Settings to Export > Which settings do you want to export? list, clear everything and then navigate to General Settings > Toolbox and select it. Then click Next > and save the file where you want.
Afterwards you should be able to restore just the Toolbox settings by using the Tools > Import and Export Settings... dialog.
Note that after I did an import I didn't see the snippet in the Toolbox, using VS 2017 V15.2, until I shut VS down and re-started it.

How to use different tab settings in different projects in Visual Studio

The Visual Studio options dialog allows you to set tab preferences (size, insert-spaces, etc.) on a per-language basis. But I am regularly working on a couple of c# projects with different settings for these values.
Is there a way to override the global settings on a per-project basis, or at least toggle between them easily?
Another approach may be through the extensibility API: it should be possible to write a macro or add-in that changes these settings.
E.g. to change the tab size to 6, use the following:
DTE.Properties("TextEditor", "CSharp").Item("TabSize").Value = 6
Here's a link that explains how to find out the names of the properties: http://support.microsoft.com/kb/555445
You can open visual studio with a special "reset" settings file which overrides the default settings. Using this method it is possible to create two shortcuts, one with each tab setting. Details are here.
I'm afraid you can't do that on a per-project basis.
But, with Tools/Import and Export Settings... you can export each settings in a file and you could import the one that fits your current project.
Visual studio 2017 adds .editorconfig support, which is very handy for such settings.

How to Export/Import Toolbars in Visual Studio

I export my settings in Visual Studio and if I ever move to a new machine or have problems, I use those backed up settings to restore Visual Studio to the way I like it. It also allows me to maintain a consistent development environment between the various machines that I use.
This works great for keybindings, syntax highlighting, user tools, pretty much everything except for the toolbar locations and customizations. Whenever I move to a new machine and restore the settings, the toolbars are not affected. I have spent a fair amount of time setting up toolbars with my macros, external tools, etc and cut'n'pasted icons in for them. I hate losing all that work.
Does anybody know how to back up and restore the toolbars' locations and customizations? If it is not a feature of Visual Studio, is there an addin that will do the job?
Edit
As mentioned below, the Menu and Command Bar Customizations in Import and Export Settings is supposed to do this, but when I re-import my previous settings, I get
Error 1: Menu and Command Bar Customizations: The version of command bar settings being imported is not supported. All the command bar settings have been ignored.
The settings I am trying to re-import were exported earlier this month with the same version of Visual Studio. The only difference is that I am now running 64 bit as opposed to x86. I didn't think that would make a difference though since the settings files are XML.
Any ideas?
I have finally found the solution to this. There is a known bug in Visual Studio and there are two workarounds given. The first workaround does not apply, but the second worked.
To Backup your toolbars:
Copy the file CmdUI.PRF from the path %AppData%\Microsoft\VisualStudio\X.Y\1033 to the same directory as your exported .settings file.
where X.Y is either of 8.0, 9.0, 10.0 or 11.0 depending on your visual studio version (2005, 2008, 2010 and 2012 respectively).
To Restore your toolbars:
Make sure Visual Studio is closed and copy the backed up file back to the original location.
For the benefit of others, as you mentioned this feature doesn't seem to be supported across versions of Visual Studio, presumably because of a change in the DTD/XSD for the settings file? At any rate, here's where the settings for your custom toolbars lie in the "Import and Export Settings..." dialog:
Note: Your options may look different, depending on the settings you exported.
I have not tried it, but "Tools\Import and Export Settings..." maybe will let you export a .vssettings file you can then take to another box.
See also
http://blogs.msdn.com/saraford/archive/2005/04/19/409887.aspx
and other Sara 'export' tips.

Resources