1

我有一个用 C# 编写的 CustomAction。我想在我的 wix 安装程序代码中调用 DllEntry 两次。我怎样才能做到这一点?我正在通过以下方式执行此操作。但这对我有用。有没有其他公平的方法来做到这一点?

C#代码:

[CumtomAction]
public static ActionResult SymbolicLink(Session session)
{
     string s1=session.CustomActionData["value1"];
     string s2=session.CustomActionData["value2"];
       //mycode;
}

维克斯代码:

<CustomAction Id="ca" Property="dllCA" Value="value1='one';value2='two'" />
<CustomAction Id="dllCA" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>

<CustomAction Id="ca1" Property="dllCA1" Value="value1='three';value2='four'" />
<CustomAction Id="dllCA1" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>

<InstallExecuteSequence>
 <Custom Action="ca" Before="InstallFinalize"></Custom>
 <Custom Action="dllCA" After="ca"></Custom>

 <Custom Action="ca1" Before="InstallFinalize"></Custom>
 <Custom Action="dllCA1" After="ca1"></Custom>
</InstallExecuteSequence>
4

1 回答 1

0

定义一次就足够了,确保在调用SymbolicLink自定义操作之前正确设置属性:

<CustomAction Id="ca" Property="SymbolicLink" Value="value1='one';value2='two'" />
<CustomAction Id="ca1" Property="SymbolicLink" Value="value1='three';value2='four'" />
<CustomAction Id="dllCA" BinaryKey="InstallerLibrary" DllEntry="SymbolicLink" Execute="deferred"/>

<InstallExecuteSequence>
  <Custom Action="ca" Before="InstallFinalize"></Custom>
  <Custom Action="dllCA" After="ca"></Custom>

  <Custom Action="ca1" Before="InstallFinalize"></Custom>
  <Custom Action="dllCA" After="ca1"></Custom>
</InstallExecuteSequence>
于 2013-02-15T09:08:15.877 回答