Jason,

The problem is that Windows Installer doesn't know that the user
selected a different folder at installation time. It is up to you, as
the author of the installation to ensure that INSTALLDIR is set to the
same value when the application is removed as it was when the
application was installed.

The following is your original minimal XML, with modifications to a)
persist INSTALLDIR to the registry (under HKCU), and b) to recover it
later. (Sorry in advance if Outlook also decides to reformat it as I
believe it will.)

NOTE: This is just an example. I suspect (but have not tested it) that
there will be a problem if two users independently install the product
to the same folder.

Hope this helps,
Regards,
Richard

<?xml version='1.0'?>
<!--
    Copyright (c) Microsoft Corporation.  All rights reserved.
-->

<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

        <!-- Product Name is what ends up in Add/Remove Programs -->
        <Product Id='7CBA4DA6-D28E-4f75-8548-75AD8B01133D'
           UpgradeCode='AC809548-1C8A-425d-A919-4624AB7B8D60'
           Name='MinRepro'
           Language='1033'
           Version='1.0.0.0'
           Manufacturer='MinRepro Man'>

                <Package Description='MinRepro'
             Comments="MinRepro Man's MinRepro"
             InstallerVersion='200'
             Compressed='yes' />

                <Media Id='1' Cabinet='minrepro.cab' EmbedCab='yes' />
                
                <!-- Build Directory Structure -->
                <!-- TARGETDIR is a virtual starting directory -->
                <Directory Id='TARGETDIR' Name='SourceDir'>
                        <Directory Id='PersonalFolder' Name='PFiles'>
                                <!--<Directory Id='ProgramFilesFolder'
Name='PFiles'>-->
                                <Directory Id='INSTALLDIR'
Name='MinRepro'>

                                        <Component
Id="Component_ReproFolder" Guid="ba299058-3686-4ea1-b43e-6eb77646d24c">

                                                <!-- Required for
install to PersonalFolder, not required for ProgramFilesFolder -->
                                                <RegistryKey
Id='RegKey_HKCU_MinRepro'
                         Action='createAndRemoveOnUninstall'
                         Key='Software\MinRepro Man\MinRepro'
                         Root='HKCU'>

                                                        <RegistryValue
Name='Component_ReproFolder' Value='true' Type='string' KeyPath='yes' />
                                                </RegistryKey>

                                                <!-- Required to track
where the user selected for uninstall -->
                                                <Registry
Key="Software\[Manufacturer]\[ProductName]" Name="Directory" Root="HKCU"
Value="[INSTALLDIR]" Type="string"/>
                                                
                                                <!-- Required for
install to PersonalFolder, not required for ProgramFilesFolder -->
                                                <RemoveFolder
Id="RemoveFolder_ReproFolder" On="uninstall" />

                                                <File Id="File_1"
Name="msg.txt" Source=" D:\test\msg.txt" />
                                        </Component>

                                </Directory>
                        </Directory>
                </Directory>

                <!-- Components to be installed for this feature -->
                <Feature Id='SourceCode' Title='Source Code' Level='1'>

                        <ComponentRef Id='Component_ReproFolder' />

                </Feature>

                <!-- Install type - user may choose their own directory
-->
                <Property Id='INSTALLDIR'>
                        <RegistrySearch
Id="PreviousInstallLocationRegistrySearch" Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]" Name="Directory"
Type="raw"/>
                </Property>
                <Property Id='WIXUI_INSTALLDIR' Value='INSTALLDIR' />
                <UIRef Id='WixUI_InstallDir' />
                <UIRef Id='WixUI_ErrorProgressText' />

        </Product>
</Wix>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to