Web project rename, csproj lost TFS binding

Go To StackoverFlow.com

0

I renamed a web project in VS2010 and checked in.

In Team explorer the csproj file was not renamed, hence my colleague got an unable to load exception. He fixed the path but now the project loads but on both our machines the lock icon next to the renamed web project isn't there anymore although it's constituent files still seem to be tracked via tfs. It seems the bindings have been corrupted for the csproj only.

We have tried

  • Unbinding/rebinding in File > Source Control > Change Source Control
  • Removing the project, deleting .suo file and adding existing project

No other projects in the solution are affected.

Is there a fix for this that doesn't involve recreating the project and copying over. I don't want to lose all our edit history.

2012-04-04 00:43
by madcapnmckay
How did you rename? in the file explorer or in the VS UI - KMoraz 2012-04-04 09:42
@KMoraz - I renamed within the VS solution explorer - madcapnmckay 2012-04-04 14:36
Although the question and corresponding answers are a bit dated already, for further reference, I'd like to add that renaming stuff in the Source Control Explorer directly (instead of in Solution Explorer / Navigator) tends to work better, and prevents TFS from getting "out of sync" with your changes - Dr. Tim dos Santos 2012-10-05 09:35


0

OK I managed to solve this. Thanks for the other responses, unfortunately I had actually edited the name through VS solution explorer. The fix however required some manual intervention.

I noticed that I had a pending change on the .sln .vssscc file. If i exited VS, undid the change and then reopened the solution the project in question briefly appeared to be picked up by TFS and then these two file appeared again in my pending changes list and it again disappeared.

For people who experience this in the future. The solution was.

  • Undo all changes, I did get specific version and overwrote everything.
  • In Team explorer, add the csproj back manually using the "Add items to folder" button
  • I edited the csproj name back to the original
  • Deleted the solution .suo file
  • Opened the .sln file in a text editor and changed all paths/names to be correct with the old name
  • Opened the solution & crossed my fingers.

Hope this helps someone. Curse be to TFS!

2012-04-04 16:02
by madcapnmckay


0

From your story I can assume that you rename the project from the windows explorer outside the Visual Studio and in this case the TFS will not feel with this change and make your problem. Always do any edit from Visual Studio.

To fix this you will need to rename the file to the old one with the same way you do in the first time and rename again in the Visual Studio, the good news that TFS 11 Beta will support changes outside the Visual Studio through introducing a new feature which is local workspace.

2012-04-04 10:46
by Mohamed.Radwan -MVP
Nope I renamed in VS - madcapnmckay 2012-04-04 14:36


0

I know this is an old question but there is actually a better way to fix this.

All you have to do is to go on Team Explorer and check and then on the Excluded Changes section, then click on Detected add(s). There you can find the renamed csproj and add it to tfs manually.

enter image description here

2016-07-20 08:08
by Manos Pasgiannis