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\" />

My 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.

comments powered by Disqus