[wix-users] Prevent installing to a directory with demo in the name
KONDURU Pavan
Pavan.KONDURU at 3ds.com
Mon Sep 28 18:18:56 PDT 2015
Hi Jonathan,
Does the C# custom action need to be written in a separate file/project?
Yes, create a C# project in your visual studio solution along side the WIX project.
Also, do I understand correctly that the target machine will need .Net installed to do a C# custom action?
You would just need a .NET framework 2.0 for the code as simple as what you need to do, which is by default there on Windows OS. You can also add this in the config file of your C# project
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
--Pavan
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Jonathan Lloyd
Sent: Monday, September 28, 2015 6:07 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Prevent installing to a directory with demo in the name
Thank you for your response Pavan,
I've been looking into writing custom actions and I'm not really finding any details about how to do it. I've read about making the CA immediate, and public properties being all caps.
Seems like most examples go as deep as "inside of your CA do this:" which has a C++/C# code fragment :) Does the C# custom action need to be written in a separate file/project?
Also, do I understand correctly that the target machine will need .Net installed to do a C# custom action? I don't know if I want to require that it is installed or install it just to run the setup...
I've seen several results on google where someone has asked about Regex custom actions from back in 2008 or so, and someone will suggest that they put in a feature request... I can't seem to find anything about if anything came of those requests though... does anyone know if it was added?
Thanks,
Jonathan
On Tue, Sep 22, 2015 at 6:31 PM, KONDURU Pavan <Pavan.KONDURU at 3ds.com>
wrote:
> 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_customizatio
> ns.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
>
> ____________________________________________________________________
> 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