程序安装时检查是否已经安装.NETFramework
2005-12-30 04:39
429 查看
添加新项中添加一个安装程序类
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 ge
aeef
nerated 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;
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 ge
aeef
nerated 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 [转]
- 程序安装时检查是否已经安装.NETFramework
- 程序安装时检查是否已经安装.NETFramework
- 程序安装时检查是否已经安装.NETFramework
- 检查机器是否安装了.NET Framework 或已经安装了哪些.net版本
- C++检测系统是否已经安装了.NET Framework
- 用dos批处理程序检测是否安装.netframework,并自动安装后运行指定程序(.net自启动光盘的制做)
- 怎样从ASP.NET程序判断客户端是否安装了.NET Framework
- 怎样用ASP.NET(C#)程序判断客户端是否安装了.NET Framework
- 在Inno Setup制作的安装包中利用Pascal脚本检查安装,卸载前检查程序是否已经启动 [转载]
- 用dos批处理程序检测是否安装.netframework,并自动安装后运行指定程序(.net自启动光盘的制做)
- 检查PC是否安装NET  Framework
- Setup Factory 打包程序 --程序安装前判断本机是否安装.NET Framework和SQL Server
- 程序运行初期检查是否已经有一个自身的进程在运行,保证一台PC机器只运行一个程序
- 安装程序自动检测安装.Net Framework运行环境(使用InnoSetup)
- 不安装.NET Framework 运行C#.NET程序
- 检查RPM包是否已经安装
- 检查机器是否安装有.net