0
我試圖卸載一個已安裝的服務,該服務有幾個組件,但無法安裝。 任何人都可以請幫我卸載標籤嗎?我做了很多搜索,但無法成功運行任何東西。如何在下次升級時完全從應用程序中卸載服務,這不是主要升級
只需將ServiceControl標籤和刪除所有組件工作?我試過但沒有工作。你如何處理組件和依賴關係?需要邏輯和語法幫助。
以下是我在前一版本中安裝該服務的代碼。請讓我知道我必須添加的標籤才能將其刪除。
<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>
<!--Recovery-Interval needs to be added in both cases new install as well as upgrades-->
<Component Id="qqq" Guid="r-r-r-r-r" NeverOverwrite="yes">
<Condition><![CDATA[INSTALDIR <> "" AND NOT REMOVE AND POSTV1 = ""]]></Condition>
<CreateFolder />
<util:XmlConfig Id="RecoveryInterval" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" Sequence="1">
<util:XmlConfig Id="RecoveryInterval2" ElementId="RecoveryInterval" Name="key" Value="Recovery-Interval" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="RecoveryInterval3" ElementId="RecoveryInterval" Name="value" Value="3600" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
</Component>
<!-- Analytics-->
<Component Id="eee" Guid="f-f-f-f-f" NeverOverwrite="yes">
<Condition><![CDATA[(INSTALDIR <> "") AND NOT REMOVE]]></Condition>
<CreateFolder />
<!-- Analytics-->
<util:XmlConfig Id="EnableAnalytics" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" VerifyPath="/config/settings/add[\[]@key='EnableAnalytics'[\]]">
<util:XmlConfig Id="EnableAnalytics2" ElementId="EnableAnalytics" Name="key" Value="VEnableAnalytics" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="EnableAnalytics3" ElementId="EnableAnalytics" Name="value" Value="1" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
<util:XmlConfig Id="AnalyticsTrackingId" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" VerifyPath="/config/settings/add[\[]@key='AnalyticsTrackingId'[\]]">
<util:XmlConfig Id="AnalyticsTrackingId2" ElementId="AnalyticsTrackingId" Name="key" Value="AnalyticsTrackingId" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="AnalyticsTrackingId3" ElementId="AnalyticsTrackingId" Name="value" Value="YwByAE3eVweXAAcAVwBasBUAAgAMsB0AAwAbzz==" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
</Component>
<!-- Added to handle upgrade scenario for assembly binding redirect for Newtonsoft.json -->
<Component Id="cmpNewtonsoftVersionUpgrade" Guid="{a-60CA-d-w-f}" NeverOverwrite="yes">
<Condition><![CDATA[(INSTALDIR <> "") AND NOT REMOVE]]></Condition>
<CreateFolder/>
<util:XmlConfig Id="AddRuntimeElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="runtime" On="install"
ElementPath="configuration"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]@name='Newtonsoft.Json'[\]]"
Sequence="1" />
<util:XmlConfig Id="AddAssemblyBindingElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="assemblyBinding" On="install" ElementPath="configuration/runtime"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]@name='Newtonsoft.Json'[\]]"
Sequence="2"/>
<util:XmlConfig Id="AddDependentAssemblyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="dependentAssembly" On="install"
ElementPath="configuration/runtime/assemblyBinding"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]@name='Newtonsoft.Json'[\]]"
Sequence="3"/>
<util:XmlConfig Id="AddAssemblyIdentityElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="assemblyIdentity" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]@name='Newtonsoft.Json'[\]]"
Sequence="4">
<util:XmlConfig Id="AddNameKey"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="name" Value="Newtonsoft.Json" />
<util:XmlConfig Id="AddPublicKeyToken"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="publicKeyToken" Value="30ad4fe6b2a6aeed" />
<util:XmlConfig Id="AddCulture"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="culture" Value="neutral" />
<util:XmlConfig Id="AddXmlnsOnAssemblyIdentity"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" />
</util:XmlConfig>
<util:XmlConfig Id="DeleteBindingRedirectElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="delete" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]@name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]@oldVersion='0.0.0.0-6.0.0.0'[\]]"
Sequence="5" />
<util:XmlConfig Id="DeleteBindingRedirectElementoldserviceOnv4"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="delete" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]@name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]@oldVersion='0.0.0.0-8.0.0.0'[\]]"
Sequence="6" />
<util:XmlConfig Id="AddBindingRedirectElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]@name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]@oldVersion='0.0.0.0-9.0.0.0'[\]]"
Sequence="7">
<util:XmlConfig Id="AddOldVersionKey"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="oldVersion" Value="0.0.0.0-9.0.0.0" />
<util:XmlConfig Id="AddNewVersionKeyS3Uploader"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="newVersion" Value="9.0.0.0" />
<util:XmlConfig Id="AddXmlnsOnBindingRedirectS3Uploader"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" />
</util:XmlConfig>
<util:XmlConfig Id="AddNameSpaceToyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="value" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" On="install"
ElementPath="/configuration/runtime/assemblyBinding"
Sequence="8" />
<util:XmlConfig Id="AddNameSpaceToDependentAssemblyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="value" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" On="install"
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]@name='Newtonsoft.Json'[\]][\]]"
Sequence="9" />
</Component>
</Directory>
實施例試驗爲1個組分:
<Component Id="cmpoldNameService" Guid="9-kj-4509-ko-B4F7700AFDCE"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="yes"
Win64="no" Location="either">
<Condition>FALSE</Condition>
<RemoveFolder Id="diytg" On="uninstall"/>
<RemoveFile Id="ghgj" On="uninstall" Name="a.dll"/>
<RemoveFile Id="uiu" On="uninstall" Name="b.dll"/>
<RemoveFile Id="hujhjn" On="uninstall" Name="c.dll"/>
<RemoveFile Id="okl" On="uninstall" Name="d.dll"/>
<RemoveFile Id="bbb" On="uninstall" Name="e.dll"/>
<RemoveFile Id="bbbb" On="uninstall" Name="f.dll"/>
<RemoveFile Id="kkkl" On="uninstall" Name="g.dll"/>
<RemoveFile Id="mmmm" On="uninstall" Name="h.dll"/>
<RemoveFile Id="nnn" On="uninstall" Name="i.exe"/>
<RemoveFile Id="bboo" On="uninstall" Name="j.dll"/>
<RemoveFile Id="ttt" On="uninstall" Name="k.dll"/>
<ServiceControl Id="OldNameServiceControl" Name="OldName"
Start="install" Stop="both" Remove="both" Wait="yes"/>
</Component>
感謝您的回覆。你可以給一個組件的示例代碼。我是否必須包含文件以及新版本中指向路徑的那些文件,這些文件將被刪除。所以這裏的用例是我正在重命名現有的服務。我嘗試了重命名,但它不起作用,因此我正在卸載現有的一個,並將重命名的一個安裝爲新的GUIDS。 – Atihska
您需要提供您的wix構建一個零字節文件的相同名稱,以便該組件仍然有效並編譯。您必須爲新服務創建一個新的組件。它並沒有被重新命名,但舊的被刪除,並添加了新的。 –
檢查我的編輯。我爲一個組件添加了一個代碼。你能否驗證這是否正確,我必須爲所有組件做到這一點? – Atihska