How to unlock a file from someone else in Team Foundation Server

Here’s what I do in Visual Studio 2012 (Note: I have the TFS Power Tools installed so if you don’t see the described options you may need to install them. http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f ) If you are accessing the Source Control Explorer as a team project administrator (or at least someone with the “Undo other users’ changes” … Read more

PowerShell script to check an application that’s locking a file?

You can do this with the SysInternals tool handle.exe. Try something like this: PS> $handleOut = handle PS> foreach ($line in $handleOut) { if ($line -match ‘\S+\spid:’) { $exe = $line } elseif ($line -match ‘C:\\Windows\\Fonts\\segoeui\.ttf’) { “$exe – $line” } } MSASCui.exe pid: 5608 ACME\hillr – 568: File (—) C:\Windows\Fonts\segoeui.ttf …

How to check for file lock? [duplicate]

When I faced with a similar problem, I finished with the following code: public class FileManager { private string _fileName; private int _numberOfTries; private int _timeIntervalBetweenTries; private FileStream GetStream(FileAccess fileAccess) { var tries = 0; while (true) { try { return File.Open(_fileName, FileMode.Open, fileAccess, Fileshare.None); } catch (IOException e) { if (!IsFileLocked(e)) throw; if (++tries … Read more