Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the .dtbcache file do?

I have a C# WinForms project, which I am working on in Visual Studio 2017 (although it was originally created in the 2015 version).

I don't recall having done anything special, but it has added a file called .dtbcache, that it wants to add to git. The file has no extension, and a Google search doesn't show any results.

The file is located in ..\repos\myprject\.vs\MyProject\DesignTimeBuild. Which means that the "dtb" part of the file name probably means design time build, but that doesn't really make it that much better.

enter image description here

Can I delete it or add it to .gitignore? I would prefer not to include it in our git repository, unless it is required.

like image 689
Jakob Busk Sørensen Avatar asked May 15 '18 06:05

Jakob Busk Sørensen


People also ask

How do I ignore a .VS file in Git?

Configuring ignored files for a single repository You can create a . gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the . gitignore file in to your repository.

How do you ignore VS?

vs/? Save and commit it, this should work. In Visual Studio, you can directly Click on "Git" -> "Settings" -> Then select "Git Repository settings" -> then in section "Git Files", click the Add button for Ignore file.


1 Answers

Short answer: You can safely exclude it from your Git repo.

Long answer:

You're right that dtb stands for Design Time Build. This is a file automatically created by VS2017, with a bit more information here and here (links to a blog from someone working on the Visual Studio project system). In summary, it's Visual Studio more or less extrapolating what files will be produced in order to make sure Intellisense is fully available as intended.

From the linked articles, one of the purposes of this is to make sure Visual Studio has an answer in certain cases:

  • Given an assembly reference in the project file, what assembly on disk is that reference going to actually refer to at compile time?
  • Given a XAML file, what is the code that is going to be generated by the XAML compiler at compile time going to look like?
  • Given a glob file pattern (*.cs), what files are actually going to be included at compile time?

So the files, being generated on the fly, are not needed in your Git repo, and can safely be excluded. Moreover, from what I can tell, these files are specifically made and used by Visual Studio 2017.

like image 51
Nicolas Coombs Avatar answered Oct 16 '22 07:10

Nicolas Coombs