简体   繁体   中英

Remove component with in next update in WiX

I have a service component installed twice in one of my previous releases.

<Component Id="MyServiceWin7" Guid="{GUID_WIN7}">
<File Id="mysvc_Win7"
      Name="mysvc.exe"
      Source=mysvc.exe"
      KeyPath = "yes"/>
<ServiceControl Id="MYSVC_Win7"
                Name="MYSVC"
                Remove="uninstall"
                Start="install"
                Stop="both"
                Wait="no" />
<ServiceInstall Id="My_Svc_Win7"
                Name="MYSVC"
                DisplayName="MYSVC"
                Type="ownProcess"
                Start="auto"
                ErrorControl="normal"
                LoadOrderGroup=""
                Description="My service">
</component>

<Component Id="MyServiceWin8" Guid="{GUID_WIN8}">
<File Id="mysvc_Win8"
      Name="mysvc.exe"
      Source=mysvc.exe"
      KeyPath = "yes"/>
<ServiceControl Id="MYSVC_Win8"
                Name="MYSVC"
                Remove="uninstall"
                Start="install"
                Stop="both"
                Wait="no" />
<ServiceInstall Id="My_Svc_Win8"
                Name="MYSVC"
                DisplayName="MYSVC"
                Type="ownProcess"
                Start="auto"
                ErrorControl="normal"
                LoadOrderGroup=""
                Description="My service">
</component>

So there will be two instances of the MYSVC component. Both are mapping to MYSVC.exe.

I missed the OS version condition check in the previous release.

It runs successfully.

I am thinking to delete the dummy additional COMPONENT (GUID_Win7 or GUID_WIN8) in the next update.

How I can delete it, do I need to write a custom action?

Any help would be appreciated.

EDIT:: Please find answers,

  1. mysvc is having some third party lib dependancy os specific Win7 and Win8, it works means it installed successfully if we check sc qc mysvc I get service created and mysvc.exe is mapped to service binpath

  2. yes these two service components targets same destinationand there is only one component when I do sc query mysvc

  3. No there only one entry of service. mysvc.exe is win8 version on disk.

Thanks for suggestions, that breaking link.

Currently I have %ProgramFiles%\\MyApp\\mysvc.exe common path for both win 7 and win8. So my question if create new common path to break previous link. ProgramFiles%\\MyApp\\mysvc\\mysvc.exe [[NEW_GUID1]] for win7 ProgramFiles%\\MyApp\\mysvc\\mysvc.exe [[NEW_GUID2]] for win8

Components with [[OLD_GUID1]] , [[OLD_GUID2]] will be on system forever until my product is uninstalled, so cant we just delete components with [[OLD_GUID1]], [[OLD_GUID2]] to clean stale(non functional) components

Thanks

Some Questions :

  • First of all, can we ask why you decided to install the service in two flavors? Does this mean that the service has different binaries for Win7 and Win8? If so, then it is unclear why you say it works as it stands.
  • Do these service components target two different installation locations so they both run side-by-side , or do you target the same target destination with both components? (so there is only one instance of the file after installation).
  • Are there two entries in the list of services on the box after installation? If you target the same location with both components, what file version of mysvc.exe made it onto the disk? (if they are different).

I wrote the below before the above questions. Please update your question with the answers to the questions. The below might be irrellevant - we need more information.


Sins of The Past : If you have installed the same file twice with two different component GUIDs in the previous version then this is wrong and I would recommend you "break the link " to the sins of the past by setting two new component GUIDs for the new release and crucially: set a new absolute installation location for each component (do not target the same absolute key path with two different GUIDs! - conditions or not).

The idea is to de-couple the old and new versions so that you start with a clean(er) slate.

Something like:

Comp 1: {77777777-7777-7777-7777-777777777777}, [ProgramFilesFolder]My App\\Win7\\mysvc.exe

Comp 2: {42424242-4242-4242-4242-424242424242}, [ProgramFilesFolder]My App\\Win8\\mysvc.exe

Personally I would avoid the Windows version number and maybe use something else. How about a year?

Comp 1: {77777777-7777-7777-7777-777777777777}, [ProgramFilesFolder]My App\\2007\\mysvc.exe

Comp 2: {42424242-4242-4242-4242-424242424242}, [ProgramFilesFolder]My App\\2014\\mysvc.exe

Just to not hard code a misleading value if the Win8 version runs on Win10 for example.

NB! : Note that the above, sample GUIDs are well-known and dysfunctional GUIDs and should not be copied and used! This is of high cruciality :-).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM