[wix-users] Prevent installing to a directory with demo in the name

KONDURU Pavan Pavan.KONDURU at 3ds.com
Tue Sep 22 18:31:04 PDT 2015


Hi Jonathan,

As far as I know you can't achieve this without a custom action. This is what you need:

--Set up a property that is public(All uppercase). Something like say " VALID_INSTDIR" with value="YES"

--Define a CustomAction and Link that to the next button of the Install directory dialog(make sure the CA is immediate)

        <Control Id="Next" Type="PushButton" X="248" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
                    <Publish Event="DoAction" Value="ValidateDir">1</Publish>

--Write a c# or C++ CA and check for the string "Demo", something like this in C#. Change the VALID_INSTDIR value to "NO" if it contains demo.

        string instLoc = session["INSTALLLOCATION"];
                 if (instLoc.Contains("Demo"))
        session["INSTDIR_VALID"] = "NO";

-- --So, now you have a property which can decide if you want the user to proceed . You can use this in the UI sequence

--Write a custom dialog to be called when its invalid with appropriate text to warn the user and stay on the install directory dialog.


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Jonathan Lloyd
Sent: Tuesday, September 22, 2015 4:48 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Prevent installing to a directory with demo in the name

Thanks Farrukh,

I found this guide:
http://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html

in the section "Changing the UI sequence of a built-in dialog set" it shows an approach to modifying the Next button behavior of InstallDirDlg.

I tried changing:
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog"
Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
to
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog"
Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND (WIXUI_INSTALLDIR_VALID<>"1" OR WIXUI_INSTALLDIR="C:\DEMO\")]]></Publish>

I also tried:
WIXUI_INSTALLDIR="DEMO"

However, I was still able to install to C:\DEMO\

I would like to prohibit installing to any folder named DEMO:
C:\DEMO\
D:\DEMO\
E:\Program Files\DEMO\
etc...

Thanks again for your first reply. Do you have any more guidance? I'm not sure how/what I should check for the contents "DEMO"



On Fri, Sep 18, 2015 at 8:30 PM, Farrukh Waheed <farrukh1 at gmail.com> wrote:
>
> You may need to write a Custom Action for this and try to execute that
with
> the Install/Next button on the dialog where user specifies the
> destination directory.
>
> For this you may have to redefine that button definition....
>
>
>
> On 19 September 2015 at 04:33, Jonathan Lloyd <ninjaxor at gmail.com> wrote:
>
> > Hi, I'm using WixUI_InstallDir and I do not want the user to be able
> > to install to any directory with the word "demo" in it.
> >
> > I've tried several approaches but really I'm completely in the dark
when it
> > come to putting together an MSI...
> >
> > appreciate any help :)
> >
> > Jon
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email and all attachments,

(iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.

For other languages, go to http://www.3ds.com/terms/email-disclaimer



More information about the wix-users mailing list