Visual Studio 2008-添加参考
当添加DLL作为对ASP.Net项目的引用时,VS2008将多个文件添加到bin目录。如果DLL被称为foo.dll,则VS2008将添加foo.dll.refresh,foo.pdb和foo.xml。我知道什么是foo.dll :-),为什么VS2008添加其他三个文件?这三个文件做什么?我可以删除它们吗?是否需要在源代码管理中添加它们?
解决方案
foo.pdb是foo.dll的调试器符号文件,我们需要使用它,否则将无法在该代码中设置断点。
pdb用于调试和符号。如果从中引发了异常,则可以获取堆栈跟踪等。我们可以选择是否构建PDB。 xml文件用于XML注释和智能感知。 Visual Studio将对此进行解析,并显示在这些DLL中调用方法时添加的XML注释。
我不知道刷新文件。
VS2008 adds several files to the bin directory [...]Do they need to be added in source control?
bin目录中的任何内容都无需添加到源代码管理中。最初签入项目时的第一件事就是忽略bin和obj目录。因此,可以的,我们可以删除这些文件,但是Visual Studio会重新创建它们。
刷新文件(因为尚无人问津!)描述了DLL的来源。这是用于自动刷新参考;每当进行完整构建时,VS都会在该路径中查找并复制该版本的DLL。
为什么这是一件好事(有时)?假设我们处于团队环境中。有人签入foo.dll代码,然后构建系统将构建一个新的DLL,并将其输出到服务器上的文件共享中。刷新文件指向该DLL的服务器副本。下次构建时,VS将自动神奇地获取该DLL的最新最大副本。
源代码控制:
Ben Straub在对本文的评论中说:如果需要,应将.dll.refresh文件添加到源代码管理中,而不应将.xml,.pdb和当然是.dll文件添加被添加。
John Rudy解释了何时添加.refresh
文件:
Why is this a good thing (sometimes)? Let's say you're in a team environment. Someone checks in code for foo.dll, and your build system builds a new DLL, outputting it in a file share on a server. Your refresh file points to that server copy of the DLL. Next time you build, VS will auto-magically grab the latest and greatest copy of that DLL.
像David Mohundro所说的.xml表示:
The xml file is there for XML comments and intellisense. Visual Studio will parse that and display the XML comments that were added when you call methods in those DLLs.
.pdb如David Mohundro所说:
The pdb is there for debugging and symbols. If you get an exception thrown from it, you'll be able to get stacktraces, etc. You're in control of choosing whether or not the PDB is built.
有关.refresh文件的博客文章中的.refresh:
It tells VS where to look for updated versions of the dll with the same base name. They're text files, you can open them and see the path it's using. Their purpose is to prevent you from having to copy new versions yourself. In VS2003, the project file would contain the source location of the reference, but since VS2005 doesn't use project files for ASP.NET projects, this is the replacement for that particular functionality.