我可以安全地删除对 .pdb 文件的引用吗? [英] Can I safely delete references to .pdb files?

查看:28
本文介绍了我可以安全地删除对 .pdb 文件的引用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ASP.NET Core 5.0,因为它不久前问世,今天我注意到了一些奇怪的事情.我为我的软件制作了一个安装程序,它会自动过滤掉进入我的发布版本的每个 .pdb 文件.一种从未引起问题的机制.

I am using ASP.NET Core 5.0 since it came out a short while ago and I noticed something strange today. I crafted an installer for my software, which automatically filters out each .pdb file that slipped into my release build. A mechanism that never caused problems.

但是新的 .NET 5.0 运行时似乎有问题,IIS 抱怨找不到文件 runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.pdb强>.

But the new .NET 5.0 runtime seems to have a problem with it, and IIS complained that it could not find the file runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.pdb.

我想知道为什么缺少调试符号会成为发布版本(或任何版本)的问题,并做了一些研究.我发现有问题的文件是 MyProject.deps.json

I wondered why missing debug symbols would be an issue for a release build (or any build) and did some research. I found that the file in question was en entry in MyProject.deps.json

"Microsoft.Data.SqlClient.SNI.runtime/2.0.1": {
    "runtimeTargets": {
      "runtimes/win-arm/native/Microsoft.Data.SqlClient.SNI.dll": {
        "rid": "win-arm",
        "assetType": "native",
        "fileVersion": "2.0.1.0"
      },
      "runtimes/win-arm/native/Microsoft.Data.SqlClient.SNI.pdb": {
        "rid": "win-arm",
        "assetType": "native",
        "fileVersion": "0.0.0.0"
      },
      "runtimes/win-arm64/native/Microsoft.Data.SqlClient.SNI.dll": {
        "rid": "win-arm64",
        "assetType": "native",
        "fileVersion": "2.0.1.0"
      },
      "runtimes/win-arm64/native/Microsoft.Data.SqlClient.SNI.pdb": {
        "rid": "win-arm64",
        "assetType": "native",
        "fileVersion": "0.0.0.0"
      },
      "runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll": {
        "rid": "win-x64",
        "assetType": "native",
        "fileVersion": "2.0.1.0"
      },
      "runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.pdb": {
        "rid": "win-x64",
        "assetType": "native",
        "fileVersion": "0.0.0.0"
      },
      "runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.dll": {
        "rid": "win-x86",
        "assetType": "native",
        "fileVersion": "2.0.1.0"
      },
      "runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.pdb": {
        "rid": "win-x86",
        "assetType": "native",
        "fileVersion": "0.0.0.0"
      }
    }
  },

如您所见,其中有 4 个 .pdb 文件.我尝试删除导致问题的一个条目,然后繁荣......现在一切正常.只需将 .pdb 文件添加到文件夹中也可以解决问题.所以我已经自己解决了实际问题.

As you can see, there are 4 .pdb files in there. I tried deleting the one entry that caused the problem, and boom... everything works fine by now. Just adding the .pdb file to the folder also did the trick. So I already solved the practical problem by myself.

我的问题是:我可以安全地从 .deps.json 中删除这些条目,还是会导致问题?这可能是微软的错误吗?那些条目是不小心滑进去的吗?

My question is: Can I safely delete those entrys from the .deps.json, or might that cause problems? Could this be an error by Microsoft? Did those entrys slip in there by accident?

推荐答案

从 net core framework 3.0 开始,它们是必需的(应用程序在某些情况下会失败).

As of net core framework 3.0 they are required (the application fails under certain scenarios).

库以非正统方式使用这些 PDB,以生成当前正常工作所需的堆栈跟踪和信息.

These PDBs are used by the library in an unorthodox way, to generate stack traces and information that is currently required for it to work properly.

但是,在未在 C# 交互中加载的本机库 中,似乎与一个全新的客户端,这些依赖项应该消失,因此不应再发布.

However, in Native libraries not loaded in C# interactive, it seems that with a brand new client, those dependencies should go away, and therefore should no longer be published.

但是,无法加载 DLL 'Microsoft.Data.SqlClient.SNI.x86.dll'Microsoft.Data.SqlClient.SNI 未与 WebForms 一起部署 其他人也有问题,尤其是在云上部署时,我们所有的 net-5 项目都将它们包含在其清单中.这可能是由于实体框架引用了旧版本的客户端所致.

However, Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll' and Microsoft.Data.SqlClient.SNI not deployed along with WebForms others have issues too, particularly when deploying on the cloud, and all of our net-5 projects do include them in their manifest. This could be caused by Entity Framework referencing an old version of the client.

这篇关于我可以安全地删除对 .pdb 文件的引用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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