.NET Versioning Riddle

We have a .NET application compiled with .NET Framework 4.5 as a target.

The riddle is: why does this application work on Windows 7 with only .NET Framework 4.0 installed but not on Windows Server 2003 with the same .NET Framework 4.0 installed?

The answer it twofold. The first part is easy:

1. Why does the application compiled with .NET Framework 4.5 as a target even works with .NET Framework 4.0?

It is because the CLR is still the same. It is 4.0. Have a look with ildasm at a simple exe or dll targeted for .NET Fraemwork 4.5 and you will see:


So the app will work but, as Microsoft puts it in “We do not recommend running apps that target a later version of the .NET Framework on the an earlier version of the .NET Framework.” So it will work up until the time where you access some specific .NET 4.5 functionality where it will crash.

So I guess if you want your app to be specific about the minimal .NET Framework Version it needs, you will have to check it yourself. For example as suggested in here:

2. The second part of the question is more tricky. Why does it work with .NET Framework 4.0 in Windows 7 but not with the same .NET Framework 4.0 in Windows Server 2003?

As it turnes out (I have not found the answer at Microsoft but on StackOverflow: the compiler for the app targeting .NET Framework 4.5 sets the file header ( to be compatible with Windows Version 6.0 (Vista and up – or newer. You can check it out by using dumpbin /headers from VS command line:


4.00 operating system version
0.00 image version
4.00 subsystem version

If you compile the app with .NET Framework 4.0 as a target the file header looks like this:


4.00 operating system version
0.00 image version
6.00 subsystem version

So the minimal Windows version is 4.0 being Windows 95 and up.

Leave a Reply

Your email address will not be published. Required fields are marked *