7

I have to add my solution to TFS, in Visual Studio 2013, when I click on Check-In button in Team Explorer window, I get this error message:

C:\Projects\2013\MyCompany.MySolution\MyProject\adminpages\images\someimage.gif: The process cannot access the file because it is being used by another process

Obviously I checked if this file is being used by another process, using Process Explorer and LockHunter, but nothing was found. Im curious why these files, they are not used anywhere.

Any idea what it could be? because of this stupid error I can't check-in the solution to TFS.

Thanks.

monstro
  • 6,254
  • 10
  • 65
  • 111
  • That usually means the file is open in an application. Sometimes this can be another application (e.g. Word and Excel keep files open while editing them), but often it can be Visual Studio itself. The first thing to try is quitting & restarting Visual Studio, or if that fails, rebooting your PC, to ensure that whatever process has the files open is killed. (I know you can't see the file handle being held in LockHunter, but that doesn't really prove anything) – Jason Williams Sep 04 '14 at 20:31
  • Did all that. No apps running, no apps using that file. Restarted, rebooted... Nothing helps.No apps using that file, no processes use that file. That file is nothing, not even used anywhere. I can actually delete that file with no problems. The problem is that I have to do solution check-in, and I cant. It's not just that file, there are others, randomly ;(( – monstro Sep 04 '14 at 22:35
  • can you close the solution and then check in from pending changes or the source control explorer? – Jason Williams Sep 05 '14 at 12:44
  • I have the same problem, usually with my Global.asax file. – Paul Fryer Oct 29 '14 at 16:26

2 Answers2

0

I also encountered this issue and tried several things such as restarting VS and even my machine but the only solution that worked (more like work-around) is checking in using another visual studio such as 2012.

MichaelChan
  • 1,808
  • 17
  • 34
-1

At times, VS can disagree with what you are checking in based on what it sees in your solution/projects. I have seen this from time to time when creating a new project and moving files around underneath Visual Studio (ie. without using the interface inside VS).

Here's how I would correct the issue:

Save your project and close Visual Studio 2013. Open a 'Developer Command Prompt for VS2013' and cd to the folder containing your solution. Issue the following commands:

tf add /recursive .
tf checkin /recursive .

then, copy your original source elsewhere:

robocopy /MIR . C:\Temp\Original

then, remove the current source and re-get from TFS

cd ..\
rmdir /s /q <foldername>
tf get /force /recursive <foldername>

Open your solution and ensure everything works properly. Correct issues as you encounter them using the 'backup' you robo-copied earlier if necessary.

d3r3kk
  • 3,465
  • 3
  • 18
  • 22