2016-09-19 157 views
1

我用最新的補丁版本更新了我的VS 2015最近從那以後,我得到這個錯誤:xamarin應用程序並沒有編譯

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.

輸出:

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共享庫部分中發生錯誤。因此這些不能建立。

我當前構建配置如下:

enter image description here

特殊的共享項目:

enter image description here

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

我試圖修復VS但沒有改變什麼,完全重新安裝。 有趣的是,我可以在Windows 7電腦上構建它(但會改變運行時錯誤)。 此外,我不能再建立我的主分支,而且可以在幾天前建立。 這裏有什麼問題!?

編輯:我創建了一個新的可移植類庫和卸載所有其他項目..我也得到了同樣的錯誤,當我創建一個只有一個可移植的類庫的新項目。因此,似乎有什麼很錯了我目前的安裝...

+0

這是一種常見的錯誤,可能不是問題。我經常這樣做,並且仍然能夠構建和部署得很好。你無法構建哪個項目?在構建失敗後,我會查看輸出窗口,看看那裏出現了什麼樣的錯誤 – hvaughan3

+0

我從輸出中添加了日誌..據我所知只有一個警告。 – NPadrutt

+0

嘗試從所有項目中刪除所有'/ bin /'和'/ obj /'文件夾,然後進行清理和重建。 – hvaughan3

回答

1

我找到了問題的解決方案。似乎某些.net配置文件已損壞。但他們沒有得到重新安裝或維修VS的修復。所以,所以我刪除的文件和文件夾的路徑C下:\程序文件(x86)\參考大會\微軟\ Framework.NETPortable

然後我修好VS和一切又恢復了..

0

我不認爲這有做應用最新的補丁程序到Visual Studio 2015年

我們看到這個警告,當我們有一個爲x86構建的項目引用另一個爲AnyCPU構建的項目。這可以在「項目屬性」頁面中解決(右鍵單擊項目並單擊「屬性」)。在Build tap中,您可以設置平臺目標。我建議您在屬性窗口的頂部將配置組合框設置爲所有配置,然後再更新它以使其始終保持一致。

您也可以通過卸載項目並手動編輯項目來解決此問題。查找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> 
+0

感謝您的支持答案,但據我所知,我有AnyCPU上的所有項目。我還添加了配置管理器的屏幕截圖。 – NPadrutt

+0

即使配置管理器將AnyCPU作爲平臺,項目仍可能將x86作爲PlatformTarget,因此關鍵是檢查項目屬性。 –