How do I restore a linked file using a changeset?

I want to call the build only when a specific file is installed. So I need a way to access the associated filename from the changeset from the build tfs script, so I can check the condition before starting the build,

Was there any tf.exe related commands like tf properties, tf get help? I know it cannot be retrieved from the Exec task in the build script.
How should I do it?

+2


source to share


1 answer


This will take some work, as Team Build assumes that the set of files that are tracked for changes and the set of files you want to load (the build workspace) are the same thing. I would write a custom msbuild task . Basic steps:

  • Get the local version of a special file using GetExtendedItem ()
  • Compare it to the version recorded in the previous successful build (keep this information in the registry or perhaps some hardcode)
  • If the versions are the same, cancel the build
  • If not, continue building
  • If the build succeeds, update the registry


Besides GetExtendedItem () [this is the API that the tf prop calls by the way], other information that might be useful for such a task is the most recent changeset contained in the workspace. To get this efficiently, use QueryHistory instead, passing WorkspaceVersionSpec for both Versions and Version To. Equivalent to: tf hist $ / - r -version: W ~ W

+2


source







All Articles