简体   繁体   English

如何将现有的 Visual Studio 解决方案从 TFVC 项目移动到 Azure DevOps 上的 Git 项目?

[英]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.最近我一直在我的 Azure DevOps 站点上将所有新项目移动到 Git,但我很难弄清楚如何将当前在 TFVC 上的解决方案/项目移动到新的 Git 项目。 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.我不想尝试迁移我现有的项目,所以我只是在我的 DevOps 帐户上以新名称创建了一个新的 Git 项目。 Despite my best efforts, my existing solution always reverts back to TFS.尽管我尽了最大努力,但我现有的解决方案总是恢复到 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.我已经尝试了以下方法,它总是设法以某种方式恢复所有与 TFVC 的绑定。

  1. Use File > Source Control > Advanced > Change Source Control and unbind the solution and projects.使用 File > Source Control > Advanced > Change Source Control 并取消绑定解决方案和项目。
  2. In my local folder I delete the $tf folder, delete *.vssscc and *.vspcc files在我的本地文件夹中,我删除了 $tf 文件夹,删除了 *.vssscc 和 *.vspcc 文件
  3. Edited the .sln file and removed the "GlobalSection(TeamFoundationVersionControl)" section from the .sln file.编辑 .sln 文件并从 .sln 文件中删除“GlobalSection(TeamFoundationVersionControl)”部分。
  4. Renamed by existing TFVC project in DevOps so it cannot be found.由 DevOps 中现有的 TFVC 项目重命名,因此无法找到。

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.执行完所有这些步骤后,我在 VS 中打开我的解决方案,认为现在我可以将解决方案添加到我的 Git 存储库,但是当我转到 File > Source Control > Add Solution to Source Control 或 Change Source Control 时,它只会恢复所有连接回我的 TFVC 项目,甚至找到重命名的项目。 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?完成此任务并让 Visual Studio 考虑此解决方案不受任何现有源代码控制的最佳方法是什么,以便我基本上可以从头开始并将所有代码推送到新的 Git 存储库?

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.我删除了与解决方案关联的 Visual Studio 工作区(不确定是否有必要),然后在团队资源管理器中我连接到 DevOps 上的新 Git 项目,然后当我右键单击我的解决方案时,有一个创建 Git 存储库的选项,然后我选择了“现有远程”,粘贴在我的存储库 URL 中,它推送了我所有的文件。 It would be nice if Microsoft made this process more seamless.如果微软让这个过程更加无缝,那就太好了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM