【问题标题】:Processor Architecture mismatch - Visual Studio, Nuget, Stylecop处理器架构不匹配 - Visual Studio、Nuget、Stylecop
【发布时间】:2023-07-09 22:19:02
【问题描述】:

我将 Visual Studio 用于 C# 应用程序。我有一台 64 位的机器。我安装了最新版本的 Nuget 和 Stylecop。当我构建时,我会收到警告

There was a mismatch between the processor architecture of the project
being built "MSIL" and the processor architecture of the reference
NuGet.VisualStudio", "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."

你知道这是什么吗?

【问题讨论】:

    标签: visual-studio nuget stylecop cpu-architecture


    【解决方案1】:

    对于这个问题,我有两个可行的解决方案: 第一次将目标框架从 Project > Properties > Build tab > Platform target 更改为 x64 如果上述解决方案在大多数情况下都不起作用,那么请尝试使用另一个每次都对我有用的解决方案。 转到项目源代码文件夹 > obj > x64 > 调试并删除那里的所有文件 现在尝试从 Visual Studio 发布您的解决方案,它会起作用。 一些屏幕截图可以更好地理解这一点

    1. 4. 5. 6.

    【讨论】:

      【解决方案2】:

      我想通了 - 我去了配置管理器,并将项目的平台设置为 x64。成功了!

      【讨论】: