Search code examples
gittfsvisual-studio-2022tfvc

How to move an existing Visual Studio solution from TFVC project to Git project on Azure DevOps?


Lately I have been moving all new projects to Git on my Azure DevOps site, but I am having a very difficult time figuring out how to move a solution/project that is currently on TFVC to a new Git project. I don't care to try to migrate my existing project, so I just created a new Git project on my DevOps account under a new name. Despite my best efforts, my existing solution always reverts back to TFS. I would just like to treat it like it is a brand new project and push all the code to my new repository. I have tried the following and somehow it ALWAYS manages to somehow restore all the binding to TFVC.

  1. Use File > Source Control > Advanced > Change Source Control and unbind the solution and projects.
  2. In my local folder I delete the $tf folder, delete *.vssscc and *.vspcc files
  3. Edited the .sln file and removed the "GlobalSection(TeamFoundationVersionControl)" section from the .sln file.
  4. Renamed by existing TFVC project in DevOps so it cannot be found.

After I perform all these steps I open my solution in VS thinking that now I can add the solution to my Git repository, but when I go to File > Source Control > Add Solution to Source Control or Change Source Control, it just restores all the connections back to my TFVC project, even finding the renamed project. What is the best way to accomplish this and make Visual Studio consider this solution not under any existing source control so I can basically start from scratch and push all my code to the new Git repository?


Solution

  • Ok I finally got it to work. I deleted the Visual Studio workspace associated with the solution (not sure if necessary), then in Team Explorer I connected to my new Git project on DevOps, then when I right-clicked on my Solution there was an option to Create Git Repository, then I selected "Existing Remote", pasted in my repository URL, and it pushed all my files. It would be nice if Microsoft made this process more seamless.