Changing a project's files based on solution in Visual Studio 2008
- by emddudley
In one C# solution I have several projects that share a CommonAssemblyInfo.cs file, so that certain assembly attributes are shared across all projects. This works fine so long as I only have one CommonAssemblyInfo.cs file. However I have several solutions (applications) which use these projects, and each solution has its own version of CommonAssemblyInfo.cs.
How can I make the projects use a different CommonAssemblyInfo.cs file depending on which solution they are in?
In the end I want my assemblies to have attributes specific to the solution they were compiled from.
I don't think I can make them files Solution files because they can't all be in the same directory with the same filename. I can't use pre-build events because I don't have a particular project which is always built first. I would prefer not to use a build script because I would like to be able to build and run the solutions through the Visual Studio environment.