简体   繁体   中英

Build error with System.Web switching a C# project over from AnyCPU to x64

I have a Visual Studio (2013) C# project that builds fine on AnyCPU is failing to build when I change the platform target to x64 . This is on .NET 2. The error I get is

An attempt was made to load an assembly with an incorrect format: C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\System.Web.dll.

I'm struggling to find what I should do here. I have tried re-adding Sustem.Web and resources I have read indicate that this reference should work for either platform (I presume it is itself AnyCPU ). I feel like I am missing something very obvious here...

It turns out it was caused by an AfterBuild event in the .csproj file that was invoking SGEN. Disabling "Generate serialization assembly" and removing this AfterBuild event resolved it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM