我正在使用Wix来创建我的应用程序安装程序,并使用它在GAC中安装一个程序集,它工作得很好。
我的问题是当我设置程序集属性'copy local=false‘并执行安装时,我的服务没有被安装,因为它在本地文件夹中找不到这个dll,而且它还没有安装到GAC。
如果我将从EXE安装中安装另一个组件并验证DLL是否在GAC中,那么我将能够安装该服务。
我使用Paraffin.exe来遍历我的应用程序目录,生成一个wix文件,还使用MO尔德文件添加组件,而不是从这个目录中添加组件。
<DirectoryRef Id="Manager">
<Component Id="NlogGACRegisterComponent" Guid="1B224CD1-6EE8-46D3-9335-A84B7D8FB87B">
<File Id="NlogDLL" Name="Nlog.DLL" Source="..\Logging\Nlog.DLL" KeyPath="yes" Vital="yes" Assembly=".net"/>
</Component>
<Component Id="ManagerServiceComponent" Guid="EA31E161-4331-4A82-8F2B-7E26F62C96D6">
<File Id="StateManagerServiceEXE" Name="ManagerHostService.exe" DiskId="1" Source="..\ManagerHostService.exe" KeyPath="yes" Vital="yes" />
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Name="ManagerHostService" DisplayName="Manager Service" Description="Manager Service" Start="auto" Account="[SERVICEACCOUNT]" Password="[SERVICEPASSWORD]" ErrorControl="normal">
<util:PermissionEx User="Everyone" GenericAll="yes" ServiceChangeConfig="yes" ServiceEnumerateDependents="yes" ChangePermission="yes" ServiceInterrogate="yes" ServicePauseContinue="yes" ServiceQueryConfig="yes" ServiceQueryStatus="yes" ServiceStart="yes" ServiceStop="yes" />
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Name="ManagerHostService" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</DirectoryRef>这在模具文件中负责将DLL安装到GAC,然后是服务。
如何确保它首先安装DLL,然后安装服务?
发布于 2015-07-09 17:19:05
所有文件和Dlls都是在服务启动时安装的。在InstallExecuteSequence上查看使用Orca的MSI文件(或者查看详细的日志),您将看到InstallServices和StartServices正在跟踪InstallFiles。
问题是,在InstallFinalize之前,GAC中没有安装和可用的程序集,下面将对此进行描述:
https://msdn.microsoft.com/en-us/library/aa370063(v=vs.85).aspx
其中写道:“这意味着您不能使用ServiceControl表启动服务,而必须使用自定义操作,该操作必须在InstallFinalize之后进行排序。”这就是你需要做的。
https://stackoverflow.com/questions/31314509
复制相似问题