维克斯:在自定义操作写入文件 [英] Wix: Write File in Custom Action

查看:206
本文介绍了维克斯:在自定义操作写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的威克斯的问题,管理的自定义操作:在我的自定义操作我创建了一个文件并将其保存在 INSTALLLOCATION 的路径。看起来一切正常,没有异常。但安装之后,刚刚创建的文件不存在在 INSTALLLOCATION

i got a problem with wix and managed custom actions: in my custom action i create a file and save it in the INSTALLLOCATION path. It seems like it works, no exception is thrown. But after the installation, the just created File not exists in the 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>



定制动作-了Methode:

Custom-Action-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);
...



任何人的想法? !在此先感谢

Anyone a idea? Thanks in advance!

罗宾

编辑:斯科特贝特格y中的文章后编辑的威克斯文件内容

Edited: After the post from Scott Boettger y edited the wix-file content.

推荐答案

我不认为你的配置是正确的。这里有一些问题:

I don't think your configuration is correct. Here are some of the problems:


  1. 您不应该在InstallExecuteSequence使用私有属性(CREATE_TIME_STAMP比CreateTimeStamp更好,因为它是一个公共财产)

  2. 您正在设置CreateTimeStamp财产和阅读CustomActionData您的自定义操作中。您应设置在 CustomActionData 属性的INSTALLLOCATION路径。

  3. 由于您的自定义操作是建立在安装文件夹中的文件,它应该运行作为递延和模仿属性应设置为无。这样就会有足够的权限来创建文件。

  1. You shouldn't use private properties in InstallExecuteSequence (CREATE_TIME_STAMP is better than CreateTimeStamp because it's a public property).
  2. You're setting the CreateTimeStamp property and reading CustomActionData inside your custom action. You should set the CustomActionData property to the INSTALLLOCATION path.
  3. Since your custom action is creating a file in the install folder, it should run as deferred and Impersonate attribute should be set to "no". This way it will have enough privileges to create the file.

试着做这些修改,看看问题是否仍然存在。

Try making these modifications and see if the problem persists.

这篇关于维克斯:在自定义操作写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆