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

查看:18
本文介绍了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.

我可以确认这个问题在另一台机器上是一样的.此外,Promote Candidate Changes"中也不会选取新文件.

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!

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

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:

当您将忽略的文件添加到本地映射的文件夹时工作区,它们不会出现在 Team 的 Pending Changes 页面中探索者.

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.

当您尝试使用添加到源代码管理"添加忽略的文件时对话框(例如通过将它们拖到源代码管理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:

# 开始注释行

* 和 ?支持通配符.

The * and ? wildcards are supported.

除非以 字符为前缀,否则文件规范是递归的.

A filespec is recursive unless prefixed by the character.

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

! 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天全站免登陆