Visual Studio 2015 添加的文件未在发布分支中自动添加到源代码管理

Visual Studio 2015 added files not being added to source control automatically in release branch

我们在 Visual Studio 2015 年更新 3 后注意到,添加到我们的解决方案中的任何文件或项目不再自动由源代码管理 (TFS) 获取:

Image of solution explorer showing missing "+" sign

当我们右键单击 Person.cs 文件和 select "Add files to Source Control" 时,我们得到以下对话框:

Image of source control dialog when trying to add file

我看到一些人谈论使用 .tfignore 文件来覆盖此行为,但我用这种方法完全没有成功。

如果能提供任何帮助,那就太好了。

这是已知行为,仅在 Visual Studio 2015 Update 3 时出现,名称为“Release”的分支.使用Visual Studio 2015 Update 2,一切正常

名为 Release 的文件夹,其内容自动从 TFS 中排除(连同调试和许多文件类型)。正如您的朋友所建议的那样,您也可以通过创建 .tfignore 文件来 覆盖 特定文件夹,详细信息请参考此 link:Customize which files are ignored by version control

Customize which files are ignored by version control

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.

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

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

For example:

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