0
我正在嘗試使用針對我的C#項目的服務安裝來執行WiX安裝程序。這是我第一次嘗試,我不明白爲什麼它不起作用。無法使用WiX安裝程序啓動服務
我已經設置了ServiceInstall但是當我運行安裝程序,我擋在本頁面:
幾秒鐘後,我得到了錯誤:
我使用相同的參數從Visual Studio安裝程序創建了WiX安裝。還有就是代碼:
<Product ... />
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentRef Id ="MyService"/>
</Feature>
<UIRef Id="WixUI_InstallDir"/>
<!-- Set install directory -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
</Product>
<Fragment>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.product)">
<Component Id="MyService" Guid="{GUID-HERE}" KeyPath="yes">
<!-- service will need to be installed under Local Service -->
<ServiceInstall
Id="MyService"
Type="ownProcess"
Vital="yes"
Name="MyService"
DisplayName="Service"
Description=""
Start="auto"
Account="NT AUTHORITY\LocalService"
ErrorControl="normal"/>
<ServiceControl Id="StartDDService" Name="MyService" Start="install" Wait="no" />
<ServiceControl Id="StopDDService" Name="MyService" Stop="both" Wait="yes" Remove="uninstall" />
</Component>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents">
<Component Id="ProductComponent" Guid="{}" Directory="INSTALLFOLDER">
<File Id="MyService.exe" Source="$(var.MyService.TargetDir)\MyService.exe"/>
</Component>
</ComponentGroup>
</Fragment>
幾個小時後,我終於找到了解決方案。確實缺少一個dll。我試圖運行相同的服務的另一個程序,我錯過了SQL服務器的DLL。我下載了DLL,現在它工作。 –