c# - Feature-specific compatibility of a .NET 4.5 application on a system with .NET 4.0 -
i have project runs fine on 4.0, in interests of utilizing new zipfile class have decided target 4.5. vast majority of users have 4.5+ installed, not impossible 4.0 may come along , try use software.
since runs fine on 4.0, exception of zipfile class, can target 4.5, , if 4.0 detected disables particular codepath , continue run in other aspects?
i assume can't make backwards-compatibility mode (at all?), due having had reference 4.5 assembly utilize zipfile in first place.
on side note, have implemented detection of framework version installed. can quite disable section of code if <4.5 detected.
the easiest way load required code dynamically.
you use reflection required assembly, class , members if .net 4.5 detected. cache results in delegates, avoid reflecting every time.
you use plug-in system plug-in adds zip file support targets .net 4.5, main application targets .net 4.0. main application determines whether can load plug-in.
but suggested, targeting .net 4.5 , avoiding .net 4.0 features, discourage. don't know .net 4.5 features used implicitly, if .net 4.5 targeted. breaks many nuget packages, wrongly install .net 4.5 version when need 4.0 version. breaks async
. breaks more.
Comments
Post a Comment