简体   繁体   English

Visual Studio平台目标

[英]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 exe是使用Platform目标:x86编译的
  • The exe has referenced dll's that are compiled as "Any CPU" 该exe文件引用了被编译为“任何CPU”的dll。
  • referenced dll's are loaded as x86 引用的dll被加载为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)确定您是启动32位进程还是64位进程。 x86 means 32-bit, x64 means 64-bit so your process will be 32-bit. x86表示32位,x64表示64位,因此您的进程将是32位。

A 32-bits process can only load 32-bits assemblies, or Any CPU assemblies (which will then be loaded as 32-bit). 32位进程只能加载32位程序集或任何CPU程序集(然后将它们加载为32位)。

A 64-bits process can only load 64-bits assemblies, or Any CPU assemblies (which will then be loaded as 64-bit). 64位进程只能加载64位程序集或任何CPU程序集(然后将它们加载为64位)。

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. 实际上,如果您可以摆脱它,请始终将类库,组件,支持库等作为任何CPU使用,将使您的生活变得更加轻松。

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. 对于您的应用程序,确定是否必须以特定的“位数”来指定它,如果是,则选择x86或x64,但通常您也可以选择使用“任何CPU”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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