我正在開發自定義操作以將同一文件安裝到多個文件夾(在運行時確定)。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