Search code examples
visual-studioazure-devopstfvc

VSTS source control bindings invalid after replacing directory with a backup


I changed a lot of files in one of my ASP.NET Solutions and checked-in. Afterwards I realized I wanted to role back to my original files. I am aware I could have just went to Source Control explorer and rolled back the changeset but I went about it wrong. Since I took a backup of my entire project directory prior to doing this I figured it would be easy to simply just replace the directory with my backed up files.

After replacing the entire directory with the backup and When I open the solution I get the following message:

One or more source control bindings for this solution are not valid and are listed below. Source control bindings can be modified by selecting File, Source Control, Advanced, Change Source Control from the main menu.

Then all of the .csproj files are listed below.

I followed the instructions that I saw on many websites saying unbind then rebind and it is not doing anything for me.

My first question is why did this happen if it is the same exact set of files that have all of the source control bindings.

My second question is how can I go about getting this backed up solution in source control again?

I expect it to be in source control showing me the pending changes so that when I check-in the latest version in source control will be my replacement version.


Solution

  • Unlike windows file system, you shouldn't simply copy and past the backup files. It will definitely cause source control binding conflicts as you encountered.

    You should use rollback entire changeset feature. This will influence your source control in TFS. If you roll back a file to an earlier version, tfs will eliminating the effect of all changesets that occurred after that version. More details please take a look at this tutorial: Roll back changesets

    Since you just need to go back the old version files, you could now roll back your changesets to the one you back up the entire project. Check in the roll back operation.

    Another way is as below if unbind/re-bind the project is not work:

    1. Unbind project in Change Source Control
    2. Unload project in Solution Explorer
    3. Reload project in Solution Explorer

    Note: If you use above option, the TFS consider all project files as newly added files to the solution.