tfIgnore does not work for me in Visual Studio 201

2019-01-14 15:28发布

I am pulling my hair out with trying to get tfIgnore to work in Visual Studio 2013.

I followed the instructions here: bottom of this article and excluded my packages file like this:

\folderA\folderB\packages 

The path looks fine and is what Visual Studio generated for me. I have checked the file in to the place where Visual Studio generated it and tried rebuilding but the packages all still appear in my included changes folder in pending changes.

I've tried all sorts of other combinations of file locations and filespec commands but it never seems to do anything.

Am I missing something obvious?

Thanks

6条回答
淡お忘
2楼-- · 2019-01-14 15:36

In pending changes, right click the root package folder -> click undo. You should see your changes move to the "Detected changes" dialog box, under excluded changes (the window where you can promote files into source control).

Now, open up .tfignore and simply add packages. You should see that now, when you open detected changes, your packages aren't displayed.

查看更多
不美不萌又怎样
3楼-- · 2019-01-14 15:38

If the file or folder(s) you want to ignore changes to are checked-in to TFS, then ignoring them in .tfignore won't do anything - you have to remove them from source control first. That way any changes to them will be ignored.

查看更多
倾城 Initia
4楼-- · 2019-01-14 15:39

A bug in NuGet may be causing the problem. This is the workaround:

  1. Create a .nuget folder in your solution folder, if it doesn't exist.

  2. In the .nuget folder, create a file nuget.config with this content:

<configuration>
    <solution>
        <add key="disableSourceControlIntegration" value="true" />
    </solution>
</configuration>
查看更多
在下西门庆
5楼-- · 2019-01-14 15:39

Looks like someone called "aheidebrecht" is trying to provide a NuGet package to keep NuGet packages from checking into TFS. Seems a bit perverted...

In package manager console run...

PM> Install-Package DisableSourceControlIntegration-TFS -Version 1.0.1 

https://www.nuget.org/packages/DisableSourceControlIntegration-TFS

查看更多
劳资没心,怎么记你
6楼-- · 2019-01-14 15:43

I noticed that if you have one file checked in the packages folder, for example repositories.config then the .tfignore pattern doesn't work.

My solution was to delete the packages folder from source control entirely, then the packages content were successfully ignored

查看更多
The star\"
7楼-- · 2019-01-14 15:44

I had the same issue. I went and found that there is a bug in the NuGet client:

Ignore Files

Note: There is currently a known bug in the NuGet Client that causes the client to still add the packages folder to version control. A workaround is to disable the source control integration. In order to do that, you'll need a nuget.config file in the .nuget folder that is parallel to your solution. If this folder doesn't exist yet, you'll need to create it. In nuget.config, add the following content:

http://docs.nuget.org/consume/package-restore/team-build

And I was able to get it working by following the work around linked in the "Ignore Files" section above. Here is a snippet of the work around below:

Respect .tfignore and .gitignore files for TFS Integration description

When using TFS integration in Visual Studio, NuGet will pend adds to the /packages folder even when there is a .tfignore or .gitignore file in place that says to ignore the /packages folder. NuGet should respect the ignore file rather than requiring that the user create a NuGet.config file that has disableSourceControlIntegration=true.

This can be done by calling into the LocalItemExclusionEvaluator: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.localitemexclusionevaluator.aspx

Before adding items to TFS, we should check this evaluator. We should at least do it for the /packages folder if nothing else.

https://nuget.codeplex.com/workitem/4072

查看更多
登录 后发表回答