How can I use nant tasks to increment build versions? To be more specific how can I link this up with version numbers in assemblyinfo.cs?
You'll want to consider some sort of system for managing your version increments. One common way to do it is through continuous integration such as CruiseControl.NET. If you go this route, you can use a build target like this:
<target name="set.version" description="generates the version number">
<echo message="Setting the build version to ${CCNetLabel}..." />
<attrib file="AssemblyInfo.cs" readonly="false" />
<asminfo output="AssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
</imports>
<attributes>
<attribute type="AssemblyVersionAttribute" value="${CCNetLabel}" />
<attribute type="AssemblyFileVersionAttribute" value="${CCNetLabel}" />
</attributes>
</asminfo>
<attrib file="AssemblyInfo.cs" readonly="true" />
</target>
Where CCNetLabel is a dynamic property that is set from CruiseControl when it executes nant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With