适用于 Android 的 .NET 警告 XA0125

示例消息

warning XA0125: 'AndroidApp1.pdb' is using a deprecated debug
information level. Set the debugging information to Portable in the
Visual Studio project property pages or edit the project file in a
text editor and set the 'DebugType' MSBuild property to 'portable' to
use the newer, cross-platform debug information level. If this file
comes from a NuGet package, update to a newer version of the NuGet
package or notify the library author.

Issue

支持为.mdb.pdb符号文件设置MSBuild属性为fullpdbonly的功能现已弃用。 这适用于应用程序项目中以及引用的库(包括 NuGet 包)中的 .mdb.pdb 文件。

解决方案

DebugType设置为portable,包括在应用程序项目和所有库引用中。 portable 是从现在开始所有项目推荐使用的设置。 旧版本 fullpdbonly 设置适用于较旧的特定于 Windows 的文件格式。 .NET 6 及更高版本不支持这些较旧的格式。

在 Visual Studio 中,转到项目属性页中的 “属性> 生成> 高级”,并将 “调试信息” 更改为 “可移植”

在 Visual Studio for Mac 中,转到项目属性页中的 “生成 > 编译器 > 调试”信息 ,并将 “调试”信息 更改为 “可移植”。

如果有问题的符号文件来自 NuGet 包,请更新到较新版本的包或通知库作者。