What does the “Prefer 32-bit” compiler flag mean for Visual Studio (C#, VB)?

后端 未结 4 1444
萌比男神i
萌比男神i 2020-12-05 13:17

Just got the Visual Studio 11 developer preview installed. I see a new option in the project properties called \"Prefer 32-bit\" when compiling a managed (C#, VB) applicatio

4条回答
  •  暖寄归人
    2020-12-05 14:09

    There is an good article at What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11.

    The short answer to your question is "When using that flavor of AnyCPU, the semantics are the following:

    If the process runs on a 32-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code. If the process runs on a 64-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code. If the process runs on an ARM Windows system, it runs as a 32-bit process. IL is compiled to ARM machine code. The difference, then, between “Any CPU 32-bit preferred” and “x86” is only this: a .NET application compiled to x86 will fail to run on an ARM Windows system, but an “Any CPU 32-bit preferred” application will run successfully."

提交回复
热议问题