Friday, October 05, 2012

Error 13 /platform:anycpu32bitpreferred is not a valid setting for option /target:library or /target:module

If you find this error while compiling VS2012 Windows 8 (aka Window Store and/or Windows Metro) applications:
 
Error 13 /platform:anycpu32bitpreferred is not a valid setting for option /target:library or /target:module 
 
then the solution seems to be to edit the csproj file to remove <Prefer32bit>true</Prefer32bit>
 
 

Open the project file in notepad and remove <Prefer32Bit>true</Prefer32Bit> then reload it  (you can also right click on the project in solution explorer, choose unload project, right click on the project again, choose edit someproject.csproj, after making the edit, save, and right click and reload.

2 comments:

  1. Thanks for posting this. It just came in very useful. :)

    ReplyDelete
  2. I had the same issue. Based on @Slodge's suggesion, I changed the class library to an Windows Application, unchecked the Prefer 32 Bit flag, and then changed back to a Class Library

    ReplyDelete