简体   繁体   English

检测安装了哪个版本的.Net? (.Net 3.5不在.Net 4上运行)

[英]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/en-us/library/bb822049.aspx ) my .Net 3.5 SP1 app does not run a box with .Net4..... 尽管Mircrosoft的保证稍后.Net将始终向后兼容( http://msdn.microsoft.com/en-us/library/bb822049.aspx )我的.Net 3.5 SP1应用程序不会运行.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++. 所以我想写另一个应用程序,它将运行并检查它们是否可以运行应用程序,可能是在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? 我如何检查安装了什么版本的.Net,如果确定我的app .Net应用程序将运行,否则指向用户正确的方向安装所需的.Net?

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 : 您的.Net 3.5应用程序仍然可以运行,但您必须在应用程序配置文件中添加一个条目,以选择您的应用程序在.NET Framework 4上运行

<configuration>
<startup>
    <supportedRuntime version = "v4.0"/>
</startup>
</configuration> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM