I have a .net solution to get a set of changesets into a TFS local workspace that are specified in a config file [values.xml]. Once the files associated to the changesets are downloaded to the local working folder associated with the workspace, I have a separate packaging script that creates a msi out of those files. The .net solution works fine, but usually. The problem arises under the following condition:
Say I have a changeset: C717171 which is associated to a change that I have done on web.config file. The config file [values.xml] lists this changeset in it which implies that the .net solution has to get this specific changeset into the TFS local workspace after which a separate packaging script will take over.
What actually happens is, the .net solution places all the web.config files that are in the repository along with the one that is required.
var changesets = vcs.QueryHistory(repository, VersionSpec.Latest, 0, RecursionType.Full, null, versionFrom, versionTo, Int32.MaxValue, true, false).Cast<Changeset>();
Workspace myworkspace = vcs.CreateWorkspace(workspaceName, tfsUser);
var workingFolder = new WorkingFolder(repository, workspacePath);
// create WorkingFolder and mapping
myworkspace.CreateMapping(workingFolder);
foreach (Changeset changeset in changesets.OrderBy(c => c.ChangesetId))
{
var version = new ChangesetVersionSpec(changeset.ChangesetId);
foreach (Change change in changeset.Changes)
{
myworkspace.Get(new[] { change.Item.ServerItem }, version, RecursionType.Full, GetOptions.Overwrite);
}
}
I may provide more details if required.