 <ol> <li>Have a Version table in the database</li> <li>Use a <a href="http://weblogs.asp.net/bradleyb/archive/2005/12/02/432150.aspx" rel="nofollow">custom MSBuild Task</a> to get the build number</li> <li>You can update a sql file with the <a href="http://benchmarkitconsulting.com/colin-stasiuk/2009/02/27/merge-statement-upsert-with-working-example/" rel="nofollow">'MERGE'</a> with build number using <a href="http://stackoverflow.com/questions/8658972/using-msbuild-i-want-to-update-a-config-file-with-values-from-teamcity">FileUpdate MSBuild community task </a></li> <li>Execute it as part of deployment.</li> </ol> <p>Now, you'll have same version number in both database &amp; your assemblies.</p>