Search code examples
.net.net-3.5.net-2.0runtimejit

If I target .NET 2.0, can I still get runtime features from newer versions?


I'm pretty pleased with targeting .NET 2.0 for my XNA games on the basis that it is more widely available (and I can still use nice C# 3.0 language features).

But I recently came across an article saying that the .NET 3.5 SP1 JIT added inlining of value-type methods (something that, as a game developer, I use a lot of).

So my question is this: If my project targets .NET 2.0, and the user happens to have .NET 3.5 SP1 installed, will my program use the newer JIT?

(And what about the .NET 4.0 JIT and versions beyond that?)


Solution

  • Yes it will use it. The JIT is part of the CLR and .NET 2.0 and 3.5 SP1 use the same version of the CLR. .NET 3.5 SP1 brought improvements to the CLR compared to .NET 2.0 but it stays compatible.

    As far as .NET 4.0 and higher is concerned than it is another CLR version that your program won't use.