What does the .dtbcache file do?

白昼怎懂夜的黑 提交于 2021-01-02 04:55:12

问题


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.

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


回答1:


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.



来源:https://stackoverflow.com/questions/50343456/what-does-the-dtbcache-file-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!