问题描述
在我的计算机上,我安装了 .NET Framework 2.0,然后安装了 .NET Fratmeworkt 3.0.但是最近我从一个程序中得到一个异常,说事件 1000,.NET 运行时 2.0 错误报告".我想知道,为什么这个程序仍然使用 .NET Runtime 2.0 而不是新版本.如何检查特定程序使用的 .NET Runtime 版本?可以改吗?
On my computer I have installed .NET Framework 2.0 then later .NET Fratmeworkt 3.0. However recently i get an exception from one program saying "Event 1000, .NET Runtime 2.0 Error Reporting". I'm wondering, why this program is still using .NET Runtime 2.0 instead the new version. How could I check which version of .NET Runtime a specific program uses? Is possible to change it?
推荐答案
.NET 运行时"实际上是指公共语言运行时"(CLR),对于 .NET 框架 2.0、3.0 和 3.5 已经是 2.0 版.只有在 .NET 4.0 中,CLR 版本也增加到 4.0(有很多问题是关于 SO 上的双版本的混淆,对于一个很好的概述,请参阅这个 回答).因此,您看到的消息可能令人困惑,但仍然是正确的.
The ".NET runtime" actually means the "Common Language Runtime" (CLR), which has been version 2.0 for the .NET framework 2.0, 3.0 and 3.5. Only with .NET 4.0 the CLR version was also incremented to 4.0 (there are a lot of questions an confusion about this dual versioning on SO, for a nice overview see this answer). So the message your seeing might be confusing but is still correct.
如果您尚未安装 .NET 4.0,则 .NET 运行时 2.0 是您计算机上唯一存在的版本.
If you haven't installed .NET 4.0, the .NET runtime 2.0 is the only version present on your machine.
您可能想知道应用程序是否实际上是针对 .NET 框架 3.0 (3.5) 而不是 .NET 框架 2.0 编译/构建的.
You might want to know if an application is actually compiled/build against the .NET framework 3.0 (3.5) instead of the .NET framework 2.0.
要获取此信息,您需要查看应用程序程序集的元数据,即存储对其他程序集(包括 .NET 框架本身的引用)的引用的位置 - 以及其他程序集的版本.
To get this information you need to look at the application assemblies' meta data, i.e. the place where references to other assemblies, including those of the .NET framework itself are stored - together with the version of those other assemblies.
要查看此信息,您可以使用 Reflector,或 .NET Framework SDK(或 Visual Studio)附带的 ILDASM.EXE
.
To view this information you can use Reflector, or ILDASM.EXE
which comes with the .NET Framework SDK (or Visual Studio).
例如,在您选择的二进制文件(可执行文件或 DLL)上使用 ILDASM.EXE
,然后打开MANIFEST"节点.你会看到这样的条目:
For example, using ILDASM.EXE
on a binary (executable or DLL) of your choice, then open the "MANIFEST" node. You'll see entries like this:
.assembly extern System.Windows.Forms
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.ver 4:0:0:0
}
在这种情况下,这是从 .NET 4.0 应用程序中获取的,并且仅引用 System.Windows.Forms.dll
,但我想你明白了.
In thise case this was taken from a .NET 4.0 application and only refers to System.Windows.Forms.dll
, but I think you get the picture.
您可以(部分)影响应用程序使用的运行时版本,方法是指定 <supportedRuntime>
元素在应用程序的配置文件中.有关此问题的更多讨论,请参阅 this Stack Overflow question,在 其他.
You can (partly) influence which version of the runtime an application uses, by specifying the <supportedRuntime>
element in your application's configuration file. For more discussion on this see this Stack Overflow question, among others.
这篇关于.net runtime 2.0 而不是最新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!