Using a single/the same AssemblyInfo.cs across projects

by Oliver 12. February 2011 11:17

Recently, while skimming my RSS feeds for a short read, I stumbled upon Phil Haack’s blog and his post Introducing RouteMagic. I’m not going into the details of that post right now (although to me it seems he’s written some interesting stuff about MVC and lately on Routing). I was just curious about his source code, so I went over to his Route Magic Codeplex site and looked at a commit with the interesting commit message Consolidated assembly info into a SolutionInfo.cs file and linked it to the two projects.

The above link leads to a page with diffs of a few files. The SolutionInfo.cs keeps the assembly information that is the same for all projects in a single file that we only need to link into every project (or at least every one that needs it). This is done by adding an existing item (Shift + Alt + A in Visual Studio 2010) with the option Add as Link (open the dropdown to see):

add-as-link

Now the SolutionInfo.cs will be compiled into the project. Of course, you should remove the entries that you put into the SolutionInfo.cs from the AssemblyInfo.cs in the same project.

We used to have two AssemblyInfo.cs files whose version numbers always needed to be in sync – now there’s only one file we have to edit: the SolutionInfo.cs.

Thanks, Phil Haack, and Happy Coding!

Oliver

enjoyed the post?

Tags:

Comments are closed

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for javascript. Enjoy MVC 4 and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our children. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.