Can I set the Directory name attribute with a custom property value?

4 messages Options
Embed this post
Permalink
Dave Kolb-2

Can I set the Directory name attribute with a custom property value?

Reply Threaded More More options
Print post
Permalink
Should this work? I am getting the literal strings as the directory name. Is
the directory name attribute not "formattable"? Where is it documented what
is formatted or not as I have not been able to find that information.
Thanks, Dave

 

  <Property Id="MYCOMPANYNAME" Value="49thLatitude" />

  <Property Id="MYPRODUCTROOT" Value="CmdMan" />

 

        <Directory Id="CompanyRoot" Name="[MYCOMPANYNAME]">

          <Directory Id="CmdManRoot" Name="[MYPRODUCTROOT]">

 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: Can I set the Directory name attribute with a custom property value?

Reply Threaded More More options
Print post
Permalink
Both Product\@Value and Directory\@Name fields are literal. If you want them
formatted you need to use custom action types 35 or 51. Those are formatted
like this:

<CustomAction Directory="CmdManRoot" Value="FormattedPath"
Id="SetCmdManRoot"/><!--type 35-->
<CustomAction Property="CompanyRoot" Value="FormattedValue"
Id="SetCompanyRoot"/><!--type 51-->

They then have to be scheduled, according to the sequencing restrictions of
each type (if you are using then for directory paths, type 51s have to be
scheduled before CostFinalize. Type 35s must always come after
CostFinalize).

AFAIK (but I haven't ever tested it) the above values, when used for
directory paths, must always be FULL paths, but I may be wrong.

If you know what values you want and simply don't want to repeat yourself,
why not use preprocessor variables?

  <?define CompanyName="49thLatitude"?>
  <?define ProductRoot="CmdMan"?>

  <Property Id="MYCOMPANYNAME" Value="$(var.CompanyName)" />

  <Property Id="MYPRODUCTROOT" Value="$(var.ProductRoot)" />

        <Directory Id="CompanyRoot" Name="$(var.CompanyName)">

          <Directory Id="CmdManRoot" Name="$(var.ProductRoot)">

The only disadvantage of the preprocessor variables is you can't use a
change in the property value to alter your folder names directly. However,
you could use a custom action to update the directory table if that is what
you need. See Bob's blog entry on Semi-Custom Actions as he called them:
http://www.joyofsetup.com/2007/07/01/semi-custom-actions/


-----Original Message-----
From: Dave Kolb [mailto:[hidden email]]
Sent: Friday, October 23, 2009 10:41 PM
To: 'General discussion for Windows Installer XML toolset.'
Subject: [WiX-users] Can I set the Directory name attribute with a custom
property value?

Should this work? I am getting the literal strings as the directory name. Is
the directory name attribute not "formattable"? Where is it documented what
is formatted or not as I have not been able to find that information.
Thanks, Dave

 

  <Property Id="MYCOMPANYNAME" Value="49thLatitude" />

  <Property Id="MYPRODUCTROOT" Value="CmdMan" />

 

        <Directory Id="CompanyRoot" Name="[MYCOMPANYNAME]">

          <Directory Id="CmdManRoot" Name="[MYPRODUCTROOT]">

 

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Rob Mensching-7

Re: Can I set the Directory name attribute with a custom property value?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Dave Kolb-2
That's a direct assignment of the Directory name. So I expect you'll get
"[MYCOMPANYNAME]" as your directory name. Same as if you did <Property
Id="X" Value="[MYCOMPANYNAME]"/> you'd get "[MYCOMPANYNAME]". To have the
value evaluated then assigned you need to use a custom action.

In this case, a simple <SetProperty Id="DirectoryId"
Value="[ProgramFilesFolder]\[MYCOMPANYNAME]" After="CostInitialize"/> should
work.  Or you could be more efficient and use a preprocessor variable to
define both the Property and the Directory with the same value and reduce
the complexity of your install.

On Fri, Oct 23, 2009 at 10:41 PM, Dave Kolb <[hidden email]>wrote:

> Should this work? I am getting the literal strings as the directory name.
> Is
> the directory name attribute not "formattable"? Where is it documented what
> is formatted or not as I have not been able to find that information.
> Thanks, Dave
>
>
>
>  <Property Id="MYCOMPANYNAME" Value="49thLatitude" />
>
>  <Property Id="MYPRODUCTROOT" Value="CmdMan" />
>
>
>
>        <Directory Id="CompanyRoot" Name="[MYCOMPANYNAME]">
>
>          <Directory Id="CmdManRoot" Name="[MYPRODUCTROOT]">
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>


--
virtually, Rob Mensching - http://RobMensching.com LLC
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Dave Kolb-2

Re: Can I set the Directory name attribute with a custom property value?

Reply Threaded More More options
Print post
Permalink
Thanks!

-----Original Message-----
From: Rob Mensching [mailto:[hidden email]]
Sent: Saturday, October 24, 2009 5:20 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Can I set the Directory name attribute with a
custom property value?

That's a direct assignment of the Directory name. So I expect you'll get
"[MYCOMPANYNAME]" as your directory name. Same as if you did <Property
Id="X" Value="[MYCOMPANYNAME]"/> you'd get "[MYCOMPANYNAME]". To have the
value evaluated then assigned you need to use a custom action.

In this case, a simple <SetProperty Id="DirectoryId"
Value="[ProgramFilesFolder]\[MYCOMPANYNAME]" After="CostInitialize"/> should
work.  Or you could be more efficient and use a preprocessor variable to
define both the Property and the Directory with the same value and reduce
the complexity of your install.



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users