Visual Studio 源代码管理:工作目录放在哪里?
我的任务是为某些 Visual Studio 2010 解决方案设置源代码管理。默认情况下,VS 将其项目放入“My Documents\Visual Studio 2010\Projects”,该映射到“C:\Documents and Settings[用户名]\My Documents\Visual Studio 2010\Projects”之类的内容。
当从源代码管理中检查解决方案时,大多数人是否在此目录中创建一个工作文件夹并从那里开始工作? (这将导致每个开发人员都有不同的工作目录。)或者他们是否让每个开发人员在每台计算机上设置相同的工作文件夹(例如“C:\dev\projects”)?
对于这种情况,最佳做法是什么?
I've been tasked with setting up source control for some Visual Studio 2010 solutions. By default, VS puts its projects into "My Documents\Visual Studio 2010\Projects" which maps to something like "C:\Documents and Settings[user name]\My Documents\Visual Studio 2010\Projects".
When checking out a solution from source control, do most people create a working folder here in this directory and work from there? (This would cause every developer to have a different working directory.) Or do they have each developer setup an identical working folder on each machine (e.g. "C:\dev\projects")?
What is the best practice for this situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我建议在驱动器根目录下使用一个短名称的文件夹,例如“C:\Projects”或“D:\Code”。文件路径限制为 260 个字符。在您开始之前,“我的文档”位置就会让您瘫痪。
其次,使源代码中的所有路径/引用相对。然后,您可以将代码放在“C:\Code”中,或者通过简单地编辑工作区映射将其移动到“D:\Work”。这对于允许您构建代码库的历史版本并将它们与当前版本放在一起(有时很方便)或在构建服务器上构建代码,或者在开发人员无法将其代码放在与代码库完全相同的位置的情况下至关重要你先把它放了。 (例如,当他们在 C: 上的空间不足并且必须移动到 D: 时)
此外,尝试为所有开发人员提供通用路径(例如“代码”:但根据需要允许使用不同的驱动器号)。这使得开发人员可以跳转到彼此的电脑并轻松查找内容,并允许您在防病毒服务器上设置固定的防病毒排除文件夹,这样您的构建时间就不会受到影响。
I'd recommend a folder with a short name at the root of a drive, e.g. "C:\Projects" or "D:\Code". File paths are limited to 260 characters. The "My Documents" location cripples you before you even start.
Secondly, Make all paths/references within your source code relative. Then you can put the code in "C:\Code" or move it to "D:\Work" by simply editing your workspace mapping. THis is vital for allowing you to build historical versions of your codebase and keep them alongside current ones (handy sometimes) or to build the code on a build server, or in cases where developers can't put their code in exactly the same place as you first put it. (e.g. when they run out of room on C: and have to move to D:)
Also, try ot have a common path for all developers (e.g. "Code": but allowing a different drive letter as necessary). This allows devs to jump onto each others PCs and find stuff easily, and allows you to set up fixed antivirus exclusion folders on your antivirus server so that your build times aren't crucified.
您可以将工作文件夹放在任何地方。在 Visual Studio 项目中,保留所有相对路径,因此工作文件夹并不重要。我猜大多数开发人员都是在他们的工作文件夹中工作的。
解决方案文件 (.sln) 以这种方式工作,因此您可以将解决方案复制粘贴到任何位置,并且文件仍然有效。源代码管理也不应该关心解决方案所在的位置,并且相对于解决方案基文件夹工作。
就我个人而言,我将工作文件夹移动到一个单独的数据驱动器,位于 D:\Projects\,但这实际上取决于每个开发人员的偏好。
You can put your working folder anywhere. In Visual Studio projects, you keep all paths relative so the working folder doesn't matter. I'd guess most developers work out of their working folder.
Solution files (.sln) work in this manner, so you can copy-paste a solution anywhere and the files still work. Source control also should not care where the solution is located, and works relative to the solution base folder.
Personally, I moved the working folder to a separate data drive, at D:\Projects\, but it really comes down to each developer's preference.
我不确定“最佳”做法是什么,但我的 c:\ 驱动器上有一个 vss 文件夹,我将其用作工作文件夹的父文件夹。
并不是每个人都喜欢在硬盘上处理源代码,因此他们会转而访问他们的个人网络文件夹,但由于 MS 和 SQL Server 安全性,我无法使其正常工作。
I'm not sure what the 'best' practice is, but I have a vss folder on my c:\ drive I use as the parent for my working folders.
Not everyone likes working on source code on their hard drive, so they'll go to their personal network folder instead, but with MS and SQL server security, I haven't been able to get that to work.
在我的公司中,我们有一个 D:\ 来存放源文件和解决方案文件。
In my firm we have a D:\ where we put our source and solution files.