rhe*_*980 4 c# custom-action wix
我遇到了wix和托管自定义操作的问题:在我的自定义操作中,我创建了一个文件并将其保存在INSTALLLOCATION路径中.它似乎工作,没有抛出异常.但是在安装之后,刚刚创建的文件在INSTALLLOCATION中不存在.
维克斯 - 文件:
<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>
Run Code Online (Sandbox Code Playgroud)
定制操作-了Methode:
...
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);
...
Run Code Online (Sandbox Code Playgroud)
有人有想法吗?
编辑:在Scott Boettger的帖子后编辑了wix文件内容.
我不认为你的配置是正确的.以下是一些问题:
尝试进行这些修改,看看问题是否仍然存在.
我相信您的自定义操作需要介于InstallInitialize和InstallFinalize之间.试试这个:
<InstallExecuteSequence>
<Custom Action="SetInstallPath" After="InstallInitialize"/>
<Custom Action="CreateTimeStamp" Before="InstallFinalize"/>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)