将pdb文件包含到我的nuget(nupkg)文件中 [英] Include pdb files into my nuget (nupkg) files
问题描述
我正在使用MSBuild生成我的nuget程序包.
I am using MSBuild to generate my nuget packages.
我是否需要设置任何命令以使其包含我的.pdb
文件,以便在调试时进入源代码?
Is there any command I need to set, to allow it to include my .pdb
files, for stepping into the source while debugging?
我不希望将源文件包含在要从nuget软件包中提取的项目中.
I do not want the source files to be included into the project that is pulling in the nuget package.
推荐答案
虽然可能对调试没有帮助,但包含.pdb文件以使堆栈跟踪具有行号绝对是有用的.
While it may not help for debugging, it's definitely useful to include .pdb files so that stack traces have line numbers.
在nuspec文件中,包含一个<files>
元素(<package>
的子级,<metadata>
的同级).这是我的一个类库中的内容:
In the nuspec file, include a <files>
element (child of <package>
, sibling of <metadata>
). This is what I have in one of my class libraries:
<files>
<file src="bin\$configuration$\$id$.pdb" target="lib\net452\" />
</files>
确保目标与包中.dll文件所在的文件夹相同.
Make sure the target is the same folder as where your .dll file is put in the package.
这篇关于将pdb文件包含到我的nuget(nupkg)文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!