簡體   English   中英

Xamarin 處理器架構構建錯誤

[英]Xamarin processor architecture build error

我最近用最新的補丁版本更新了我的 VS 2015,從那時起我收到了這個錯誤:

正在構建的項目的處理器架構“MSIL”與參考“C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\mscorlib.dll”、“x86”的處理器架構之間存在不匹配。 這種不匹配可能會導致運行時失敗。 請考慮通過配置管理器更改項目的目標處理器架構,以便在您的項目和參考之間對齊處理器架構,或者依賴於具有匹配項目目標處理器架構的處理器架構的參考。

輸出:

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
1>------ Rebuild All started: Project: MoneyFox.Shared, Configuration: Debug Any CPU ------
1>C:\Users\nino\Documents\GitHub\MoneyFox.Windows\Src\MoneyFox.Shared\MoneyFox.Shared.csproj(333,3): warning MSB4011: "C:\Users\nino\Documents\GitHub\MoneyFox.Windows\Src\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" cannot be imported again. It was already imported at "C:\Users\nino\Documents\GitHub\MoneyFox.Windows\Src\MoneyFox.Shared\MoneyFox.Shared.csproj (325,3)". This is most likely a build authoring error. This subsequent import will be ignored. 
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): error MSB3270: 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.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

唯一的其他條目是警告誰應該是原因。 奇怪的是,發生錯誤的項目沒有引用 mscorlib。

該錯誤發生在平台特定項目引用的 PCL 共享庫部分。 因此,這些也不能建立。

我當前的構建配置如下:

在此處輸入圖片說明

特別的共享項目:

在此處輸入圖片說明

存儲庫: https : //github.com/NPadrutt/MoneyFox.Windows/tree/AndroidBackgroundService

我試圖修復 vs 但這並沒有改變什么,完全重新安裝它。 有趣的是,我可以在 Windows 7 pc 上構建它(但會出現運行時錯誤)。 此外,我無法再構建幾天前可構建的主分支。 這里有什么問題!?

編輯:我創建了一個新的可移植類庫並卸載了所有其他項目。我得到了同樣的錯誤,當我創建一個只有一個可移植類庫的新項目時也是如此。 所以我目前的安裝似乎有問題......

我找到了解決問題的方法。 似乎某些 .net 配置文件已損壞。 但是他們沒有通過重新安裝或修復 VS 得到修復。 因此,因此我刪除了路徑 C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework.NETPortable 下的文件和文件夾

然后我修復了 VS,它又工作了..

我認為這與將最新補丁應用於 Visual Studio 2015 無關。

當我們有一個為 x86 構建的項目引用另一個為 AnyCPU 構建的項目時,我們會看到此警告。 這可以在項目屬性頁面中修復(右鍵單擊項目並單擊屬性)。 在 Build tap 中,您可以設置Platform target 我建議您在更新之前將屬性窗口頂部的配置組合框設置為所有配置,以使其設置一致。

您也可以通過卸載項目並手動編輯來更正此問題。 查找 AnyCPU 屬性並確保在無條件的屬性組或每個配置條件的所有屬性組中設置它。

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <OutputPath>bin\Debug\</OutputPath>
    ...
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <OutputPath>bin\Release\</OutputPath>
    ...
  </PropertyGroup>

暫無
暫無

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

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