You need to rebuild your code as it was at a specific point in history (by a label or a changeset)?
With TFS 2005 you would have needed to change the core implementation of Team Build.
See Aaron Hallberg's "Building a Specific Version with Team Build" blog.
But with TFS 2008 Microsoft already put this logic in, and even gave a GUI to use it:
Go to Team Explorer 2008 --> Builds.
Right click the Build definition you want to build.
click Queue New Build.
On the pop up window in MSBuild command-line arguments (optional) write:
Where version is the Versionspec by the following syntax:
Hope it will help someone.