views:

689

answers:

4

I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing.

I know that this can be done inside VS with Import/Export Settings, but I'd like to be able to automate it from outside of VS. Is this possible, and if so, how?


Edited to add: doing it from outside of VS is important to me -- I'm hoping to use this as part of a more general "configure this newly-Ghosted PC just the way I like it" script.


Edited again: the solution seems to be to hack CurrentSettings.vssettings, or use AutoIt. Details below.

+1  A: 

Check out the Visual Studio Extensibility website.

Martin Salias
+1  A: 

An easy way is to use the macro recorder to do something simple, then look at the code it produces and edit it as you see fit.

Mark Cidade
A: 

On my machine Visual Studio stores it's local settings in a file called VCComponents.dat. Its a text file, so perhaps you could find a way of placing your settings directly in there.

The file is stored in my users local AppData\Local\Microsoft\VC folder

David Sykes
A: 

Answering my own question, in two ways:

1) In VS2005/8, the things I mentioned (Tools/Options, External Tools) are all stored in the CurrentSettings.vssettings file, in the folder "Visual Studio 200{5|8}\Settings". This file is just XML, and it can be edited programmatically by anything that knows how to parse XML. You can also just paste a new vssettings file over the top of the default one (at least, this works for me).

2) The larger question of configuring a virgin PC. It turns out that not everything I want to change has an API, so I need some way of pretending to be a user who is actually sitting there clicking on things. The best approach to this seems to be AutoIt, whose scripting language I will now have to learn in my Copious Free Time.

Matt Bishop
The preferences you want to change are all stored somewhere -- use Process Monitor from SysInternals to see which files and registry keys are written to when you change a particular setting. The files are usually INI or XML; the registry is obvious.
Roger Lipscombe