//判断是否已经安装iis
public static bool ExistSqlServerService(string tem)
{
bool ExistFlag = false;
ServiceController[] service = ServiceController.GetServices();
for (int i = 0; i < service.Length; i++)
{
if (service[i].ServiceName.ToString() == tem)
{
ExistFlag = true;
}
}
return ExistFlag;
}
}
//判断是否安装netFramework
private static bool GetDotNetVersions()
{
bool result = false;
DirectoryInfo[] directories = new DirectoryInfo(
Environment.SystemDirectory + @"\..\Microsoft.NET\Framework").GetDirectories("v?.?.*");
//string list = "";
foreach (DirectoryInfo info2 in directories)
{
//list +=info2.Name.Substring(0,4)+",";
if (info2.Name.Substring(0, 4) == "v3.5")
{
result = true;
}
}
return result;
}
//检测是否安装ASPnet,通过注册表
string value = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\InetStp\\Components", "ASPNET", null).ToString();
if (value != null )
{
label12.Text += ",ASPNET已安装";
}