确定程序集的.NET Framework版本 [英] Determine Assembly's .NET Framework Version

查看:132
本文介绍了确定程序集的.NET Framework版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


如果我有一个.NET程序集,我如何确定它的哪个版本的.NET

框架.... br />
1)是编译为

2)应该使用

3)是否兼容?


是否有一个实用程序会以某种方式提取此信息?


谢谢!

-ZD

Hello,

If I have a .NET assembly, how do I determine what version of the .NET
framework it....
1) was compiled against
2) is supposed to use
3) is compatible with?

Is there a utility that will extract this info somehow?

thanks!
-ZD

推荐答案

1)编译时反对
2)应该使用


装载程序集后,你可以使用Assembly.ImageRuntimeVersion

检查运行时版本是否符合(存储在

元数据头中)。


大多数程序集还会引用该运行时版本中包含的Mscorlib.dll版本,因此您还可以使用此类工具检查

程序集的引用作为ILDASM。


3)与?兼容?
1) was compiled against
2) is supposed to use
Once the assembly is loaded, you can use Assembly.ImageRuntimeVersion
to check the runtime version ot was complied against (stored in the
metadata header).

Most assemblies will also reference the version of Mscorlib.dll that
was included in that runtime version, so you can also check the
assembly''s references with a tool such as ILDASM.

3) is compatible with?




这将很难p提供一个工具,可以证明装配是与某个版本兼容的
。最好测试它或询问

供应商。


Mattias


-

Mattias Sj?gren [MVP] mattias @ mvps.org
http:/ /www.msjogren.net/dotnet/ | http://www.dotnetinterop.com

请回复到新闻组。



It would be hard to provide a tool that could prove an assembly to be
compatible with a certain version. Better to test it or ask the
vendor.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


ZD写道:
3)兼容?




您应该检查App.Config文件,看看它是否有任何说明。如果没有,

假设它只与它编译的版本兼容。


-

Sven Groot

http://unforgiven.bloghorn.com



You should check for an App.Config file, see if it says anything. If not,
assume it''s only compatible with the version it was compiled against.

--
Sven Groot

http://unforgiven.bloghorn.com


您好Mattias,


感谢您的回复。


我试过使用ILDASM并查看清单。


对于已知使用.NET v1.1的程序集,我得到mscorlib:

..assembly extern mscorlib

{

.publickeytoken =(B7 7A 5C 56 19 34 E0 89)//

..z\V.4 ..

.ver 1:0:5000:0

}


什么是版本1:0:5000:0 ??


如果我去mscorlib.dll并查看其文件版本,它会说:1.1.4322.573


那么为什么没有ILDASM也表明了这一点吗?


谢谢

-ZD

" Mattias Sj?gren" <毫安******************** @ mvps.org>在消息中写道

news:eX ************** @ tk2msftngp13.phx.gbl ...
Hi Mattias,

Thanks for your reply.

I tried using ILDASM and looked at the manifest.

For an assembly known to be using .NET v1.1, I get this for mscorlib:
..assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) //
..z\V.4..
.ver 1:0:5000:0
}

What is version 1:0:5000:0 ??

If I go to mscorlib.dll and look at its file version, it says: 1.1.4322.573

So why doesn''t ILDASM show this too?

thanks
-ZD
"Mattias Sj?gren" <ma********************@mvps.org> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...
1)编译时反对
2)应该使用
1) was compiled against
2) is supposed to use



一旦加载了程序集,就可以使用Assembly.ImageRuntimeVersion
来检查运行时版本ot被编译(存储在
元数据头中)。

大多数程序集也会引用该运行时版本中包含的Mscorlib.dll版本,所以你还可以使用ILDASM等工具检查
程序集的引用。



Once the assembly is loaded, you can use Assembly.ImageRuntimeVersion
to check the runtime version ot was complied against (stored in the
metadata header).

Most assemblies will also reference the version of Mscorlib.dll that
was included in that runtime version, so you can also check the
assembly''s references with a tool such as ILDASM.

3)是否兼容?



很难提供一种可以证明装配与某个版本兼容的工具。最好测试它或询问供应商。

Mattias

-
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
请仅回复新闻组。



It would be hard to provide a tool that could prove an assembly to be
compatible with a certain version. Better to test it or ask the
vendor.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.



这篇关于确定程序集的.NET Framework版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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