使用 TFS 时使用解决方案资源管理器与使用源代码管理资源管理器
尝试使用 TFS 2010 时,我对在 Visual Studio 2010 中处理文件的本地副本时使用哪个选项感到困惑:解决方案资源管理器或源代码控制资源管理器。
解决方案资源管理器是执行此操作的更自然的方式(至少对于像我这样的初学者来说),但使用源代码管理资源管理器似乎更方便和高效。还有更多可用选项,但单击文件您仍然会打开它的本地副本。
使用一种方法相对于另一种方法有什么优点?
我还应该去File =>打开=>项目/解决方案或者我应该更好地使用团队资源管理器=>源代码管理(似乎更快)?
在什么情况下使用解决方案资源管理器显然是更好(甚至是唯一)的选择?
Trying to use TFS 2010, I got confused with what option to use when working with local copies of files in Visual Studio 2010: Solution explorer or Source control explorer.
The Solution explorer is a more natural way of doing this (at least for starters like me) but using Source control explorer seems to be more convenient and productive. There are more options available, but clicking a file you still opens the local copy of it.
What are advantages of using one approach over the other?
Should I still go File => Open => Project/Solution or should I better use Team Explorer => Source Control (it seems even faster)?
What are situations when using Solution explorer is obviously better (or even the only) option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案资源管理器用于处理解决方案,即用于开发。当您从解决方案资源管理器打开文件时,您正在打开项目的一部分 - VS 会考虑从该文件中应该可见哪些程序集、命名空间等,从而为您提供智能感知。此外,解决方案资源管理器上的上下文菜单针对的是开发过程 - 请注意所有这些“构建”、“重建”、“设置为启动项目”等。
当您在解决方案资源管理器中查看解决方案时,您只能看到源代码中使用的那些部分,我的意思是编译的文件、资源等。此外,可能存在一种情况,您将文件包含在解决方案,但不包含在源代码管理中,唯一可以看到它的地方是在解决方案资源管理器中。
另一方面,源代码控制资源管理器用于使用源代码控制。它允许您在存储库中添加和删除文件、签入和签出、更新等。它与开发过程直接无关 - 例如源代码管理浏览器不会给您机会编译任何东西。在源代码管理资源管理器中打开文件会将其作为单个文件打开 - 是的,它仍然是可编辑的,但它现在不涉及上下文,不会为您提供智能感知等。
当您在源代码管理资源管理器中查看源代码时,您并不局限于单个解决方案。想象一下当您在源代码管理中还有包含项目文档(规格、模型)的文件夹时的情况。您可能不知道将它们包含在您的解决方案中,但您仍然需要以某种方式控制它们 - 在源代码管理中更新它们的版本,添加新版本等等。当您在解决方案资源管理器中时这是不可能的,因为您看不到解决方案本身之外的任何内容。因此,您可以使用这些文件的唯一地方是源代码管理资源管理器。
总而言之,解决方案资源管理器用于处理源代码,即用于开发,源代码控制资源管理器用于处理存储库。
Solution explorer is for working with solution, that is for development. When you are opening file from Solution explorer, you are opening a part of your project - VS takes into account what assemblies, namespaces etc. should be visible from this file, which gives you intellisense. Furthermore, context menus on Solution explorer are targeted at development process - notice all these "Build", "Rebuild", "Set as start up project" and so on.
When you are viewing your solution in Solution explorer, you see only those parts that are used in source code, I mean compiled files, resources etc. Moreover there might be a situation when you will have file included in the solution, but not included in source control, and the only place where one can see it is in Solution explorer.
Source control explorer on the other hand is for working with source control. It allows you adding and removing files in repository, checking in and checking out, updates etc. It has nothing to do with the development process directly - for example Source control explorer won't give you an opportunity to compile anything. Opening file in Source control explorer opens it as a single file - yes, it is still editable, but it does not now about the context, does not give you intellisense and so on.
When you are viewing your sources in Source control explorer, you are not limited to the individual solution. Imagine the situation when you have also folder with project documents (specs, mockups) in source control. You might not what to include them in your solution, but you still need to control them somehow - update their versions in source control, add new ones and so on. It is not possible while you are in Solution explorer, since you cannot see anything beyond the solution itself. Therefore the only place where you can work with these files is Source control explorer.
To sum up, Solution explorer is for working with source code, that is for development, Source control explorer is for working with repository.
当您在本地执行某些工作时,通常会使用解决方案资源管理器。您将签出您的文件,进行任何您想要的更改并签入文件。但有时从解决方案探索中获取最新版本可能会很棘手。最好使用源代码管理浏览器来获取最新版本的文件。因此,就我而言,我每天开始要做的第一件事是使用源代码管理资源管理器获取最新文件,然后全天使用解决方案资源管理器与 TFS 交互。
Solution explorer is normally used when you are doing some work locally. You will check out your file do whatever changes you want and check in the file. But getting latest version from solution explore can be tricky some times. Source control explorer should preferably be used to take latest version of files. So in my case, the first thing that I will do start of the day is use source control explorer to get latest files and then use solution explorer throughout the day to interact with TFS.