本文翻译自:Get TFS to ignore my packages folder
I'm trying to get TFS (2013) to ignore my packages
folder. 我正在尝试让TFS(2013)忽略我的packages
文件夹。 I passionately don't want it source controlled as I'm using NuGet and it's great! 我热情地不希望它在我使用NuGet时受到源代码控制,这太棒了!
I've tried cloaking (doesn't seem to work), I've tried adding .tfignore
files - nothing is ignored. 我尝试了伪装(似乎不起作用),我尝试添加.tfignore
文件-不会忽略任何内容。 Why don't the TFS team just add an option to permanently ignore a folder or file like lots of the Subversion clients do?! 为什么TFS团队不像许多Subversion客户端一样添加一个永久忽略文件夹或文件的选项?
#1楼
参考:https://stackoom.com/question/1dIw9/让TFS忽略我的包裹文件夹
#2楼
You need to be using local workspaces for .tfignore
to work. 您需要使用本地工作区才能使.tfignore
正常工作。 The .tfignore
file must be in the folder that contains the files or folders you want to ignore. .tfignore
文件必须位于包含要忽略的文件或文件夹的文件夹中。
So if your solution structure looks like this: 因此,如果您的解决方案结构如下所示:
\Project
\Packages
\OtherStuff
foo.cs
You'd put your .tfignore file in \\Project: 您将.tfignore文件放在\\ Project中:
\Project
\Packages
\OtherStuff
foo.cs
.tfignore
The contents of the .tfignore in your case would be: 您情况下的.tfignore内容为:
\\packages
Here's some documentation for you: http://msdn.microsoft.com/library/vstudio/ms245454(v=vs.110).aspx#tfignore 这是为您提供的一些文档: http : //msdn.microsoft.com/library/vstudio/ms245454(v=vs.110).aspx#tfignore
#3楼
将您的解决方案设置为在构建时还原,软件包文件夹和软件包文件将被检入,但软件包不会被检入。
#4楼
If you are using Git with TFS you need to add a ".gitignore" file. 如果将Git与TFS一起使用,则需要添加“ .gitignore”文件。 You can do this in "team project | Settings | 'add ignore file'". 您可以在“团队项目|设置|'添加忽略文件'”中执行此操作。 Then open the file and uncomment the built in ignore statement for Nuget Packages. 然后打开文件,并取消注释Nuget Packages的内置ignore语句。
If you are using TFVC and you have Local Workspaces configured you can use the ".tfignore" file that honours an identical format to the Git file. 如果使用TFVC,并且配置了本地工作区,则可以使用“ .tfignore”文件,该文件采用与Git文件相同的格式。 I think you need "packages/". 我认为您需要“ packages /”。
#5楼
Add a nuget.config file in a .nuget folder in your solution. 在解决方案的.nuget文件夹中添加nuget.config文件。 Add the following to the nuget.config file: 将以下内容添加到nuget.config文件中:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
The disableSourceControlIntegration is what makes the trick for TFS Version Control. disableSourceControlIntegration是TFS版本控制的窍门。
#6楼
Terje's answer doesn't work all the time for me, sometimes it will work for a while, but then it will pend a load of "adds" for me all over again. Terje的答案并非一直都对我有用,有时会持续一会儿,但随后又会给我带来很多“增加”的负担。
The only way I have found to solve this permanently is to Cloak the packages folder in my Workspace. 我找到永久解决此问题的唯一方法是在Workspace中隐藏“ packages”文件夹。
For example: 例如:
Type Server Local
============================================
Active $/Work/Main C:\Code\Main
Cloaked $/Work/Main/Packages