2017-09-25 81 views
1

我想通过单击某个按钮来触发某些自定义操作。将自定义操作链接到用户界面按钮控件时出错

我得到返回值1,但自定义操作没有运行。

这是我的日志:

Action start 17:09:39: CA1. 

MSI (c) (08:00) [17:09:39:220]: Invoking remote custom action. DLL: C:\Users\ARKADY~1\AppData\Local\Temp\MSI87D6.tmp, Entrypoint: CustomAction1 

MSI (c) (08:EC) [17:09:39:222]: Cloaking enabled. 

MSI (c) (08:EC) [17:09:39:223]: Attempting to enable all disabled privileges before calling Install on Server 

MSI (c) (08:EC) [17:09:39:224]: Connected to service for CA interface. 
Action ended 17:09:39: CA1. Return value 1. 

我的自定义操作是:

[CustomAction] 
    public static ActionResult CustomAction1(Session session) 
    { 
     session.Log("Begin CustomAction1"); 

     return ActionResult.Success; 
    } 

正如你可以看到在日志中没有 “开始CustomAction1” 条目。

我的自定义操作配置:

<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" /> 
    <supportedRuntime version="v2.0.50727"/> 
    </startup> 
</configuration> 

从维克斯代码声明CA:

<Binary Id="CA" SourceFile="$(var.CustomAction1.TargetDir)$(var.CustomAction1.TargetName).CA.dll" /> 
<CustomAction Id="CA1" BinaryKey="CA" DllEntry="CustomAction1" Execute="immediate" Return="check"/> 

UI结合:

<Control Id="ManualUpdateButton" Type="PushButton" X="14" Y="188" Width="95" Height="17" Text="Manual Update"> 
     <Publish Event="DoAction" Value="CA1" Order="1">1</Publish> 
    </Control> 

回答

3

自定义操作运行时,它只是不记录任何东西。这是MSI的局限性 - 您无法通过UI中由DoAction调用的自定义操作写入日志。

+0

我想手动写一个字符串数组到一个文件,然后! – Craig

相关问题