why two shortcuts after Major upgrade (migration)?

末鹿安然 提交于 2020-01-14 09:42:10

问题


We are using WiX for our windows installation.

We were supporting major upgrade without any issues until recently.

I was asked to change the shortcut name as we changed our product name. So i changed it.

After a major upgrade, 2 shortcuts are being displayed instead of one.

The beauty is while we are installing all the feature migrated in same machine ,it deleted the old shortcut properly it seems.

But when we are installing one of the features (webserver feature ) in (webserver) machine, 2 shortcuts appear.

I verified that the shortcut component is also added in webserver feature.

 <DirectoryRef Id="ProgramMenu.OrganizationName.MyProj">
          <Component Id="CoreInterface_Shortcuts" Guid="3e3c3733-9b53-42cf-a641-b5b3e3da88cf">
            <Shortcut Id="MyOrgMESUrl" Name="Home" Description="MyOrg Intuition URL" Target="[INSTALLDIR]MyOrg MES.url" WorkingDirectory="INSTALLDIR"/>
            <RemoveFolder Id="RemProgramMenu.MyOrg" Directory="ProgramMenu.MyOrg" On="uninstall"/>
            <RemoveFolder Id="RemProgramMenu.MyOrg.MyProj" Directory="ProgramMenu.MyOrg.MyProj" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\MyOrg\MyProj" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
          </Component>
        </DirectoryRef>

<Feature Id="WEBSERVER" Title="WEBSERVER Customized Component(s)" Level="1">
      <ComponentRef Id="CoreInterface_Shortcuts"/>
</Feature>

Why does it maintain old shortcut (If old shortcut is clicked it is not working)? How to avoid this?


回答1:


the reason is easy. you are not following the best practices.

When you change names, you have to change the component guid.

see documentation:

Any change that has not been shown by testing to be compatible with previous versions of the component. In this case, you must also change the name or target location of every resource in the component.

A change in the name or target location of any file, registry key, shortcut, or other resource in the component. In this case, you must also change the name or target location of every resource in the component.

The addition or removal of any file, registry key, shortcut, or other resource from the component. In this case, you must also change the name or target location of every resource in the component.

Changing the Component Code (Windows)

A update only reinstalls/overwrites files. the sourcefiles and names are taken from the new msi. the reference to the old filename gets lost, when you are rename a file/shortcut. this is the reason why the old link is untouched und not overwritten by the installer.



来源:https://stackoverflow.com/questions/14773233/why-two-shortcuts-after-major-upgrade-migration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!