halivingston
halivingston

Reputation: 3895

How do I know which version of the .NET Framework my program is running on?

I have a program which I believe to be running in .NET 4.0, but I am unable to mixed-mode debug it (something new .net 4.0 for 64-bit application)

I wanted to confirm if I'm truly running in .NET 4.0 or is it running .NET 3.5

Is there a way to look in the memory space or something?

Upvotes: 4

Views: 4027

Answers (3)

csharptest.net
csharptest.net

Reputation: 64248

This returns the .Net runtime version as a string:

System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion()

You can also get the install directory as well:

System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()

goto msdn

Upvotes: 1

logicnp
logicnp

Reputation: 5836

typeof(int).Assembly.ImageRuntimeVersion will give you the version of the mscorlib assembly loaded in your process.

Upvotes: 1

Gonzalo
Gonzalo

Reputation: 21175

Different options are:

  • Check the value of Environment.Version
  • typeof (int).Assembly.GetName ().Version: this will give you the running mscorlib.dll assembly version.
  • Use Process Explorer if you can't change the code. Then check which version of mscorlib is loaded and from where.

Upvotes: 10

Related Questions