windows installer - WIX - Creating an uninstall shortcut inside installed folder -


i'm using wix 3.9 , wix-edit 0.7.5/notepad++ create msi installer application. want create uninstall shortcut inside installed folder. instance:

c:\mysoftware\uninstall.lnk 

i tried few things, in cases when uninstall software through link, program folder c:\mysoftware not deleted. uninstalling every other way works expected.

first tried create component inside <directory> tag. looks me bit hacky, because must add <createfolder>:

<directory id="myinstalldir" name="mysoftware">     <!-- files... -->      <component id="abc" guid="put-guid-here">         <createfolder/> <!-- have add -->         <shortcut id="uninstallproduct" name="uninstall mysoftware" description="uninstalls mysoftware" target="[system64folder]msiexec.exe" arguments="/x [productcode]"/>     </component>  </directory>  <feature id="defaultfeature" title="main feature" level="1">     <!-- references... -->     <componentref id="abc" /> </feature> 

i tried replacing <createfolder/> <removefolder id="myinstalldir" on="uninstall" />, same results.

another try:

<directoryref id="applicationprogramsfolder">     <component id="startmenushortcuts" guid="*">         <removefolder id="applicationprogramsfolder" on="uninstall" />         <registryvalue root="hkcu" key="software\[manufacturer]\[productname]" type="string" value="" />         <shortcut id="uninstallproduct1" name="uninstall mysoftware" description="uninstalls mysoftware" target="[system64folder]msiexec.exe" arguments="/x [productcode]"/>         <shortcut id="uninstallproduct2" name="uninstall mysoftware" description="uninstalls mysoftware" target="[system64folder]msiexec.exe" arguments="/x [productcode]" directory="myinstalldir" />     </component> </directoryref> 

here, besides having same results, warning when building: file.wxs(31) : warning lght1076 : ice57: component 'startmenushortcuts' has both per-user , per-machine data hkcu registry keypath..

how create shortcut can used without affecting uninstall behavior? don't know if makes difference, need work without admin privileges (i'm using <package ... installscope="peruser" installprivileges="limited">).

i know create .lnk file , add project, prefer not to, because i'd have worry updating guid on every project.

the problem occurs because didn't set working directory msiexec , use current directory, raising error 2911 (could not remove folder).

add reference windowsfolder:

<directory id="myinstalldir" name="mysoftware">     ...     <directory id="windowsfolder" name="windowsfolder" /> </directory> 

and modify shortcut adding attribute workingdirectory="windowsfolder":

<shortcut id="uninstallproduct" name="uninstall mysoftware"            description="uninstalls mysoftware" target="[system64folder]msiexec.exe"           arguments="/x [productcode]" workingdirectory="windowsfolder" /> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -