照做了个安装程序,但是这副图
http://www.bc-cn.net/bbs/showimg.asp?BoardID=117&filename=2006-7/200672515365997656.jpg
写的是.net1.1的注册表写法啊,如果是2.0的,需要怎么写呢?
我自己写了个2.0的,然后就不知道怎么弄了
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Reflection;
using Microsoft.Win32;
using System.Diagnostics;
namespace WindowsApplication1
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
RegistryKey key = null;
key = Registry.LocalMachine.CreateSubKey("software\\Microsoft\\.NetFramework\\policy\\v2.0");
if(key==null||key.GetValue("50727")==null)
{
Process mypro = new Process();
mypro.StartInfo.FileName = "dotnetfx.exe";
mypro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
mypro.Start();
mypro.WaitForExit();
mypro.Close();
}
}
}
}