如何检查是否安装.NET Framework [C#/ WPF] [英] How To Check If The .Net Framework Is Installed [C# / WPF]

查看:802
本文介绍了如何检查是否安装.NET Framework [C#/ WPF]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开始我的应用程序(在窗体的Load)我要检查并确保.NET框架(3.5或更高)被安装在计算机上之前 - 如果不是我想提示用户下载并安装它(简单的MessageBox对同一个链接的Microsoft网页将是最好的主意,不是吗?) 因此,这实际上需要执行两个问题...

Before starting my application (on Form Load) I want to check and ensure that the .NET framework (3.5 or higher) are installed on the machine - if not I want to prompt the user to download and install it (simple MessageBox with a INTERNET LINK to the Microsoft WebPage would be the best idea no?) So, this actually entails two questions...

一)如何确定是否已安装了.NET Framework 3.5或更高版本? (我不相信或仅仅想查找C:\ Program Files文件\ Microsoft.NET文件夹中,似乎容易出错不是吗?) 看到因为这是如此的很关键的,必须有一个很好的方式,在C#中,以确定哪些版本的.NET的用户他的机器上运行?我只是不知道如何..

a) How do I DETERMINE IF .NET FrameWork 3.5 or higher are installed? (I don't trust or want to just look for the C:\Program Files\Microsoft.NET folder, seems error-prone no?) Seeing as this is so very crucial there must be a nice way in C# to determine what version of .NET the user has running on his machine? I just have no clue how..

二)我如何粘贴的互联网链接(超链接?)的一个消息?因此,如果用户不具备.NET框架(1.1或2.0)安装我可以让他们只需点击链接去下载呢?

b) HOW do I paste an INTERNET LINK (hyperlink?) in a MessageBox? So that if the user does NOT have the .NET framework (1.1 or 2.0) installed I can have them simply click on the link to go download it?

任何帮助/提示将不胜AP preciated。

Any help/hints would be greatly appreciated.

谢谢, 丁

推荐答案

a)你将不得不使用非.NET语言(C ++,VB6等引导程序)(其他海报是正确的 - 如果未安装框架中,.NET程序将无法运行)。一个例子是在这里:

a) You would have to bootstrap the program with a non .NET language (C++, VB6, etc) instead of Form_Load (other posters are correct - if the framework isn't installed, the .NET program won't run). An example is here:

HTTP://www.$c$cproject.com/KB/ MCPP / DotNetTester.aspx

b)你不能把一个超链接在一个MessageBox,所以你就必须创建自己的弹出式对话框(表格)。 编辑:这表格/对话框将必须在引导程序

b) You can't put a hyperlink in a MessageBox, so you would have to create your own popup dialog (a form). That form / dialog would have to be in the bootstrap program.

这篇关于如何检查是否安装.NET Framework [C#/ WPF]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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