Over a million developers have joined DZone.

MSBuild.Community.Tasks To Format Assembly Version As Current Date With Build Number So Far Today

This will format your assembly version as ....

To do this, we grab the Year, Month, and Day from a Time task (to correspond with Major, Minor, Build).  Then we use a Version task to automatically create a Build number and Revision number.  You would think that we could get by specifying the Build number as created by the Time task, but as it turns out, the Version task doesn't seem to check the Build number for the BuildIncrement unless the Version task is actually generating the Build number as well.


This will create a file in Properties\version.txt that the Version task will use to keep track of the number of builds in a given day, and it will create Properties\VersionInfo.cs that will contain your assembly version declarations -- so you'll need to delete those lines from AssemblyInfo.cs.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}