Microsoft.NET\Framework 和 Microsoft.NET\Framework64 之间有什么区别?

发布于 2024-10-09 17:49:27 字数 259 浏览 0 评论 0原文

我想知道 .NET 模式 x86 和 x64 之间的区别。

  1. 两种模式有什么区别?

  2. 我可以使用 .NET x64 和 .NET x86 编译我的库吗?

  3. 如果我选择 x64 而不是 x86,对我来说会有什么不同吗?

  4. .NET x64 的优势是什么?

  5. 如果我想使用 .NET x64,我是否必须安装任何特殊的东西?

I would like to know the difference between .NET modes x86 and x64.

  1. What is the difference for both modes?

  2. Can I compile my libraries for example with .NET x64 and .NET x86?

  3. Would it be any difference for me if I choose x64 instead of x86?

  4. What is the advantage of .NET x64?

  5. Do I have to install anything special if I want to use .NET x64?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

没有心的人 2024-10-16 17:49:27

复杂的问题,我会尝试简化:

  1. 任何 .Net 应用程序都可以同时编译为 x86(32 位)和 x64(64 位)。实际上他们默认这样做。您可以通过在项目属性的“构建”选项卡中更改目标 CPU 来更改此设置。支持的目标是“Any”(将即时编译为 32 位或 64 位,具体取决于操作系统支持),“x86”将编译为适用于所有平台的 32 位,“x64”将编译为 64 位-bit 仅适用于 64 位平台。

  2. 是的。见上文。另请注意,有时会执行第二级编译,即 NGEN。它为特定 CPU 类型创建本机映像。然而,如果你搞砸了,你已经知道了。

  3. 对于 .dll,请为它们选择“任何”CPU。对于 .EXE(入口点),您必须选择 Any、x86 或 x64。有一些事项需要考虑: 访问本机 Windows .dll 文件 (interpo) 的 x86 .Net 应用程序需要 x86 .dll 文件。因此 64 位应用程序无法访问 32 位 API 调用,反之亦然。这通常是 .Net 应用程序在 64 位操作系统上失败的原因。解决此问题的方法是引用正确的 .dll,或者简单地将属性下的 .Net 应用程序设置为 x86(32 位)。如果所有其他依赖项设置为“Any”,它们将在即时编译期间自动变为 32 位。

  4. 64 位的优点很复杂。根据您的应用程序的用途,有优点和缺点。最明显的优势是您的应用程序可以突破 2GB 内存障碍。缺点如#3 中所述,如果您引用 64 位 .dll,您的应用程序将无法在 32 位操作系统上执行。

  5. 一切都是开箱即用的。除了上面的所有事情之外,不要担心任何事情。 :)

Complex question, I'll try to simplify:

  1. 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.

  2. 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.

  3. 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".

  4. 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.

  5. Everything comes out-of-the-box. Don't worry about a thing, except all the stuff above. :)

紫轩蝶泪 2024-10-16 17:49:27
  1. 有适用于 32 位或 64 位平台(操作系统)的模式 是
  2. 的,您可以 - 实际上 VS 在 x86 计算机上安装 32 位版本的 CLR,在 64 位 Windows 上安装 32 位和 64 位(两者)版本的 CLR。由于VS是32位应用程序,因此它在64位计算机上运行在WOW64下。
  3. 许多应用程序在 32 位 CLR 和 64 位 CLR 上的行为相同。但是,可能存在一些差异(例如,使用 Int32 作为句柄而不是 IntPtr 的错误平台调用)
  4. 与 64 位操作系统与 x86 操作系统的优势相同
  5. 如果您使用 64 位 Windows 和 VS2010,那么您就拥有了所有需要开发.net x64
  1. There are modes for 32bit or 64bit platforms (Operating Systems)
  2. Yes, you can - actually VS installs the 32 bit version of CLR on x86 computer and 32 bit and 64 bit (both of them) versions of CLR on 64 bit Windows. Since VS is 32 bit application, it runs under WOW64 on 64 bit computers.
  3. Many applications behave identically on both the 32-bit CLR and the 64-bit CLR. But, there can be some differences (for example incorrect platform invoke that use Int32 for handles instead of IntPtr)
  4. The same as advantage of 64 bit operating systems vs x86 ones
  5. If you're using 64 bit Windows and VS2010, then you have all you need to develop .net x64
千纸鹤 2024-10-16 17:49:27
  1. 如果您正在为任何 CPU 编译代码,x64 会尝试将本机外部 DLL 作为 x64 版本加载。如果该 DLL 是 32 位,这可能会出现问题。它抛出异常。
  2. 是的,您可以将其构建为任何 CPU
  3. 。 1
  4. 它(可以)在内部使用操作系统的 x64 优势,例如 4GB+ 内存等。
  5. 不,这是默认由 .NET 安装程序完成的。
  1. If you are compiling your code for Any CPU, a x64 tries to load native, external DLLs as x64 version. That might be problematic if that DLL is 32-bit. It throws an exception.
  2. Yes, you can build it as Any CPU
  3. s. 1
  4. It (can) internally use x64 advantages of the operating system like 4GB+ memory etc.
  5. No, this is done by .NET installer by default.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文