July 18, 2018

Editing a File’s Previous Version in TFVC

Disclaimer: I imported this post from WordPress to Jekyll on 9/2/23. Forgive the misformatting until I get a chance to clean it up.

Pain Point

On occasion, I have wanted to grab a specific non-latest version of a file from TFVC and fiddle around in it in a local workspace to test a theory. There are lots of ways to get a specific version of a file, folder, or entire branch in Visual Studio. However, whenever you start to edit a previous version of a file, Visual Studio automatically checks out the latest version of the file.

Solution

The fix (read workaround) is to check out the file manually before getting a previous version of it rather than relying on the Check out automatically options.

Configurable Option

It seems like it would be simple to have an option to toggle whether Check out automatically gets the latest version of the file or keeps the current version. Maybe that is an option, but I have not been able to find it.

There is the option below at Tools -> Options -> Source Control -> Visual Studio Team Foundation Server, but it does not seem to have any effect on a local workspace.

Get latest version of item on check-out in a server workspace

Environment

My team is using Visual Studio Enterprise 2017 and Team Foundation Server 2015.

via StackOverflow