TFS checkin error - could not find file
Asked Answered
T

5

130

When checking in my project I get the error:

Could not find file 'C\blah blah blah'.

I have a feeling this might be a file from an old project I deleted.

I have tried deleting my TFS connection and workspaces.

Thigmotaxis answered 11/9, 2013 at 20:37 Comment(1)
I had a similar error from having moved files in my work space. Resolved by removing the work space and creating a new one, then doing a get.Noctambulism
G
302

This will happen when TFS has some changes staged that no longer exist on the file system. For instance, if you add some files in Visual Studio (which adds them to the changes list), delete them directly from the file system, then attempt to check in the changes, it will complain that it could not find the file(s).

To remove these changes from the list, you can open Source Control Explorer (View > Other Windows > Source Control Explorer) and either Delete the nonexistent files or right-click on the offending files and Undo Pending Changes.

You can also undo these specific changes from the Pending Changes panel in Team Explorer.

Grisby answered 16/10, 2013 at 18:58 Comment(7)
Thanks for the great tip! I had a project that was deleted, but it was still showed in the Source Control Explorer. I could not find any way to delete directly from the Source Control Explorer. I right-clicked the project, then selected "Undo Pending Changes...", and it disappeared magically! I never expected that "undo pending changes" would remove the entire folder. TFS is unique in this regard.Calliopsis
Surely this should be the accepted answer. Much simpler than having to create a dummy file and then delete it. Especially when in my case I had over 1000 files that needed to be removed!Rapallo
@Grisby provided a better answer. You can fix this warning via TFS, without manual file manipulation. After adding a new Project and deleting an old Project from a Solution, I had a similar error. My fix: 1. Exclude the old project and (any related files with this warning) from check-in. 2. Check in your changes. 3. With Source Control Explorer, find the project you intend to delete. It's probably checked out. 4. Undo changes on that project. 5. Delete that old project. 6. Check in changes.Paste
This has also happened to me when I create a project of the wrong type (e.g., a console app instead of a test project), remove the project and then add a project of the same name with the correct type - all before I've checked anything in (i.e., it's a virgin solution). Either way, this is a good fix.Recrement
This is still an issue in 2017...this is idiotic. What the user intends is perfectly inferrable (he changed his mind and deleted in-between check-ins) and worst case could be handled by a confirmation dialog...Ferocity
Great answer. In my case, I created the same project 5 or 6 times testing out different VS project templates. Orphaned references to files from those deleted projects kinda got stuck in source control limbo, which wouldn't allow me to check in my project. Undo pending changes successfully cleared all the old cruft out.Allround
does anyone know how to conduct this automatically on TFS server? #54600356Strawn
C
27

Create an empty file to replace the missing file and complete your check-in. After you have checked in the file correctly delete the file that is not needed.

Christophe answered 11/9, 2013 at 20:42 Comment(6)
Done - Now how do i delete them "properly"Thigmotaxis
Delete the files by going into source control explorer in visual studio, find the files and right click delete. Check in the changes so the delete is persisted on the server. There are many helpful videos on youtube that can help with common source control tasks.Christophe
done - why do the folders still show-up grayed out in source control explorer - i want them gone forever.Thigmotaxis
Read up on the "destroy" functionality in TFS. This will make the files/folders gone forever.Suckow
This works, but if you deleted a directory that had dozens of files, then it might be a bit tedious.Moorish
Does anyone know how to conduct this on TFS server? #54600356Strawn
C
9

Go to the project that has file 'blah blah blah', you should see the file has an error mark indicating it does not exist. Right click the file > Delete. That should take care of the problem.

Calliopsis answered 1/10, 2013 at 21:46 Comment(0)
I
3

I had a similar problem. I had forgotten I was tinkering with adding publish profiles for publish. TFS felt it needed to check that in, even though the output wasn't there. I simply right clicked on the App.Publish folder in Team Explorer inside of visual studio and chose to exclude. Checked everything back in with no problem.

Irena answered 23/10, 2015 at 19:22 Comment(0)
O
-1

I encountered the same error: enter image description here

but my issue was a bit different. I was changing a couple of folder names and when committing I didn't add the new folders to the repo:

git add folderName

solved the issue for me.

Ozzy answered 5/9, 2018 at 12:24 Comment(1)
Downvoted. This is a question about TFS specifically, and you've answered with an answer about git, an entirely different piece of software.Divisible

© 2022 - 2024 — McMap. All rights reserved.