Reputation: 5455
I have a solution that represents a releasable product, and it contains both product specific projects, and other projects that are shared across the entire organisation. What's the best way of stamping a version number for the released project? My current ideas are:
I'd quite like a way to apply the same version number in all of these places, or is there a better way of doing this?
Upvotes: 2
Views: 203
Reputation: 62484
The idea is to create shared GlobalAssemblyInfo.cs
file and include it as external link in each project which should be versioned, in this way you can change version in a single place and all projects pick it up whilst Complie
GlobalAssemblyInfo.cs:
[assembly: AssemblyVersion("0.0.0.1")]
[assembly: AssemblyFileVersion("0.0.0.1")]
Update csproj files once to include shared assembly info:
<Compile Include="$(SolutionPath)\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
Upvotes: 3
Reputation: 1
A common way of handling this is to create a file with version-related attributes from AssemblyInfo.cs and drop it into the root solution folder. You then reference it in each individual project using a shared link.
There are many examples on the web, but here's one that might help: http://blogs.msdn.com/b/jjameson/archive/2009/04/03/shared-assembly-info-in-visual-studio-projects.aspx.
I haven't used WiX for quite a while, but you should be able to inject the version number into the XML before you run through it through the WiX utilities to generate your package. If I remember correctly, WiX supports variables that you could pass in on the command line. Otherwise, you could do an automated replace of some magic string that you embed into the source XML. The first option would be more maintainable though.
Upvotes: 0