【发布时间】:2012-03-04 03:48:36
【问题描述】:
我正在使用 Wix 安装应用程序和服务,我想更改 msi 表(session.database)中的值。
我尝试使用自定义操作来执行此操作,我可以使用 select 语句从表中选择值,但如果我尝试插入,设置会失败。
我的代码:
[CustomAction]
public static ActionResult MyCustomAction1(Session session)
{
ServiceController serviceController = new ServiceController(serviceName);
//-----Works fine-----
res=session.Database.ExecuteIntegerQuery("select ServiceType from ServiceInstall where StartType=4");
//----Makes the setup fail
session.Database.Execute("insert into ServiceInstall (ServiceInstall) values ('a')");
return ActionResult.Success;
}
是否可以通过自定义操作插入值?
谢谢
谢谢' 我试过这个: session.Database.Execute("插入到 ServiceInstall (Name) values ('ezm') TEMPORARY");
但我得到以下异常: 异常:函数在执行过程中失败。数据库:表更新失败。
【问题讨论】:
标签: c# wix windows-installer custom-action