.NET框架得到运行的处理器架构 [英] .NET Framework get running processor architecture

查看:140
本文介绍了.NET框架得到运行的处理器架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有所有支持的处理器架构的一个枚举此处的http://msdn.microsoft.com/en-us/library/system.reflection.processorarchitecture.aspx

There is an enum of all supported processor architectures here: http://msdn.microsoft.com/en-us/library/system.reflection.processorarchitecture.aspx

有没有什么办法,以确定哪一个对应的运行环境? 。System.Reflection.Assembly.GetExecutingAssembly()的ProcessorArchitecture返回MSIL - 显然是错误的。

Is there any way to determine which one corresponds to the running environment? System.Reflection.Assembly.GetExecutingAssembly().ProcessorArchitecture returns MSIL -- obviously wrong.

编辑:博扬雷斯尼克张贴了答案,将其删除。我看到一些澄清从部分跟踪我有必要的。

Bojan Resnik posted an answer and deleted it. I see that some clarification is needed from the partial trace I got.

该组件需要在多个架构上运行,并以此为基础进行的运行过程是接受汇编指令不同的事情。从本质上讲,我需要选择要加载哪个版本的本机DLL的。我有一个为每个架构。

The assembly needs to run on multiple architectures and do different things based on what assembly instructions the running process accepts. Essentially, I need to select which version of a native DLL to load. I have one for each architecture.

推荐答案

P /调用的GetSystemInfo 是微不足道的.Net和轻得多的重量比WMI。此外,它返回架构的过程中看到这样一个x64的机器上的一个WOW的过程中会看到x86和本机进程会看到64位。

P/Invoking GetSystemInfo is trivial from .Net and is much lighter weight than WMI. Also, it returns the architecture as seen by the process so on a x64 machine a WOW process will see x86 and a native process will see x64.

这篇关于.NET框架得到运行的处理器架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆