簡體   English   中英

.NET參考在我的項目(類庫)中不可用。 得到編譯器錯誤“處理器體系結構之間不匹配”

[英].NET reference not available in my project (Class Library). Getting compiler error “mismatch between processor architecture”

我有一個需要使用.NET引用才能工作的類庫,因為它利用了許多System API,但無法從“ Add References對話框中添加該引用。 .NET引用不是下提供AssembliesReference Manager

這是我的項目的樣子,在構建該項目時出現以下錯誤:

There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\\\mscorlib.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.

在此處輸入圖片說明

以下是我的參考管理器的屏幕截圖

在此處輸入圖片說明

我希望將.NET參考附加到下圖。任何想法如何解決此問題? 提前致謝 :)

在此處輸入圖片說明

找到了這個問題的答案。

要解決流程體系結構不匹配的問題,我遵循以下步驟:

首先,我在項目中卸載了nuget軟件包。

然后,我打開了項目的屬性。 左鍵單擊項目,然后打開“ Properties

單擊左側面板中的Library ,然后在“ Targets下單擊“ Change 如果.NET Framework已選中,則取消選中它並單擊“ Ok保存。

然后重新安裝nuget軟件包並重新構建。 它像魅力一樣運作。 似乎Visual Studio 2017會自動添加.NET參考。 我相信它是VS 2017中的錯誤

要添加許多.NET庫之一,請右鍵單擊“參考”,然后選擇“添加參考”。

打開的對話框的左側有一個菜單,.NET庫位於“程序集”->“框架”下。

例如, System.Web.Services (本身沒有“ .NET參考” ...它分為許多程序集)。

添加參考

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM