简体   繁体   中英

Visual Studio Platform target

I am wondering if someone could confirm this, it is the behavior I am experiencing:

  • exe is compiled with Platform target: x86
  • The exe has referenced dll's that are compiled as "Any CPU"
  • referenced dll's are loaded as x86
  • Things work ok

If the implied question is "Is it OK of me to expect this to work OK" then yes.

Your main process, which in this case is x86, determines whether you start a 32-bit or 64-bit process. x86 means 32-bit, x64 means 64-bit so your process will be 32-bit.

A 32-bits process can only load 32-bits assemblies, or Any CPU assemblies (which will then be loaded as 32-bit).

A 64-bits process can only load 64-bits assemblies, or Any CPU assemblies (which will then be loaded as 64-bit).

So yes, this is expected and documented (though I couldn't find a quick link) to be OK.

In fact, if you can get away with it, always make your class libraries, components, support libraries, etc. as Any CPU, will make your life much easier.

For your applications, determine if you must have it in a specific "bitness", and if so pick x86 or x64 but usually you can get away with picking Any CPU also for those.

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