Luke Smith

Write today, wrong tomorrow

Sharing configuration across visual studio projects

Whenever creating a new visual studio project I always go through the pain of ensuring certain properties are setup and StyleCop is enabled. It’s manual and boring, and not to mention the repetition of the settings not exactly being DRY.

I can’t believe I didn’t think of this sooner but one way to get around this is to create a single target file, containing all of the properties and bits you want to run as part of building the project, then all you have to add to each project file is a single import of the target.

<Import Project="$(SolutionDir)\build\common.target" />

My common.target can be found on github.

Next task is to create a simple script to run through all .csproj files in a directory tree and add/update the import element if it’s missing.

Advertisement

One Response to Sharing configuration across visual studio projects

  1. Tom Robinson July 19, 2011 at 12:48 pm

    Thanks, I’ve just set that up on a new project at work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.