Microsoft.NET\Framework 和 Microsoft.NET\Framework64 之间有什么区别?
我想知道 .NET 模式 x86 和 x64 之间的区别。
两种模式有什么区别?
我可以使用 .NET x64 和 .NET x86 编译我的库吗?
如果我选择 x64 而不是 x86,对我来说会有什么不同吗?
.NET x64 的优势是什么?
如果我想使用 .NET x64,我是否必须安装任何特殊的东西?
I would like to know the difference between .NET modes x86 and x64.
What is the difference for both modes?
Can I compile my libraries for example with .NET x64 and .NET x86?
Would it be any difference for me if I choose x64 instead of x86?
What is the advantage of .NET x64?
Do I have to install anything special if I want to use .NET x64?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
复杂的问题,我会尝试简化:
任何 .Net 应用程序都可以同时编译为 x86(32 位)和 x64(64 位)。实际上他们默认这样做。您可以通过在项目属性的“构建”选项卡中更改目标 CPU 来更改此设置。支持的目标是“Any”(将即时编译为 32 位或 64 位,具体取决于操作系统支持),“x86”将编译为适用于所有平台的 32 位,“x64”将编译为 64 位-bit 仅适用于 64 位平台。
是的。见上文。另请注意,有时会执行第二级编译,即 NGEN。它为特定 CPU 类型创建本机映像。然而,如果你搞砸了,你已经知道了。
对于 .dll,请为它们选择“任何”CPU。对于 .EXE(入口点),您必须选择 Any、x86 或 x64。有一些事项需要考虑: 访问本机 Windows .dll 文件 (interpo) 的 x86 .Net 应用程序需要 x86 .dll 文件。因此 64 位应用程序无法访问 32 位 API 调用,反之亦然。这通常是 .Net 应用程序在 64 位操作系统上失败的原因。解决此问题的方法是引用正确的 .dll,或者简单地将属性下的 .Net 应用程序设置为 x86(32 位)。如果所有其他依赖项设置为“Any”,它们将在即时编译期间自动变为 32 位。
64 位的优点很复杂。根据您的应用程序的用途,有优点和缺点。最明显的优势是您的应用程序可以突破 2GB 内存障碍。缺点如#3 中所述,如果您引用 64 位 .dll,您的应用程序将无法在 32 位操作系统上执行。
一切都是开箱即用的。除了上面的所有事情之外,不要担心任何事情。 :)
Complex question, I'll try to simplify:
Any .Net application can be compiled for both x86 (32-bit) and x64 (64-bit) at once. Actually they do by default. You can change this by changing target CPU in Build-tab in project Properties. Supported targets are "Any" (will Just-In-Time compile to 32 or 64-bit depending on operative system support), "x86" will compile to 32-bit which works on all platforms, and "x64" will compile to 64-bit which only works on 64-bit platforms.
Yes. See above. Also note that there is a second level of compile sometimes performed, and that is the NGEN. It creates a native image for a specific CPU type. However, if you mess with this you know already.
For .dll's choose "Any" CPU for them. For .EXE (entry point) you must choose Any, x86 or x64. There are some things to consider: x86 .Net apps accessing native Windows .dll-files (interpo) require x86 .dll-files. So a 64-bit app can't access 32-bit API-calls and vice versa. This is often a reason for .Net apps to fail on 64-bit operating systems. The way to solve this is to either reference correct .dll's or simply set the .Net application to x86 (32-bit) under properties. All other dependencies will automatically become 32-bit during Just-In-Time compile if they are set to "Any".
The advantages of 64-bit are complex. There are advantages and drawbacks depending on what your app does. The most obvious advantage is that your application can break the 2GB memory barrier. The disadvantage is as explained in #3, if you reference 64-bit .dll's your app won't execute on 32-bit operating systems.
Everything comes out-of-the-box. Don't worry about a thing, except all the stuff above. :)