我正在开发自定义操作以将同一文件安装到多个文件夹(在运行时确定)。WIX中的托管(C#)自定义操作不起作用(错误代码1154)
自定义操作驻留在Wix C#自定义操作项目中。 它的代码如下所示:
public class CustomActions
{
[CustomAction]
public static ActionResult InstallToTrunks(Session session)
{
// some logic
}
}
相关维克斯标记看起来是这样的:
<Binary Id='CustomActions' SourceFile='..\CustomActions\bin\$(var.Configuration)\CustomActions.dll' />
<CustomAction Id='InstallToTrunks' BinaryKey='CustomActions' DllEntry='InstallToTrunks' Execute='deferred' Return='check'/>
<InstallExecuteSequence>
<Custom Action='InstallToTrunks' After='InstallInitialize'></Custom>
</InstallExecuteSequence>
然而,当我尝试运行安装程序,它失败,并记录说: CustomAction InstallToTrunks返回实际的错误代码1154(注意,如果翻译发生在沙箱内,这可能不是100%准确的)
任何帮助将是非常受欢迎的。 或者,如果您有关于如何实现我想要做的事情(将同一文件安装到只能在retuntime中确定的多个文件夹中)的建议,则无需CustomActions,这也会有所帮助。
谢谢。
没有昂贵的行为的一种方法是将文件添加为功能。如果您需要将其安装在3个不同的路径中,请添加三个功能,每个功能都包含该文件。该功能应该使用属性“ConfigurableDirectory”。也许这可以帮助你解决与costum行动的问题:[Similar problem](http:// stackoverflow。com/questions/3560370/custom-action-in-c-used-via-wix-fails-with-error-1154) – Skalli