Detect which version of .Net is installed? (.Net 3.5 not running on .Net 4)
Despite Mircrosoft's assurances later .Net will always be backward compatible ( http://msdn.microsoft.com/e开发者_运维百科n-us/library/bb822049.aspx ) my .Net 3.5 SP1 app does not run a box with .Net4.....
The user is presented with an error that sheds no light on why the app will not run:
"Unable to find a version of the runtime to run this application."
Great.
So I would like write another app altogether that will run and check if they can run the app, proabably in C++. How can I check what version of .Net is installed and if for sure my app .Net app will run otherwise point the user in the right direction to install the required .Net?
Check the registry.
Your .Net 3.5 app should still be able to run, but you'll have to add an entry to your application config file to opt your application into running on .NET Framework 4:
<configuration>
<startup>
<supportedRuntime version = "v4.0"/>
</startup>
</configuration>
精彩评论