3

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?

  • I'm not sure exactly what's going on here, but from my experience you need to have a .git directory (locally) for VS to treat it as Git. – TTT Jul 14 '22 at 20:19
  • Side Note, it sounds like you aren't trying to migrate the history from TFVC to Git, but, it's definitely possible to do it, with some effort. – TTT Jul 14 '22 at 20:23
  • According to [this question](https://stackoverflow.com/q/16824994/184546), the answers for adding a project to Git pretty much alternate between doing what you tried and my suggestion of creating the local Git repository first. Hehe. – TTT Jul 14 '22 at 20:32
  • Yeah I don't care about the history as I am the only developer at this point. I just want to push to the new repository, just can't figure out where a link exists between my local project folder and TFS. Once I push it to Git it should create all the git files but can't get to that point. – David Christian Jul 14 '22 at 20:41
  • 1
    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. It's too confusing. – David Christian Jul 14 '22 at 21:07
  • @DavidChristian, you could convert your comment as answer. This can be beneficial to other community members reading the answer, avoid spending a lot of time on a post that already has an answer. Thanks. – Leo Liu Jul 15 '22 at 09:03
  • @DavidChristian Please note that the centralized version control system in TFS is called **TFVC**, not "TFS". TFS is the platform that hosts TFVC and Git repositories. This isn't nitpicky, but an important distinction that provides clarity on exactly what your starting state is. – Daniel Mann Jul 15 '22 at 17:01

1 Answers1

1

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.