正在构建的项目的处理器架构不匹配 "AMD64"

There was a mismatch between the processor architecture of the project being built "AMD64"

我在为我的 UWP 应用程序创建商店包时遇到以下错误:

There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "C:\user.nuget\packages\ksemenenko.googleanalytics.0.3.2\lib\UAP10\Plugin.GoogleAnalytics.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

我已打开配置管理器并确保配置与体系结构一致:ARM/ARM、x64/x64、x86/x86。

有人知道如何 "align the processor architectures between your project and references" "AMD64" 吗?

问题出在您正在使用的第 3 方 DLL 中。它的编译方式不适用于 x64 进程。在他们解决这个问题之前,您必须坚持使用 x86。我看到您已经在他们的 GitHub 存储库中发现了一个错误。

如果您使用 ildasm 查看 nuget 包中包含的 DLL,您将看到以下提示:

.module Plugin.GoogleAnalytics.dll
// MVID: {A0116946-EA05-4F0C-8BE9-A44B1EEF77BD}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000003    //  ILONLY 32BITREQUIRED
// Image base: 0x07EF0000