程序安装时检查是否已经安装.NETFramework
来源:互联网 发布:人像识别软件 编辑:程序博客网 时间:2024/05/01 04:28
添加新项中添加一个安装程序类
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
namespace DOTNETCheck
{
/**//// <summary>
/// CheckDotnet 的摘要说明。
/// </summary>
[RunInstaller(true)]
public class CheckDotnet : System.Configuration.Install.Installer
{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CheckDotnet()
{
// 该调用是设计器所必需的。
InitializeComponent();
// TODO: 在 InitComponent 调用后添加任何初始化
}
Component Designer generated code#region Component Designer generated code
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
public override void Install(System.Collections.IDictionary stateSaver)
{
//入口
RegistryKey key=null;
key = Registry.LocalMachine.CreateSubKey("Software//Microsoft//.NETFramework//policy//v1.0");
if(key==null||key.GetValue("3705")==null)
{
Process MyProcess=new Process();
MyProcess.StartInfo.FileName="dotnetfx.exe";
MyProcess.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
MyProcess.Start();
MyProcess.WaitForExit(); //等待程序执行
MyProcess.Close();
}
}
}
}
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
namespace DOTNETCheck
{
/**//// <summary>
/// CheckDotnet 的摘要说明。
/// </summary>
[RunInstaller(true)]
public class CheckDotnet : System.Configuration.Install.Installer
{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CheckDotnet()
{
// 该调用是设计器所必需的。
InitializeComponent();
// TODO: 在 InitComponent 调用后添加任何初始化
}
Component Designer generated code#region Component Designer generated code
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
public override void Install(System.Collections.IDictionary stateSaver)
{
//入口
RegistryKey key=null;
key = Registry.LocalMachine.CreateSubKey("Software//Microsoft//.NETFramework//policy//v1.0");
if(key==null||key.GetValue("3705")==null)
{
Process MyProcess=new Process();
MyProcess.StartInfo.FileName="dotnetfx.exe";
MyProcess.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
MyProcess.Start();
MyProcess.WaitForExit(); //等待程序执行
MyProcess.Close();
}
}
}
}
- 程序安装时检查是否已经安装.NETFramework
- 程序安装时检查是否已经安装.NETFramework [转]
- 程序安装时检查是否已经安装.NETFramework
- 检查app是否已经安装
- Asp检查组件是否已经安装函数
- 检查RPM包是否已经安装
- inno setup检查是否已经安装
- JavaScript检查ActiveX控件是否已经安装过
- JavaScript检查ActiveX控件是否已经安装过
- 根据包名检查apk是否已经安装
- android 根据package name检查apk是否已经安装
- 在Inno Setup制作的安装包中利用Pascal脚本检查安装,卸载前检查程序是否已经启动 [转载]
- 使用病毒库检查手机中已经安装的程序
- 如何判断MSI安装程序是否已经安装
- 检查是否本程序已经在运行
- c++检查程序是否已经启动
- 检查应用是否安装
- 检查ndk是否安装
- 原始森林历险记 - 从C++到C99 (1)
- 制作基于工程的测试方案
- 第一次用blog
- Vs2005里如何移出引用?(web项目)
- ASP.NET程序中常用的三十三种代码
- 程序安装时检查是否已经安装.NETFramework
- 灰鸽子全程剖析(转载)
- 但愿人长久,码稀兮
- 建议使用DispatchAction
- SQL常用命令
- 年前的更新。
- 盖茨写给中国人的明信片
- J2ME中的时区(TimeZone)类使用
- 读书文摘