Changing a project's files based on solution in Visual Studio 2008
        Posted  
        
            by emddudley
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by emddudley
        
        
        
        Published on 2009-12-08T17:06:36Z
        Indexed on 
            2010/06/11
            14:03 UTC
        
        
        Read the original article
        Hit count: 229
        
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.
© Stack Overflow or respective owner