Wix - Keeping track of installed applications

安稳与你 提交于 2019-12-11 01:55:50

问题


This seems like a fairly straightforward question but I've been unable to find an answer:

Let's say I have two products: A and B created by MyCompany. Both products A and B will have shortcuts in the start menu in this fashion:

MyCompanyFolder->Product_A_Folder->A.exe and MyCompanyFolder->Product_B_Folder->B.exe

If I uninstall "Product B" I don't want it to delete the "MyCompanyFolder" unless it is the last product left. I would just check to see if "Product A" exists or not (through a component or registry search) but it is impossible for me to know at this time how many future applications will be added to this folder.

The only solution I came up with was to create a registry key that simply contains an integer denoting the number of apps installed - but that seems a bit inelegant (not to mention I don't know how to increment registry values in Wix either).

Any thoughts? Thanks.


回答1:


You must be doing something unusual in your install because this should all work automatically. You shouldn't need to have any components or createfolder elements for your start menu directory. Just create a reference like below and use the ApplicationProgramsFolder Id in your ShortCut element across your installs and MSI will automatically handle the case of last one off removes the folder.

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramMenuFolder">
    <Directory Id="CompanyProgramsFolder" Name="ISWIX, LLC">
     <Directory Id="ApplicationProgramsFolder" Name="IsWiX" />
  </Directory>
 </Directory>
</Directory>


来源:https://stackoverflow.com/questions/3319927/wix-keeping-track-of-installed-applications

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