如何将值从自定义对话框传递到组件

发布于 2024-11-08 13:43:36 字数 973 浏览 7 评论 0原文

我创建了一个自定义对话框,允许用户配置我们正在安装的服务将在其下运行的帐户。为此,我将属性事件附加到自定义对话框上的“下一步”按钮,该按钮将设置 [帐户] 属性:

<Publish Property="Account" Value="[USERNAME]">USERACCOUNT = "1"</Publish>
<Publish Property="Account" Value="Local System"><![CDATA[USERACCOUNT <> "1"]]></Publish>

组件中选取帐户属性:

<Component Id="Service" Guid="*" >
  <File Id="ServiceExe" KeyPath="yes" Source="$(var.ServiceFiles)\Service.exe" />
  <ServiceInstall Vital="yes" ErrorControl="ignore" Type="ownProcess" Account="[Account]" Name="$(var.ServiceName)" Description="Service running as [Account]" Start="auto" />
  <ServiceControl Id="ServiceControl" Remove="both" Name="$(var.ServiceName)" Start="install" Stop="both"/>
</Component>

然后,我尝试在安装服务的 问题是该组件不使用为 [Account] 发布的值,即使我可以看到安装程序日志中的属性事件正在发布正确的值。所以我的问题是如何确保服务安装程序组件获取自定义对话框发布的 [Account] 值?

I have created a custom dialog that allows the user to configure the account under which the service we are installing will run. I do this by attaching a property event to the Next button on my custom dialog that will set a [Account] property:

<Publish Property="Account" Value="[USERNAME]">USERACCOUNT = "1"</Publish>
<Publish Property="Account" Value="Local System"><![CDATA[USERACCOUNT <> "1"]]></Publish>

I then try to pick up the account property in the component that installs the service:

<Component Id="Service" Guid="*" >
  <File Id="ServiceExe" KeyPath="yes" Source="$(var.ServiceFiles)\Service.exe" />
  <ServiceInstall Vital="yes" ErrorControl="ignore" Type="ownProcess" Account="[Account]" Name="$(var.ServiceName)" Description="Service running as [Account]" Start="auto" />
  <ServiceControl Id="ServiceControl" Remove="both" Name="$(var.ServiceName)" Start="install" Stop="both"/>
</Component>

My problem is that this component does not use the value published for [Account] even though I can see that the correct values are being published by the property event in the installer log. So my question is how can I ensure that the service installer component picks up the [Account] value published by my custom dialog ?

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

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

发布评论

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

评论(1

无法言说的痛 2024-11-15 13:43:36

使用公共属性,例如 ACCOUNT。私有属性在 InstallExecuteSequence 中丢失其修改值。

此外,为特定帐户安装服务时,请确保

Use a public property, for example ACCOUNT. Private properties lose their modified values in InstallExecuteSequence.

Also, when installing a service for a specific account, make sure that the Log on as a service policy is set for that account. Otherwise the service will not start after installation.

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