Wix 服务安装 DLL

发布于 2024-11-27 20:43:37 字数 1922 浏览 2 评论 0原文

我在 Wix 中有自定义操作来为我的应用程序安装其中一项服务。

<Custom Action='ManagedInstall' After="InstallFinalize"/>

    <CustomAction Id="ManagedInstall"
                  Directory='INSTALLDIR'
                  ExeCommand='"[WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false ControlService.dll'
                  Impersonate='yes'
                  Return='check'>
    </CustomAction>

这在 Windows XP 和 7 下运行良好(UAC 提升) 除我们的某些笔记本电脑外的任何台式机、虚拟机或笔记本电脑 加密。

假设这是因为 installUtil.exe 控制台执行被加密中断(出于某种原因,这是系统之间发现的唯一差异),正在尝试解决此问题的解决方案,替换上述自定义操作代码。

        <Component Id='ControlServiceDLL' Guid='27C58A4E-E1A9-4b85-B048-F8BBB1BF3C76'>
          <File Id='ControlService.dll'
              Name='ControlService.dll'
              DiskId='1'
              Source='Data\ControlService.dll'
              Vital='yes'
              KeyPath='yes'/>

          <ServiceInstall
              Id="ControlServiceInstall"
              Type="shareProcess"
              Vital='yes'
              Name='ControlService'
              DisplayName='Control Service'
              Description='Control Service Description'
              Start="demand"
              ErrorControl='ignore'
              Interactive="no">
          </ServiceInstall>

          <ServiceControl Id="StartService" Remove="uninstall" Name="Control Service" Wait="yes" />
        </Component>

它最初无法启动,因此我必须删除服务控制启动/停止命令才能查看它是否安装。是的,它安装得很好,但甚至无法手动启动服务。

通过观察发现以下内容可能会帮助有人尝试帮助我。

比较我在下面找到的两种不同方法的服务属性 希望它可以对能够回答我的问题的人有所帮助。

通过使用自定义操作:服务属性可执行路径显示, C:\windows\SysWOW64\dllhost.exe /Processid:{926E3CF4-B966-4E61-A46B-C3C49F579F7C}

通过使用服务安装显示, “C:\Program Files (x86)\My Test Company\Services\ControlService.dll”

I have custom action in Wix to install one of the services for my application.

<Custom Action='ManagedInstall' After="InstallFinalize"/>

    <CustomAction Id="ManagedInstall"
                  Directory='INSTALLDIR'
                  ExeCommand='"[WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false ControlService.dll'
                  Impersonate='yes'
                  Return='check'>
    </CustomAction>

This works fine under Windows with XP and 7 (With UAC elevated)
any desktop, virtual machine or laptops apart from some of our laptops
with encryption.

Assuming it is because installUtil.exe console execution is interrupted by encryption (for some reason, it is the only difference found in between systems), was trying work around a solution for this replacing above custom action code.

        <Component Id='ControlServiceDLL' Guid='27C58A4E-E1A9-4b85-B048-F8BBB1BF3C76'>
          <File Id='ControlService.dll'
              Name='ControlService.dll'
              DiskId='1'
              Source='Data\ControlService.dll'
              Vital='yes'
              KeyPath='yes'/>

          <ServiceInstall
              Id="ControlServiceInstall"
              Type="shareProcess"
              Vital='yes'
              Name='ControlService'
              DisplayName='Control Service'
              Description='Control Service Description'
              Start="demand"
              ErrorControl='ignore'
              Interactive="no">
          </ServiceInstall>

          <ServiceControl Id="StartService" Remove="uninstall" Name="Control Service" Wait="yes" />
        </Component>

And it fails to start initially so I had to remove the Service Control start/ stop command to see is it installs. Yes it installs fine but couldn't start the service manually even.

By Observation found the following that may help someone try to help me in this.

Comparing the Service Properties in 2 different methods I have found below
Hope it may helps to someone who can answer my problem.

By using custom action: Service Properties Executable Path shows,
C:\windows\SysWOW64\dllhost.exe /Processid:{926E3CF4-B966-4E61-A46B-C3C49F579F7C}

Where as by using Service Install it shows,
"C:\Program Files (x86)\My Test Company\Services\ControlService.dll"

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

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

发布评论

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

评论(2

‖放下 2024-12-04 20:43:37

您正在/面临的问题是您正在尝试将 dll 作为服务托管。
Windows 服务是可执行文件 (exe)。

如果您使用 wix 3.0 或更高版本,请采用非自定义操作方法,如此处所述,包括我陷入的密钥路径陷阱:
http://blog.tentaclesoftware.com/archive/2009/01/01 /21.aspx

The problem you are/where facing is that you are trying to host a dll as a service.
A windows Service is an executable (exe).

If you are using wix 3.0 or higher, go with the non custom action approach, as described here, including the keypath pitfall I fell into:
http://blog.tentaclesoftware.com/archive/2009/01/01/21.aspx

梨涡少年 2024-12-04 20:43:37

您可以包含具有管理权限的应用程序清单,因此所有事件都将在管理员帐户下创建/调用。

如果您有 msi,则可以使用 dotnetinstaller 工具,该工具会将 msi 转换为 exe 并将 UAC 附加到安装程序。因此,如果用户没有管理员权限,安装程序将提示用户。

You can include application manifest with administrative privileges and so all the events will be created/called under admin account.

If you have an msi then you can go for dotnetinstaller tool, which will convert msi to exe and attach UAC to setup. Hence if the user does not have admin privileges, installer will prompt for it.

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