Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running software built for .NET 3.5 on a system with only .NET 2.0 installed

How far along does software compiled for .NET 3.5 get before crashing on a system that only has .NET 2.0 installed?

The application I am developing uses WPF and requires .NET 3.5, but I would like to display a user-friendly dialog (rather than crashing) if the user does not have it installed.

Are there any standard ways to do this, or official Microsoft documentation on it?


EDIT: In an ideal world I'd just check that any .NET dependencies are satisfied during installation. Since some applications do not have installers and since users could potentially uninstall .NET after the application is installed, I find the answers below to be useful.

like image 779
sourcenouveau Avatar asked Feb 04 '23 09:02

sourcenouveau


1 Answers

It (probably) wont crash until it tries to use a dll that needs 3.5. If the executing app can check the version before using any 3.5 specific dlls, you can display a winform dialog and you should be ok. Your safest bet would be to make the exe be a 2.0 assembly and make all of your 3.5 stuff in a separate dll that is compiled against 3.5. You could do your check in the 2.0 dll before it loads any of your 3.5 assemblies.

like image 177
NotDan Avatar answered Feb 05 '23 22:02

NotDan