[英]Wix: Write File in Custom Action
我遇到了wix和管理自定義操作的問題:在我的自定義操作中,我創建了一個文件並將其保存在INSTALLLOCATION路徑中。 似乎它有效,沒有拋出異常。 但安裝后,剛剛創建的 File 不存在於INSTALLLOCATION中。
WiX 文件:
<CustomAction Id="SetInstallPath" Property="CreateTimeStamp" Value="[INSTALLLOCATION]"
Execute="immediate"/>
<CustomAction Id="CreateTimeStamp" BinaryKey="SetupActions.dll"
DllEntry="CreateTimeStampFile" Execute="deferred" Return="check"/>
<InstallExecuteSequence>
<Custom Action="SetInstallPath" Before="InstallFinalize"/>
<Custom Action="CreateTimeStamp" Before="InstallFinalize"/>
</InstallExecuteSequence>
自定義操作方法:
...
var keys = new string[session.CustomActionData.Keys.Count];
session.CustomActionData.Keys.CopyTo(keys, 0);
var cad = keys[0];
var filepath = cad + "myfile.xml";
File.Create(filepath);
...
任何人的想法?
已編輯:在 Scott Boettger 發布后,您編輯了 wix 文件內容。
我不認為你的配置是正確的。 以下是一些問題:
嘗試進行這些修改,看看問題是否仍然存在。
我相信您的自定義操作需要介於 InstallInitialize 和 InstallFinalize 之間。 嘗試這個:
<InstallExecuteSequence>
<Custom Action="SetInstallPath" After="InstallInitialize"/>
<Custom Action="CreateTimeStamp" Before="InstallFinalize"/>
</InstallExecuteSequence>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.