System.Configuration.Install in .NET 6.0



我有一个WiX安装程序,我希望使用。net 6.0移动到WiX Toolset 4。我们安装的一些应用程序是用。net框架编写的,其中有一些Windows服务我需要安装。我目前正在使用System.Configuration.Install和ServiceProcessInstaller类来安装/卸载我的服务。

如果我的安装程序代码是在。net 6.0,还有一种方法来安装服务使用代码吗?我宁愿不使用sc.exe,如果它可以帮助。我们过去是这样做的,ServiceProcessInstaller工作得更好。

好吧,也许我需要的只是TopShelf。ServiceInstaller包。我忘了我以前用过这个。

您可以在Product中尝试wix工具集。wxs文件。下面是一个片段。有关详细信息,您可以参考我的github repo输入链接描述在这里

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<!-- service registration-->
<Component Id="ProductComponent">
<File Id="WebMvcAppEXE" 
Name="WebMvcApp.exe" 
DiskId="1"
Source="$(var.WebMvcApp.TargetDir)WebMvcApp.exe"
Vital="yes"
KeyPath="yes"
/>
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name ="WebMvcAppService"
DisplayName="WebMvcApp Windows Service"
Description="A windows service that host the Web Mvc App."
Start="auto"
Account="LocalSystem"
ErrorControl="normal"/>
<ServiceControl Id="StartService" 
Start="install" 
Stop="both" 
Remove="uninstall" 
Name="WebMvcAppService" 
Wait="yes"/>
</Component>
</ComponentGroup>
</Fragment>

最新更新