我有一个MSI可以安装一些服务。我更改了其中一个的名称并更新了Wix文件中的引用。
当我将它安装为新的MSI时,它工作正常。但是,如果存在升级方案(使用旧服务名称安装MSI并尝试安装此新服务名称已更改的MSI),则会出现以下错误:
这里有任何提示吗?我只是在.wxs文件中重命名。我是否必须使用现有组件ID卸载旧组件并使用新组件ID命名新组件?
目前,使用具有新名称的旧组件ID。
旧代码的一部分:
<Directory Id="dirxxx" Name="oldname">
<!-- oldname service-->
<Component Id="cmpOldNameService" Guid="bbb"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no"
Win64="no" Location="either">
<RemoveFile Id="ccc" On="uninstall" Name="z.dll"/>
<File Id="ccc" KeyPath="no" Source="$(var.xSource)\OldNameService\a.dll"/>
<File Id="ddd" KeyPath="no" Source="$(var.xSource)\OldNameService\b.dll"/>
<File Id="eee" KeyPath="no" Source="$(var.xSource)\OldNameService\c.dll"/>
<File Id="fff" KeyPath="no" Source="$(var.xSource)\OldNameService\d.dll"/>
<File Id="ggg" KeyPath="no" Source="$(var.xSource)\OldNameService\e.dll"/>
<File Id="hhh" KeyPath="no" Source="$(var.xSource)\OldNameService\f.dll"/>
<File Id="iii" KeyPath="yes" Source="$(var.xSource)\OldNameService\g.exe"/>
<File Id="jjj" KeyPath="no" Source="$(var.xSource)\OldNameService\h.dll"/>
<File Id="kkk" KeyPath="no" Source="$(var.xSource)\OldNameService\i.dll"/>
<ServiceInstall Id="OldNameService" DisplayName="OldName Service" Name="NewName"
ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" Description="OldName Service">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes"/>
</ServiceInstall>
<ServiceControl Id="OldNameServiceControl" Name="NewName"
Start="install" Stop="uninstall" Remove="uninstall" Wait="no"/>
</Component>
<Component Id="lll" Guid="mmm" NeverOverwrite="yes">
<File Id="nnn" KeyPath="yes" Source="$(var.xSource)\OldNameService\OldName.exe.config"/>
<util:XmlFile Id="UpdateOldNamelogFileName"
File="[#nnn]"
Action="setValue"
ElementPath="/configuration/appSettings/add[\[]@key='logFile'[\]]/@value"
Value="[ooo]oldname_YYYYMM.log" />
</Component>
替换为新代码:
<Directory Id="dirxxx" Name="newname">
<!-- newname service-->
<Component Id="cmpNewNameService" Guid="bbb"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no"
Win64="no" Location="either">
<RemoveFile Id="ccc" On="uninstall" Name="z.dll"/>
<File Id="ccc" KeyPath="no" Source="$(var.xSource)\NewNameService\a.dll"/>
<File Id="ddd" KeyPath="no" Source="$(var.xSource)\NewNameService\b.dll"/>
<File Id="eee" KeyPath="no" Source="$(var.xSource)\NewNameService\c.dll"/>
<File Id="fff" KeyPath="no" Source="$(var.xSource)\NewNameService\d.dll"/>
<File Id="ggg" KeyPath="no" Source="$(var.xSource)\NewNameService\e.dll"/>
<File Id="hhh" KeyPath="no" Source="$(var.xSource)\NewNameService\f.dll"/>
<File Id="iii" KeyPath="yes" Source="$(var.xSource)\NewNameService\g.exe"/>
<File Id="jjj" KeyPath="no" Source="$(var.xSource)\NewNameService\h.dll"/>
<File Id="kkk" KeyPath="no" Source="$(var.xSource)\NewNameService\i.dll"/>
<ServiceInstall Id="NewNameService" DisplayName="NewName Service" Name="NewName"
ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" Description="New Name Service">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes"/>
</ServiceInstall>
<ServiceControl Id="NewNameServiceControl" Name="NewName"
Start="install" Stop="uninstall" Remove="uninstall" Wait="no"/>
</Component>
<Component Id="lll" Guid="mmm" NeverOverwrite="yes">
<File Id="nnn" KeyPath="yes" Source="$(var.xSource)\NewNameService\NewName.exe.config"/>
<util:XmlFile Id="UpdateNewNamelogFileName"
File="[#nnn]"
Action="setValue"
ElementPath="/configuration/appSettings/add[\[]@key='logFile'[\]]/@value"
Value="[ooo]newservice_YYYYMM.log" />
</Component>
答案 0 :(得分:2)
这已经太长了,无法作为评论添加,我添加这个作为答案虽然它可能不会为你回答:
答案 1 :(得分:0)
所以我能在这里解决我的问题。我想进行小幅升级,并在Account
ServiceInstall
中添加Network Service
属性。{/ p>
<ServiceInstall Id="Service1" DisplayName="My Service" Name="MyService"
ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" Description="My Service" Account="NT Authority\NetworkService">