2017-09-25 40 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

相關問題