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

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

问题描述

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

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

随着项目的建立,将创建一个nupkg文件,但是当我在调试另一个项目时使用该nupkg文件时,没有包含符号,nupkg文件中也没有包含PDB文件.

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

谢谢.

解决方案

将调试信息嵌入到内部版本中不包含任何调试信息调试符号

调试信息:嵌入式表示 MSBuild PDB 文件直接嵌入目标 DLL 中,这意味着该DLL不仅包含其自己的DLL,而且还包含PDB文件的内容. DLL 已经包含两个内容:本身和 pdb 文件.

随着项目的建立,创建了一个nupkg文件,但是当我使用调试另一个项目时,此nupkg文件没有符号包括在内,nupkg文件中也没有包含PDB文件.

因此您不必担心缺少pdb文件,它已经被放入DLL中.

如果要在另一个项目中本地调试nuget软件包的内容,则应仅将源文件( cs文件)打包到nuget软件包中.

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

 < ItemGroup>< Compile Update ="Class1.cs"Pack ="true"PackagePath ="SourceFiles"</Compile>//如果要调试其功能,请添加任何像这样的源文件</ItemGroup> 

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

目的是将源文件与nuget打包在一起,以便可以将源文件直接从软件包中取出以进行后续调试,以确保成功调试.

2),然后打包项目,然后将此新版本的软件包安装到项目中,首先应卸载旧版本的

此外,还有一个与此类似的问题a>.

这是关于我的测试的示例:

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:\Users\xxx(current user)\.nuget\packages, 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天全站免登陆