Andy Smith's Blog

Page.RegisterStartupScript('Andy', 'MetaBuilders_WebControls_GainKnowledge();');

Import Settings toy for VStudio

As you can tell by the sheer size of the c# formatting options area in vstudio 2005, different companies and people love their own personal code formatting style. However, that can present a pretty serious problem to those of use who bounce around various clients, because they almost invariably all have their own style documented in some holy document.

For a while, i would just go through the settings dialogs to change to the current project i was working on. That got tedious very quickly. Then I started exporting/importing vssettings files through the wizard. But even that 10 click game gets old. So one night, after dealing with 3 different projects or 3 different clients, I got sufficiently annoyed and decided to get lazy about the whole thing.

So now I have a vstudio 2005 macro that makes it easy to add a simple macro command to my Tools menu for this. Open a project, click a menu item. yay for easiness. The only thing easier would be if it were automatic, which is something i'm working on in the background.

After building that, I just had another idea about importing settings that, while I'm not going to use myself right now, I thought would be an interesting little side project. So I also created a macro project for automaticly importing from a vssettings file over the web. Uploading the file is up to you for now, but vstudio will, upon open, download and import those settings. The idea here is to make it a bit easier to keep 2 locations ( home and work? ) in sync as far as options go.

So if these toys interest you, download and give them a try.

Comments

Charles Chen said:

Awesome :D Will definitely give it a shot. I'm surprised that the VS team hasn't implemented this feature yet >.<
# August 30, 2005 8:49 AM

Roy @ VsDevCentral said:

This is actually something that I mentioned in the early alpha days of Whidbey. However, I wanted to go a bit deeper and be able to assign it to other existing commands. For example, when I check out a file, have it automatically format the code using my settings, and when I check in the file, reformat it into "company standards" before it actually checks in.
# August 30, 2005 1:53 PM

Andy Smith said:

Roy,
While I see the benefit of that in many circumstances, _many_ of us don't use the vstudio sourcecontrol integration ( svn, vault, etc instead ) and so checkout/in don't really make good points for sourcecode formatting.

The idea I've been toying with lately is to have a full-fledged addin ( rather than just a macro ) that adds properties to a sln/proj that states which formatting rules should be applied, so these formats would be applied automatically on close to any files which you have edited during the session. But that's still very much in idea-land for now.
# August 30, 2005 2:03 PM

Roy @ VsDevCentral said:

I'm not saying it should be mandatory, but if configured, do it. And even with any of the source control systems that you mention, changin the formatting of a source file will cause the version control system to mark the entire file (or most of it) as changed. Then when you try to do a diff between versions, it is gong to be a nightmare. Source/Version control needs to have a single formatting rule, so allowing VS to have that option just makes the most sense.
# August 30, 2005 2:18 PM

web hosting company said:

Respective technology and entertaintment blog it is. I have been long looking for some nice blogs. Very enlightening article it is for read anyone.

# April 20, 2012 3:34 AM

man and van London said:

Wow… Fantastic Info. I am rather glad to you for supplying this helpful details.

# May 22, 2012 10:31 AM

computer expert said:

I have a little knowledge on Vsstudio.A few years ago, I have read an article on vsstudio 2003. but the blog was quite complicated.But this one is really exceptional as the presentation is so simple.

# July 24, 2012 2:38 PM