简体   繁体   English

是否应该将obj / Debug中的.pdb文件添加到源代码管理中?

[英]Should .pdb files from obj/Debug be added to source control?

There's some conflicting info on the web regarding best practices when it comes to handling .pdb files, and I would be grateful for a clarification. 关于处理.pdb文件的最佳做法,网络上有一些相互矛盾的信息,我将不胜感激。

For example, this source says that "PDB files are as important as source code", while this says .pdbs don't belong into source control. 例如, 消息源说“ PDB文件与源代码同等重要”,而此消息说.pdbs不属于源代码控制。

  1. Should .pdb files generated by build during normal development (debug mode) be committed to source control? 在正常开发(调试模式)期间由构建生成的.pdb文件是否应提交给源代码管理?
  2. Should only .pdb files used for release/production be stored in source control? 应该仅将用于发布/生产的.pdb文件存储在源代码管理中?

I'd expect the answer to the first question to be "no" and the answer to the second one to be "yes", but I may be missing something. 我希望第一个问题的答案为“否”,而第二个问题的答案为“是”,但我可能会遗漏一些东西。

PDB files should not go in source control. PDB文件不应进入源代码管理。 They are part of the build artifacts and should be kept along with the output from the build (as opposed to discarded after the build). 它们是构建工件的一部分,应与构建输出一起保存(而不是在构建后丢弃)。 Historical builds should be kept and the version of the currently released deployment should be tracked so if you need to you can pull the PDBs from the corresponding archived build. 应该保留历史版本,并跟踪当前发布的部署的版本,以便在需要时可以从相应的存档版本中提取PDB。

In addition to Craig W. s correct answer: 除了Craig W.的正确答案之外:

besides the sourceControl System (such as svn/git) you als should also use a build system to archive any builds. 除了sourceControl System(例如svn / git),您还应该使用构建系统来存档所有构建。

A nice Build System is Jenkins, it's quiet a easy to understand build system with all features i expect. 詹金斯(Jenkins)是一个不错的构建系统,它很安静,易于理解,具有我期望的所有功能。 if u distribut your software you login to jenkis and hit "build now". 如果您分发您的软件,则登录jenkis并单击“立即构建”。 Jenkins then checks out the current version from svn/git and builds your software (using a batch) and saves all Files including the debug/symbol files. 然后,Jenkins从svn / git中签出当前版本,并(使用批处理)构建软件并保存所有文件,包括调试/符号文件。 jenkins should increase the build number of the binary each time and the build number should be set into the binary file (dll and exe). jenkins应每次增加二进制文件的内部版本号,并将内部版本号设置到二进制文件(dll和exe)中。 On a crash u then see the version in the event-viewer and can get all the files from the crashed version including the source. 发生崩溃时,您可以在事件查看器中查看版本,并可以从崩溃的版本中获取所有文件,包括源代码。

I also would suggest to write the jenkins build number into the binary. 我还建议将jenkins内部版本号写入二进制文件。 thus you always can logonto jenkins select the build number and you then get all the debug files and also see in the logs what svn version it was built from (thus u can also checkout the proper sourcecode). 因此,您始终可以登录到jenkins选择内部版本号,然后获取所有调试文件,并在日志中查看从其构建的svn版本(因此您也可以签出正确的源代码)。 for Versioning dll or exe files you can use (in .net edit the config file with a script instead): http://www.codeproject.com/KB/install/VerPatch.aspx?msg=3207401 and integrate it in the build batch. 对于版本化dll或exe文件,您可以使用(在.net中,使用脚本来代替编辑配置文件): http : //www.codeproject.com/KB/install/VerPatch.aspx?msg=3207401并将其集成到构建中批量。

And here you find the jenkins: https://jenkins-ci.org/ 在这里您可以找到詹金斯人: https ://jenkins-ci.org/

See this post on SO. 看到这篇关于SO的文章。 You don't need to add the *.pdb file to source control. 您无需将* .pdb文件添加到源代码管理中。 These files are generated when you start a new debug session. 这些文件是在您启动新的调试会话时生成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM