• What about adding a statement from TFS using the tf.exe to get the the version of the project, add that to a variable and pass that variable into the command line that does the build & deploy? I'm not sure of the specific syntax to do that, but I think the command prompt properties will work:

    tf properties project /version

    I'd have to do some experimentation to find the precise mechanism to capture it into a variable, but once you have it, you'd just run the build & deployment like this:

    msbuild my.dbproj /t:sqlbuild /p:Configuration="myconfig";TFSVersion=OutputVariable

    msbuild my.dbproj /t:sqldeploy /p:Configuration="myconfig";TFSVersion=OutputVariable

    Then you can set the database property in one of the post-deployment scripts like this:

    exec sys.sp_addextendedproperty @name = N'TFSVersion', @value = $(TFSVersion)

    That will capture and put it into the completion of each build. You may have to adjust for incremental builds (look to see if the property is there first, update it if it is, add it if it isn't). But that should get you what you need.

    All this assumes you're using the full on Team Edition for Database Professionals and not simply adding a database project (two totally different things) into TFS.

    The more I think about this, I may add this to our process...

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning