I would like to assign a directory name based on the value of a
property.  According to the wix-user group message
http://sourceforge.net/mailarchive/message.php?msg_id=457FBE32.5050704%4
0bobs.org, "the general approach is to make the directory ID the same as
the property name."

 

That approach works fine for the property [ProgramFilesFolder], such as
used below.  It installs to C:\Program Files\Acme Tooling\Tools, which
is what I would expect.

<Directory Id="TARGETDIR" Name="SourceDir">

  <Directory Id="ProgramFilesFolder">

    <Directory Id="dirManufacturer" Name="Acme Tooling">

      <Directory Id="dirProductName" Name="Tools">

        <Directory Id="dirEnvironment" Name="test">

 

Unfortunately, this static approach will not work for me, as the
requirements dictate a more dynamic approach, such as changing the value
of the property [Environment].  So, the next revision was as follows:

<Property Id="Environment">test</Property>

. . .

<Directory Id="TARGETDIR" Name="SourceDir">

  <Directory Id="ProgramFilesFolder">

    <Directory Id="Manufacturer">

      <Directory Id="ProductName">

        <Directory Id="Environment">

 

That failed with errors in light, as [Manufacturer] and [ProductName]
are also MSI Public Properties and can cause unforeseen side effects.
OK, so I'll use a custom action and just copy those property values over
to a different property.

<Property Id="Environment">test</Property>

. . .

<CustomAction Id="SetAppManufacturer" Property="AppManufacturer"
Value="[Manufacturer]" />

<CustomAction Id="SetAppProductName" Property="AppProductName"
Value="[ProductName]" />

. . .

<Directory Id="TARGETDIR" Name="SourceDir">

  <Directory Id="ProgramFilesFolder">

    <Directory Id="AppManufacturer">

      <Directory Id="AppProductName">

        <Directory Id="Environment">

 

So, that gets me by the light error.  When installing the MSI, though, I
shortly receive the error "Could not access network location Acme Tools"
([Manufacturer] = "Acme Tooling").  (Side Note: if [Manufacturer] is an
8.3-compliant name [e.g. "Acme"], the MSI will hang for 40 - 60 seconds
before failing with a similar error message: "Could not access network
location Acme.")  I'm not sure how to get around this "Could not access
network location" error.  At the time of the error, the log is as
follows:

MSI (s) (2C:F0) [12:26:48:236]: Note: 1: 2205 2:  3: Patch 

MSI (s) (2C:F0) [12:26:48:236]: Note: 1: 2205 2:  3: Condition 

MSI (s) (2C:F0) [12:26:48:236]: Note: 1: 1314 2: Acme Tooling 

MSI (s) (2C:F0) [12:26:48:236]: Note: 1: 1606 2: Acme Tooling 

MSI (c) (0C:D8) [12:26:48:252]: Font created.  Charset: Req=0, Ret=0,
Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

 

MSI (s) (2C:F0) [12:26:52:689]: Product: Tools -- Error 1606. Could not
access network location Acme Tooling.

 

MSI (s) (2C:F0) [12:26:52:705]: Note: 1: 1606 2: Acme Tooling 

MSI (c) (0C:D8) [12:26:52:705]: Font created.  Charset: Req=0, Ret=0,
Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

 

MSI (s) (2C:F0) [12:27:30:423]: Product: Tools -- Error 1606. Could not
access network location Acme Tooling.

 

Again, the properties need to support values declared or assigned at
install time, so the preprocessor-based workarounds described in other
posts won't work under this scenario.  Even [PropertyName] needs to be
easily changeable.  If necessary, I think I could even swing utilizing a
bootstrapper (such as dotNetInstaller) and/or WiRunSQL.vbs to make the
necessary property changes.

 

 

A second issue is how to get the path of a parent directory from a
folder path that exists in the registry.  Examples I saw in other
WiX-users posts seemed to deal with finding the parent directory of a
specific file; in this case, I want the parent directory of a folder.
For instance, if a third-party program is installed to
D:\Applications\UtilityApp, I need to default the installation to
install under D:\Applications (and, yes, the case of installation to the
root of a drive is covered).  I can pull the directory path (e.g.
"D:\Applications\UtilityApp") from the registry, but I'm not sure how to
derive the parent directory.  I tried adding a child Directory element
with a name of ".."; however, that was disallowed as an invalid name.  I
then tried changing the path D:\Applications\UtilityApp\ to
D:\Applications\UtilityApp\..\ (via custom actions); however, that
failed during install with an error message, "the folder path '..'
contains an invalid character."

 

 

Apart from these issues, I think I have the other multi-instance items
addressed.  I would appreciate any insight.

 

 

Thank you,

Matthew

 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to