2

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?

user972543
  • 21
  • 2

3 Answers3

3

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.

If you haven't installed .NET 4.0, the .NET runtime 2.0 is the only version present on your machine.

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.

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.

To view this information you can use Reflector, or ILDASM.EXE which comes with the .NET Framework SDK (or Visual Studio).

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 )                         // .z\V.4..
  .ver 4:0:0:0
}

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.

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.

Community
  • 1
  • 1
Christian.K
  • 47,778
  • 10
  • 99
  • 143
2

It all depends on which version of .NET the application in question was compiled against. The developer selects the target framework. As far as I know, end users can't change which version of the libraries are used after deployment. If the application was targeted for 2.0, even if you have 4.0 installed, it will always run on the 2.0 version of the libs.

Jonathan Henson
  • 8,076
  • 3
  • 28
  • 52
2

Runtime is the keyword. There have been only 4 distinct versions of the runtime: 1.0, 1.1, 2.0 and 4.0. You are still using version 2.0.50727 of the CLR and the jitter. And mscorlib.dll and other core .NET framework assemblies are still 2.0.0.0

You definitely got a lot more goodies added when you installed .NET 3.0, a bunch of new assemblies that supports things like WCF, WPF and Linq and a new version of the C# compiler. Enough to warrant a version number increase even though they didn't require a new version of the runtime.

The same thing will happen with the next version of .NET, 4.5. The runtime version stays the same, 4.0.30319

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Great answer, I don't have a good overview of this. Here is a nice little toy though: https://dotnet.microsoft.com/platform/dotnet-standard - try the drop down a bit down the page. Also here: https://learn.microsoft.com/en-us/dotnet/standard/net-standard - just for a few extra links from 2020. – Stein Åsmul Jul 09 '20 at 17:07
  • OK, I will stick with MSI questions. Just learned of the [ element](https://stackoverflow.com/questions/62692009/wix-installer-failing-on-windows-server-2012-r2?noredirect=1#comment111091013_62692009). Still confused :-). – Stein Åsmul Jul 09 '20 at 18:56