Visual Studio 2005/2008: How can you share/force a

2019-06-21 14:09发布

I would like to have all developers on my team to use the same rules for formatting several types of code (ASPX, CSS, JavaScript, C#). Can I have visual studio look to a common place for these rules?

I would like to not rely on export/import settings as that brings many settings along. I (for example) don't care what font colors the developer uses when typing, I just want similar formatting. Can you import a subset of settings?

10条回答
放荡不羁爱自由
2楼-- · 2019-06-21 14:31

An extensive use of Visual Assist's snippets (bits of pre-formatted codes) may help...

查看更多
聊天终结者
3楼-- · 2019-06-21 14:39

We use the following tools:

The reason we use the latter two is twofold: First you are able to do a Clean Up of your code. This allows you to clean your code in one go and solve all warnings. At least that is what the brochure says. In reality you need to set quite a few settings in Resharper. Have a look at links like this to see how that works. Second: Resharper integrates the Stylecop violations in the source editor. Extremely useful as they are visible while writing code and can therefore be solved on the spot.

查看更多
SAY GOODBYE
4楼-- · 2019-06-21 14:42

Visual Studio uses the settings in Tools > Options > Text Editor > [your language] > Formatting to set how it auto-formats code.

You can set it up how you like and then use Tools > Import and Export settings to create a .settings file for your team to import and use. It won't enforce rules, but it will make the default VS behavior the same for everyone.

查看更多
贪生不怕死
5楼-- · 2019-06-21 14:45

If you're using C#, take a look at StyleCop.

查看更多
ゆ 、 Hurt°
6楼-- · 2019-06-21 14:47

Code Review.

查看更多
我命由我不由天
7楼-- · 2019-06-21 14:49

No-one's mentioned Team Settings yet? You just export the desired settings to a network share, then get everyone to map to it. Job's a good 'un.

Tools -> Options -> Import and Export Settings, then tick "Use Team Settings"

查看更多
登录 后发表回答