Matthias
Matthias

Reputation: 1436

TFS PowerShell Snapin: How To Read Team Foundation Workspace Version

  1. How to get the version of the workspace that we have locally.
  2. So basically what was the changeset number at the time of "Get Latest Changes" or "Advanced > Get Specific Version..."
  3. We need this in order to inject this information as version number for our application.

What we tried:

$history = Get-TfsItemHistory $SearchPath -Stopafter 1 -Recurse | Select ChangesetId

But it returns not the latest version we have in the workspace. It returns latest version from server.

So how can we get the team foundation workspace version with a similar command?

(Is there even a workspace version? Because it is possible that we locally do not have of all files the latest version. For example if there is a outstanding/pending merge.)

Some additional background information:

We do not have a build server yet. We create the release basically manually and execute that script manually in order to figure out changeset number and set into version info json file of our project.

Upvotes: 0

Views: 118

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

Add “-Version W" in the command:

$history = Get-TfsItemHistory $SearchPath -Stopafter 1 -Recurse -Version W | Select ChangesetId

Upvotes: 1

Related Questions