Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In my latest project I solved this problem by using several tools, SVN, NAnt, and a custom NAnt task. </p> <ol> <li>Use NAnt to execute <code>svn info --xml ./svnInfo.xml</code></li> <li>Use NAnt to pull the revision number from the xml file with <code>&lt;xmlpeek&gt;</code></li> <li>Use a custom NAnt task to update the AssemblyVersion attribute in the AssemblyInfo.cs file with the latest with the version number (e.g., major.minor.maintenance, revision) before compiling the project.</li> </ol> <p>The version related sections of my build script look like this:</p> <pre><code>&lt;!-- Retrieve the current revision number for the working directory --&gt; &lt;exec program="svn" commandline='info --xml' output="./svnInfo.xml" failonerror="false"/&gt; &lt;xmlpeek file="./svnInfo.xml" xpath="info/entry/@revision" property="build.version.revision" if="${file::exists('./svnInfo.xml')}"/&gt; &lt;!-- Custom NAnt task to replace strings matching a pattern with a specific value --&gt; &lt;replace file="${filename}" pattern="AssemblyVersion(?:Attribute)?\(\s*?\&amp;quot;(?&amp;lt;version&amp;gt;(?&amp;lt;major&amp;gt;[0-9]+)\.(?&amp;lt;minor&amp;gt;[0-9]+)\.(?&amp;lt;build&amp;gt;[0-9]+)\.(?&amp;lt;revision&amp;gt;[0-9]+))\&amp;quot;\s*?\)" value="AssemblyVersion(${build.version})" outfile="${filename}"/&gt; </code></pre> <p>The credit for the regular expression goes to: <a href="http://code.mattgriffith.net/UpdateVersion/" rel="nofollow noreferrer">http://code.mattgriffith.net/UpdateVersion/</a>. However, I found that UpdateVersion did not meet my needs as the pin feature was broken in the build I had. Hence the custom NAnt task.</p> <p>If anyone is interested in the code, for the custom NAnt <code>replace</code> task let me know. Since this was for a work related project I will need to check with management to see if we can release it under a friendly (free) license.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload