c# - Detect and install framework 4.5 when program execute -
c# - Detect and install framework 4.5 when program execute -
i have vs2013 ee winforms application target .net 4.5. when seek execute app under win7 without 4.5 framework installed exception window appears (0xc000007b). should set in app settings showing info window download framework option? don't want publish installation file, want exe dll-s publish not target.
try:
http://thecodeventures.blogspot.com/2012/12/c-how-to-check-if-specific-version-of.html
reffers msdn
http://msdn.microsoft.com/en-us/library/hh925568.aspx
private static void get45or451fromregistry() { using (registrykey ndpkey = registrykey.openbasekey(registryhive.localmachine, registryview.registry32).opensubkey("software\\microsoft\\net framework setup\\ndp\\v4\\full\\")) { int releasekey = convert.toint32(ndpkey.getvalue("release")); if (true) { console.writeline("version: " + checkfor45dotversion(releasekey)); } } } // checking version using >= enable forwards compatibility, // should compile code on newer versions of // framework ensure app works same. private static string checkfor45dotversion(int releasekey){ if ((releasekey >= 379893)) { homecoming "4.5.2 or later"; } if ((releasekey >= 379675)) { homecoming "4.5.1 or later"; } if ((releasekey >= 378389)) { homecoming "4.5 or later"; } // line should never execute. non-null release key should mean // 4.5 or later installed. homecoming "no 4.5 or later version detected"; }
kind regards
c# .net frameworks
Comments
Post a Comment