将调试信息嵌入到构建中不包含任何调试符号 [英] Embedding debugging information to the build does not include any debugging symbols

查看:11
本文介绍了将调试信息嵌入到构建中不包含任何调试符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,在构建 - 高级"部分中,我设置了调试信息:嵌入式":

另外,我设置了一个选项来将我的项目打包为 nupkg 文件.

随着项目的构建,创建了一个 nupkg 文件,但是当我在调试另一个项目时使用这个 nupkg 文件时,没有包含任何符号,pdb 文件也不包含在 nupkg 文件中.

我的问题:据我所知,我必须执行不同的步骤才能将 PDB 文件包含到我的 nupkg 中.在这种情况下,调试信息:嵌入式"的目的是什么?选项,为什么它可用,它有什么作用?因为即使启用此选项,结果包文件中也不会包含调试信息.

谢谢.

解决方案

在构建中嵌入调试信息不​​包括任何调试符号

Debugging information: Embedded表示MSBuild会将PDB文件直接嵌入到目标DLL中,意思是DLL 不仅包含自己的 DLL,还包含 PDB 文件的内容.DLL 已经包含两个内容:它本身和 pdb 文件.

<块引用>

随着项目的构建,创建了一个 nupkg 文件,但是当我使用这个 nupkg 文件在调试另一个项目时没有符号包含,pdb 文件也不包含在 nupkg 文件中.

所以你不必担心丢失pdb文件,它已经被放入DLL中了.

如果你想在另一个项目中本地调试nuget包的内容,你应该只将源文件(cs文件)打包到nuget包中.

1) 在您的 lib 项目中添加此类打包节点.

<编译更新=Class1.cs";包=真";PackagePath="SourceFiles"></Compile>//如果你想调试它们的功能,添加任何这样的源文件</项目组>

它将源文件打包到 nupkg 的一个名为 SourceFiles 的文件夹中.

目的是把源文件和nuget一起打包,这样可以直接从包中取出源文件进行后续调试,保证调试成功.

2)然后打包项目,在你把这个新版本的包安装到项目之前,你应该先卸载旧的,

此外,还有一个

In my project, in the Build - Advanced section I've set "Debugging information: Embedded":

Also, I have set an option to package my project as nupkg file.

As the project has built there is a nupkg file created, but when I use this nupkg file upon debugging another project there are no symbols included, nor PDB file is included inside of nupkg file.

My questions: as far as I understand I have to do different steps to include PDB file into my nupkg. In this case, what is the purpose of "Debugging information: Embedded" option, why it is available and what does it do? Because no debugging information is included in the result package file even this option is enabled.

Thank you.

解决方案

Embedding debugging information to the build does not include any debugging symbols

Debugging information: Embedded means that MSBuild will embed the PDB file directly into the target DLL, meaning that the DLL not only contains its own DLL but also contains the contents of the PDB file. A DLL already contains two contents: itself and the pdb file.

As the project has built there is a nupkg file created, but when I use this nupkg file upon debugging another project there are no symbols included, nor PDB file is included inside of nupkg file.

So you do not have to worry about missing the pdb file, it is already be put into the DLL.

And if you want to debug the nuget package's content locally in another project, you should only pack the source files(cs files) into nuget package.

1) Add such pack nodes in your lib project.

<ItemGroup>
        <Compile Update="Class1.cs" Pack="true" PackagePath="SourceFiles"></Compile>

        //add any source files like this if you want to debug their functions
</ItemGroup>

It will pack the source files into a folder called SourceFiles of the nupkg.

The purpose is to package the source file along with nuget so that the source file can be directly taken out of the package for subsequent debugging to ensure successful debugging.

2) then pack the project, before you install this new version of the package into the project, you should first uninstall the old one, clean nuget caches or just delete all files under C:Usersxxx(current user).nugetpackages, then install the new one.

3) Before you debug the project, you should first add the source files of the nuget in to the solution.Otherwise, VS will report an error that the nuget source file cannot be found when debugging.

Right-click on the solution-->Properties-->Common Properties-->Debug Source Files

input the SourceFiles folder of the nuget into it:

In addition, there is a similar issue about it.

This is a sample about my test:

这篇关于将调试信息嵌入到构建中不包含任何调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆