是否有可能知道,如果是从.NET应用程序安装了.NET Framework? [英] Is it possible to know if .NET Framework is installed from a .NET application?

查看:150
本文介绍了是否有可能知道,如果是从.NET应用程序安装了.NET Framework?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的东西。我的.NET应用程序与pretty的丑陋一般异常故障崩溃时,我尝试在一台机器上没有安装.NET Framework上运行它。

Here's the thing. My .NET application crashes with a pretty ugly general exception fault when I try to run it in a machine that doesn't have .NET framework installed.

这是正常的吗?如果是......是有什么办法来检查.NET框架才能够正常退出呢?

Is this normal? If it is... is there any way to check for .NET framework to be able to exit gracefully instead?

推荐答案

您不能检查的.NET Framework的版本号是管理 code,因为它不能前执行加载.NET运行库。您可以使用CLR非托管API这样做的,但最好的方法是解决这个问题的办法是提供检查,下载,如果它没有在机器上安装的安装.NET框架的安装机制。

You can't check the version number of the .NET framework with managed code as it can't execute before loading the .NET runtime. You can use the CLR Unmanaged API to do so, but the best way is to solve this problem is to provide an installation mechanism that checks, downloads and installs .NET Framework if it's not installed on the machine.

这篇关于是否有可能知道,如果是从.NET应用程序安装了.NET Framework?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆