Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 TFS .tfignore file

Tags:

I want to ignore a folder (and its content) in a visual studio 2015 solution from beeing checked-in into tfs.

I created a file called '.tfignore' in the root of the project that is containing the folder I want to exclude.

The content of the file looks like this: /Dist

This is not working at all. Even if I add *.cs to the file, nothing gets excluded.

Does somebody know where the problem is? How do I wire this up in a working way?

like image 340
evaenrique Avatar asked Apr 21 '16 12:04

evaenrique


People also ask

What is a .tfignore file?

tfignore files that should specify which project source files sould be ignore by the source control. Since the latest update, the source control (Azure DevOps) does not handle this file and does not ignore the files that it needs to exclude from source control. Visual Studiovisual studio 2019 version 16.4windows 10.0.

How do I add ignore files to TFS?

Add files to the server - Azure ReposGo to your Source Control Explorer and navigate to the excluded file. From there right-click on the file and delete it. Go to the Included Changes in Pending Changes and navigate to the excluded file. From there right-click on the file and select Exclude.


2 Answers

First, please make sure your .tfignore file created without any problem. This file does not have any suffix. One way to create it suggest you to rename a new.txt file with "tfignore." It will auto change to right .tfignore file.

You can also use the auto automatically generated .tfignore file, follow below steps:

  1. In the Pending Changes page, in the Excluded Changes section, choose the Detected changes link.

pending changes, Detected changes link , which counts the number of adds, in this case 50003 add(s) (I have a busy directory clearly!)

The Promote Candidate Changes dialog box appears.

  1. Select a file, open its context menu, and choose Ignore this local item, Ignore by extension, Ignore by file name, or Ignore by folder.

the promote candidate changes dialog opens. right-clicking an item in its list includes options like "Ignore by extension *.js"

  1. Choose OK or Cancel to close the Promote Candidate Changes dialog box.
  2. A .tfignore file appears in the Included Changes section of the Pending Changes page. You can open this file and modify it to meet your needs.

the .tfignore is automatically created by Visual Studio  and appears in pending changes with the "add" notation, suggesting you will commit it

More info please check the Customize which files are ignored by version control from MSDN Link:Add files to the server

like image 52
PatrickLu-MSFT Avatar answered Sep 21 '22 12:09

PatrickLu-MSFT


If your .tfignore file is in the solution root folder, adding a \Dist to it will make TFS ignore the Dist folder only inside the root folder. For instance, if you create a Dist folder inside a subfolder (e.g any of the projects folder in the solution), it won't work.

In that case, you need to use just Dist rather than \Dist, then rule will aply to the .tfignore root folder and all its subfolders.

This only apply to folders.

like image 36
Alisson Reinaldo Silva Avatar answered Sep 22 '22 12:09

Alisson Reinaldo Silva