zoukankan
html css js c++ java
程序安装时检查是否已经安装.NETFramework
添加新项中添加一个安装程序类
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();
}
}
}
}
查看全文
相关阅读:
pat 1029. Median (25)
pat 1040. Longest Symmetric String (25)
pat 1037. Magic Coupon (25)
pat 1058. A+B in Hogwarts (20)
pat 1083. List Grades (25)
pat 1054. The Dominant Color (20)
pat 1042. Shuffling Machine (20)
pat 1061. Dating (20)
*分支-11. 计算工资
分支-10. 计算个人所得税
原文地址:https://www.cnblogs.com/ghd258/p/262052.html
最新文章
猴子吃桃
小鱼的航程
首字母大写
字符串连接
数组逆置
字符串去特定字符
字符串的查找删除
比较字符串
旅行
染色
热门文章
软件包管理器
树上操作
最小生成树计数
Tree
秘密的牛奶运输
黑暗城堡
构造完全图
北极通讯网络
pat 1015. Reversible Primes (20)
pat 1023. Have Fun with Numbers (20)
Copyright © 2011-2022 走看看