Wix:CustomAction 中二进制文件的路径

发布于 2024-10-07 19:03:02 字数 475 浏览 0 评论 0原文

我的 wxs 文件中有以下代码

<Directory Id="TempFolder" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
          <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

现在,当我从安装程序调用自定义操作时,如何获取此 exe 的路径?我尝试过

var pathToExe = session.GetTargetPath("TempFolder") + "CACLS.exe"

哪个不起作用。 有什么想法吗?谢谢。

I have the following code in my wxs file

<Directory Id="TempFolder" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
          <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

Now when I call a Custom Action from the installer, how do I get the path to this exe? I tried

var pathToExe = session.GetTargetPath("TempFolder") + "CACLS.exe"

which doesn't work.
Any ideas? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱殇璃 2024-10-14 19:03:02

您尝试过吗:

<Directory Id="TEMPFOLDER" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
      <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

并且

var pathToExe = session.GetTargetPath("TEMPFOLDER") + "CACLS.exe"

公共属性全部大写。

我有一段时间没有使用 wix 但如果我没记错的话,如果您的自定义操作计划在安装过程中对系统进行更改的部分运行,那么如果您希望能够访问信息。

Did you try:

<Directory Id="TEMPFOLDER" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
      <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

and

var pathToExe = session.GetTargetPath("TEMPFOLDER") + "CACLS.exe"

public properties are in all caps.

I haven't used wix in a while but if i remember correctly, if your custom action is scheduled to run during the part of the installation where changes are made to the system you have to use a special property if you want to be able to access the information.

美煞众生 2024-10-14 19:03:02

为什么您甚至要在流程之外使用自定义操作来首先使用 CACLS? WiX / MSI 已经具有内置权限操作功能。保持声明性而非强制性,安装程序的质量将大大提高,同时通过不重新发明轮子来节省您的时间。

Why are you even going out of process with a custom action to use CACLS in the first place? WiX / MSI already has built in permissions manipulation functionality. Stay declarative not imperative and the quality of your installer will improve greatly while saving you time by not reinventing the wheel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文