.net 制作安装包

guest78978 2008-10-21 11:42:55
用.net制作安装文件,在进行安装时修改host文件内容,要怎么才能实现呢?
...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
贫僧又回来了 2008-10-21
  • 打赏
  • 举报
回复
namespace ClassLibrary1 
{
[RunInstaller(true)]
public class Installer : System.Configuration.Install.Installer
{
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
Microsoft.Win32.RegistryKey hklm = Registry.LocalMachine;
Microsoft.Win32.RegistryKey software = hklm.OpenSubKey("SOFTWARE", true);
Microsoft.Win32.RegistryKey aimdir = software.CreateSubKey("管理系统");
aimdir.SetValue("mica", this.Context.Parameters["targetdir"].ToString());
aimdir.SetValue("database","Emgn");
File.Delete(this.Context.Parameters["targetdir"] + "\\database.sql");//删除安装目录里的database.sql文件。

//你也可以在这里对其他文件进行操作!
}
}
}
wheeler 2008-10-21
  • 打赏
  • 举报
回复
绝对正解:写程序实现

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧