0

Have a question related to backwards compatibility. I always thought that the backwards compatibility was in regards to if I compiled something on a lower .net Version, thus not needing to install that prior version if I have a superior version already installed in order to be able to run it on a client machine.

But apparently this also applies to compiling a project in .net 4.8 and running it on a System where .net 4.8 isn't installed. For example, I used a Windows 7 SP1 VM where only .net 4 Client Profile is installed. To test this out I created a small WPF application that has two Buttons.

Button #1 is async and is calling an async function, something that's not supported in .net 4

Button #2 is something completely simple, just calling a MessageBox, nothing special.

My VM can run the .net 4.8 compiled .exe just fine, the two Buttons appear, Button #2 outputs my MessageBox, and it only gives an exception if I run whatever I implemented in Button #1, which would require .net 4.8 (PresentationCore TypeLoad Exception).

I wasn't aware that this was possible, I always thought that it would give an error that .NET 4.8 is not installed if I tried to run something compiled on that version.

TL;DR - Is there documentation somewhere in MSDN or a Blog Post from the .NET Devs that confirms it being normal behavior the possibility of running applications compiled on a newer .net Version that's not installed on the Client OS?

Steven Borges
  • 401
  • 1
  • 3
  • 16
  • 1
    Please, have a look at this [thread](https://stackoverflow.com/questions/55791597/can-c-sharp-projects-that-have-4-7-2-target-framework-version-run-on-net-4-6-1/55791835#55791835) I've already answered the similar question – Pavel Anikhouski Jan 17 '20 at 13:42
  • 1
    [this](https://weblog.west-wind.com/posts/2012/Mar/13/NET-45-is-an-inplace-replacement-for-NET-40) will also be helpful – Pavel Anikhouski Jan 17 '20 at 13:46
  • Thanks for the info Pavel, I'll check those out, wasn't aware that this was possible but after my tests it's like on what you mentioned in the other test, runs fine until you try to execute something not supported by the Client. – Steven Borges Jan 17 '20 at 13:47
  • All .NET 4.x versions are in-place updates of CLR version 4, per this [document](https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies). If you aren't using any specific features of .NET 4.8, it should be not problems with your code – Pavel Anikhouski Jan 17 '20 at 13:50

0 Answers0