visual-studio 将新项目添加到 TFS 中的现有解决方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/234443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding a new project to an existing solution in TFS
提问by coder1
I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do I fix it? It's time to check in.
我将一个项目添加到当前使用 TFS 进行源代码控制的现有解决方案中,但由于某种原因我无法签入新项目。当我查看待处理的更改时,新项目中的任何文件都不显示。没有一个文件旁边有加号(对于新文件)。我做错了什么?我如何解决它?是时候入住了。
回答by Tomer Pintel
The problem is the solution has lost its binding. That's why it's not checking out automatically when you add the new project.
问题是解决方案失去了约束力。这就是为什么在您添加新项目时它不会自动检出的原因。
In order to restore the binding in VS 2010, go to File->Source Control->Change Source Control. Look for the "Solution: your solution name" and if it's not bound it will say "no server". Click on it and then click "Bind" from the toolbar.
要在 VS 2010 中恢复绑定,请转到 File->Source Control->Change Source Control。查找“解决方案:您的解决方案名称”,如果未绑定,它将显示“无服务器”。单击它,然后单击工具栏中的“绑定”。
in Visual Studio 2012/2013 it's File->Source Control->Advanced->Change Source Control (Thanks to danglund).
在 Visual Studio 2012/2013 中,它是 File->Source Control-> Advanced->Change Source Control(感谢 danglund)。
This should create a new vssscc file that is correctly bound. Now add the new project and everything should work correctly.
这应该创建一个正确绑定的新 vssscc 文件。现在添加新项目,一切都应该正常工作。
回答by Edge
I was also having the same problem, this is how I fixed it:
我也遇到了同样的问题,我是这样解决的:
Go to Visual Studion: File->Source Control->Change Source Control Find your project there, its status would be "Invalid", Click on it and press "Unbind". Now go back to Solution Explorer and Remove your project. Add this project again into the solution explorer solve the problem.
转到 Visual Studio: File->Source Control->Change Source Control 在那里找到您的项目,其状态为“无效”,单击它并按“取消绑定”。现在返回到解决方案资源管理器并删除您的项目。再次将此项目添加到解决方案资源管理器中解决问题。
Good Luck!
祝你好运!
回答by thiag0
- Click on the Team Project name in Source Control Explorer
- File -> Source Control -> Add Items to Folder...
- Follow the wizard.
- 单击源代码管理资源管理器中的团队项目名称
- 文件 -> 源代码管理 -> 将项目添加到文件夹...
- 按照向导操作。
回答by Cory Foy
Head over to Source Control Explorer and browse to the place in the tree which matches where the new project is at for your solution. Add the files there.
转到源代码管理资源管理器并浏览到树中与解决方案的新项目所在位置相匹配的位置。在那里添加文件。
However, I'd be concerned that you modified the solution file and it didn't ask you to check that out. What you may want to try doing is manually checking out the solution file, then readding the project to the solution and seeing if it takes then.
但是,我担心您修改了解决方案文件并且它没有要求您检查它。您可能想要尝试做的是手动检出解决方案文件,然后将项目读取到解决方案并查看是否需要。
You shouldn't need to drop to the command line - this is a pretty straightforward operation.
您不需要转到命令行 - 这是一个非常简单的操作。
回答by Geoff Cox
Open the solution. Select the project (make sure it is in the solution).
打开解决方案。选择项目(确保它在解决方案中)。
File -> Source Control -> Properties will bring up the binding dialog.
File -> Source Control -> Properties 将打开绑定对话框。
Bind the project to source control.
将项目绑定到源代码管理。
You should now see + signs next to all your files. The key is that that a .vssscc is added for your project to version control.
您现在应该会在所有文件旁边看到 + 符号。关键是为您的项目添加了 .vssscc 以进行版本控制。
If that fails, open your csproj in notepad (after making a backup), and ensure any version control bindings are removed, then try again.
如果失败,请在记事本中打开您的 csproj(备份后),并确保删除所有版本控制绑定,然后重试。
回答by thijs
- Make sure you get the latest version of the solution
- Check out the solution file
- Add the new project
- 确保您获得最新版本的解决方案
- 查看解决方案文件
- 添加新项目
If the newly added project was previously under (another) source control, that might mess things up, make sure to "unbind" it before adding it. (See source control bindings somewhere under the "file" menu in Visual Studio)
如果新添加的项目之前受(另一个)源代码控制,那可能会搞砸,请确保在添加之前“取消绑定”它。(请参阅 Visual Studio 中“文件”菜单下某处的源代码控制绑定)
You shouldn't need the command line.
您不应该需要命令行。
回答by Gabriel Isenberg
Unfortunately, I'd wager that your best bet is to manually do the check-ins through the command line. I've ran into situations where the Team Explorer UI grows out of sync with what's actually happening in source control, and manually fixing things through tf.exe was the only way to resolve it.
不幸的是,我敢打赌,您最好的选择是通过命令行手动进行签入。我遇到过团队资源管理器 UI 与源代码管理中实际发生的情况不同步的情况,通过 tf.exe 手动修复是解决它的唯一方法。
That said, normally, adding a new project to a solution isn't a hassle.
也就是说,通常,向解决方案添加新项目并不麻烦。
回答by Mik Kardash
TFS can simply do not know about your project existed. Just add your project files through Source Control Explorer and re-load the solution.
TFS 可以根本不知道你的项目存在。只需通过源代码管理资源管理器添加您的项目文件并重新加载解决方案。
While loading of a solution it can ask you to bind your project to source control. Let it do so by clicking Bind button - it should do all the magic for you.
在加载解决方案时,它可能会要求您将项目绑定到源代码管理。通过单击绑定按钮让它这样做 - 它应该为你做所有的魔法。

