【发布时间】:2015-02-06 09:08:18
【问题描述】:
关于该主题有多个问题,我尝试了所有解决方案,但对我没有任何帮助。
问题是它“确实”在安装了 Visual Studio 的机器上工作,但在其他电脑上却不能工作。这使得调试变得非常困难。
自定义动作代码为:
[CustomAction]
public static ActionResult EnumerateSqlServers(Session session)
{
MessageBox.Show("start EnumerateSQLServers"); // the message is not showing.
ActionResult result;
DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
DataRow[] rows = dt.Select(string.Empty);//, "IsLocal desc, Name asc");
result = EnumSqlServersIntoComboBox(session, rows);
return result;
}
日志文件显示:
MSI (c) (2C:1C) [11:16:42:338]: Doing action: EnumerateSqlServersAction
Action 11:16:42: EnumerateSqlServersAction.
Action start 11:16:42: EnumerateSqlServersAction.
MSI (c) (2C:34) [11:16:42:385]: Invoking remote custom action. DLL: C:\Users\Test\AppData\Local\Temp\MSI9328.tmp, Entrypoint: EnumerateSqlServers
MSI (c) (2C:E8) [11:16:42:385]: Cloaking enabled.
MSI (c) (2C:E8) [11:16:42:385]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (2C:E8) [11:16:42:385]: Connected to service for CA interface.
Action ended 11:16:42: EnumerateSqlServersAction. Return value 3.
DEBUG: Error 2896: Executing action EnumerateSqlServersAction failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: EnumerateSqlServersAction, ,
Action ended 11:16:42: WelcomeDlg. Return value 3.
MSI (c) (2C:44) [11:16:42:635]: Doing action: FatalError
Action 11:16:42: FatalError.
Action start 11:16:42: FatalError.
Action 11:16:42: FatalError. Dialog created
Action ended 11:16:43: FatalError. Return value 2.
Action ended 11:16:43: INSTALL. Return value 3.
MSI (c) (2C:44) [11:16:43:370]: Destroying RemoteAPI object.
MSI (c) (2C:E8) [11:16:43:385]: Custom Action Manager thread ending.
我确实尝试过这样的空操作:
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
MessageBox.Show("");
return ActionResult.Success;
}
该操作有效!它显示一个空的消息框。
编辑:经过大量测试,当我评论此行时,我发现问题出在 enumSQLServer 上。
SmoApplication.EnumAvailableSqlServers(false);
【问题讨论】:
标签: c# wix custom-action wix3.8