我应该将Visual Studio 2015 .vs文件夹添加到源代码管理中吗?

本文翻译自:Should I add the Visual Studio 2015 .vs folder to source control?

Visual Studio 2015 creates a new folder called ".vs". Visual Studio 2015创建一个名为“.vs”的新文件夹。 What is the purpose of it and should I add it to source control? 它的目的是什么,我应该将它添加到源代码管理中吗?


#1楼

参考:https://stackoom.com/question/29l9p/我应该将Visual-Studio-vs文件夹添加到源代码管理中吗


#2楼

Github provides alot of .gitignore templates. Github提供了很多.gitignore模板。 In their template for visual studio they have ignored the .vs folder. 在他们的visual studio模板中,他们忽略了.vs文件夹。 Snippet from the template on github . 来自github模板的片段。

# Visual Studio 2015 cache/options directory
.vs/

#3楼

No, you should not add it to source control. 不,您不应将其添加到源代码管理中。 The purpose of this folder is to move machine- and user-specific files to a central location. 此文件夹的目的是将计算机和用户特定的文件移动到中心位置。 The explanation on the Visual Studio User Voice issue explains it well: Visual Studio用户语音问题的解释很好地解释了它:

So far, we have moved the .SUO file and the VB/C# compiler IntelliSense database files to the new location. 到目前为止,我们已将.SUO文件和VB / C#编译器IntelliSense数据库文件移动到新位置。 All new project specific, machine local files will be added to the new location too. 所有新的项目特定的机器本地文件也将添加到新位置。 We plan on taking this even further in future releases and are investigating how to improve the directory structure of build output and other existing files that can clutter the source tree. 我们计划在将来的版本中更进一步,并正在研究如何改进构建输出的目录结构以及可能使源树混乱的其他现有文件。

These are all files that you would never check in, since they are generated from a build or contain machine-specific information. 这些是您永远不会签入的文件,因为它们是从构建生成的或包含特定于机器的信息。


#4楼

As described in the quote taken from uservoice in Patrick's answer, the folder is not intended for source control. 如Patrick的回答中uservoice所引用的引用中所述,该文件夹不用于源代码管理。

However like comments also point out, there can be some cases where you would want to include specific files from the folder. 但是 ,评论也指出,在某些情况下,您可能希望包含该文件夹中的特定文件。

I would add this to .gitignore: 我会将此添加到.gitignore:

.vs/

And then use whatever git tool you prefer to add certain files like a shared configuration of the applicationhost.config if needed. 然后根据需要使用您喜欢的任何git工具添加某些文件,例如applicationhost.config的共享配置。

Or use a git command like this: 或者像这样使用git命令:

git add -f .vs/config/applicationhost.config

This way git adds the file, even if it is ignored. 这样git就会添加文件,即使它被忽略了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值