I'm having trouble finding what built-in mechanisms there are in the .NET framework for setting version information at build time. Our development efforts are primarily directed at a WinForms application deployed with ClickOnce. For this, we already have a system in-place and working. I would like to try to extend what we already have to work with a few ASP.NET MVC projects.
Before our CI server starts building our WinForms application, we open up the .csproj file and tweak some values based on our CC.NET build number and the current SVN revision. Major and minor version numbers are hand-set in a config file.
changeNodeValue('ApplicationVersion', version) // Version like "1.0.111.2222"
changeNodeValue('ApplicationRevision', revision) // SVN Revision like "2222"
So, we have something like this in a shared library.
if (ApplicationDeployment.IsNetworkDeployed)
return ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
else
return "development";
This naturally works fine in our WinForms application. Calling this method from an application not deployed by ClickOnce (our web projects) always returns "development".
Is there a way I can do the same sort of thing for our ASP.NET MVC applications, i.e., tweaking project files or build arguments to supply a version number to .NET?