Visual Studio 2015新文件不会自动添加到源代码管理 [英] Visual Studio 2015 new files not being added to source control automatically

查看:384
本文介绍了Visual Studio 2015新文件不会自动添加到源代码管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到VS2015,遇到一个我以前从未见过的问题.使用源代码管理下的现有解决方案,我能够修改文件,它们会作为即将发生的更改被提取,以准备签入TFS.

I have just upgraded to VS2015 and I am experiencing an issue I have not seen before. Using an existing solution under source control, I am able to modify files and they get picked up as pending changes ready to check in to TFS.

但是,我添加了一个新文件(在此屏幕快照中以Test.cs为例),没有将其作为新文件使用.

However, I add a new file (Test.cs as an example in this screenshot), it is not picked up as a new file.

我需要右键单击它,然后单击将文件添加到源代码管理"

I am required to right-click it and click "Add files to Source Control"

这以前从来都不是问题.我希望将添加为新文件的所有内容作为未决的更改.我怎样才能做到这一点?在以前的Visual Studio版本中我从未见过.

This has never been an issue before. I would like everything I add as a new file to be picked up as a pending change. How can I make this happen? I have not seen this before in previous Visual Studio versions.

我可以确认此问题在另一台计算机上是否相同.另外,新文件也不会在促进候选者更改"中提取.

I can confirm that this issue is the same on another machine. Also, the new file is not picked up in "Promote Candidate Changes" either.

如果我随后单击将文件添加到源代码管理",则会收到此消息.

If I then click "Add file to Source Control", I get this message.

所选文件将被忽略.是否将其添加到源代码管理中?"

"The selected file is ignored. Add it to source control anyway?"

我的.tfignore文件仅具有忽略包的指令,因此我认为此文件不是问题.

My .tfignore file just has a directive to ignore packages, so I don't think this file is the problem.

如何使设置恢复正​​常?

How can I get my settings back on track?

更新:

我注意到,这仅发生在我的工作区的发布"分支上.所有其他分支的行为均符合预期.此外,如果我再选择一个分支"Release"并将其命名为"Release1",则问题将完全消失!

I have noticed that this only happens to the "Release" branch of my workspace. All other branches behave as expected. Furthermore, if I then take a branch "Release" and call it "Release1", the issue goes away entirely!

TFS中具有特定名称"Release"的分支是否具有任何特殊功能?

Do branches with the specific name "Release" take on any special functionality in TFS?

推荐答案

称为Release的文件夹及其内容自动从TFS中排除(以及Debug和许多文件类型).您可以通过创建.tfignore文件来覆盖特定的文件夹,如本

Folders called Release and their contents is automatically excluded from TFS (along with Debug and lots of file types). You can override this for particular folders by creating a .tfignore file, as detailed in the "Customize which files are ignored by version control" section of this link

自定义版本控制会忽略哪些文件

Customize which files are ignored by version control

默认情况下,某些类型的文件(例如.dll文件)为 被版本控制忽略.结果:

By default certain types of files (for example, .dll files) are ignored by version control. As a result:

当您将忽略的文件添加到本地映射的文件夹中时 工作空间,它们不会出现在团队的待更改"页面中 资源管理器.

When you add ignored files to folders that are mapped in a local workspace, they do not appear in the Pending Changes page in Team Explorer.

当您尝试使用添加到源代码管理"来添加忽略的文件时 对话框(例如,通过将其拖动到源代码管理"中) 资源管理器),它们会自动显示在排除的项目"标签中.

When you try to add ignored files using the Add to Source Control dialog box (for example by dragging them into Source Control Explorer), they automatically appear in the Excluded items tab.

您可以通过放置文本来配置忽略哪些类型的文件 您要应用规则的文件夹中名为.tfignore的文件.这 .tfignore文件的作用是递归的.但是,您可以创建 .tfignore文件在子文件夹中以覆盖.tfignore的效果 文件放在父文件夹中.

You can configure which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply. The effects of the .tfignore file are recursive. However, you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder.

.tfignore文件规则

.tfignore file rules

以下规则适用于.tfignore文件:

The following rules apply to a .tfignore file:

#开始注释行

*和?支持通配符.

除非使用\字符作为前缀,否则文件规范是递归的.

A filespec is recursive unless prefixed by the \ character.

!否定filespec(与模式匹配的文件不会被忽略)

! negates a filespec (files that match the pattern are not ignored)

.tfignore文件示例

.tfignore file example

忽略ProjA子文件夹及其所有子文件夹中的.cpp文件
ProjA * .cpp

Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA*.cpp

忽略此文件夹中的.txt文件
* .txt

Ignore .txt files in this folder
*.txt

忽略此文件夹及其所有子文件夹中的.xml文件
* .xml

Ignore .xml files in this folder and all its sub-folders
*.xml

忽略Temp子文件夹中的所有文件
\ Temp

Ignore all files in the Temp sub-folder
\Temp

请勿忽略此文件夹或其任何子文件夹中的.dll文件
!*.dll

Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll

这篇关于Visual Studio 2015新文件不会自动添加到源代码管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆