本文介绍了如何确定.NET程序集是专为x86或x64?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有.NET程序集的任意列表。
I've got an arbitrary list of .NET assemblies.
我需要以编程方式检查每个DLL是专为86(而不是到x64或任何CPU)。这可能吗?
I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?
推荐答案
看 System.Reflection.AssemblyName.GetAssemblyName(字符串assemblyFile)
您可以检查从返回的AssemblyName实例集元数据:
You can examine assembly metadata from the returned AssemblyName instance:
[36] C:\> [reflection.assemblyname]::GetAssemblyName("${pwd}\Microsoft.GLEE.dll") | fl
Name : Microsoft.GLEE
Version : 1.0.0.0
CultureInfo :
CodeBase : file:///C:/projects/powershell/BuildAnalyzer/...
EscapedCodeBase : file:///C:/projects/powershell/BuildAnalyzer/...
ProcessorArchitecture : MSIL
Flags : PublicKey
HashAlgorithm : SHA1
VersionCompatibility : SameMachine
KeyPair :
FullName : Microsoft.GLEE, Version=1.0.0.0, Culture=neut...
下面,ProcessorArchitecture确定目标平台。
我使用的PowerShell在这个例子中要调用的方法。
I'm using PowerShell in this example to call the method.
这篇关于如何确定.NET程序集是专为x86或x64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!