1

In my .wxs file, I have the following file declaration. This file already exists in the installation directory. It is not being copied from the source directory. I need to update it using util:XmlConfig during the install. The XmlConfig part is working.

<File Id="AppConfig" Name="Dynamics.exe.config" Source="C:\Program Files (x86)\Microsoft Dynamics\GP2010\Dynamics.exe.config" />

The problem is I can't assume the file is always going to exist in that same location. I'd really like to simply reference it like so:

<File Id="AppConfig" Name="[#INSTALLDIR]\Dynamics.exe.config" />

However, that fails with the following message:

> light.exe ....
The system cannot find the file 'SourceDir\....\[#INSTALLDIR]\Dynamics.exe.config'

How can I say "the file already exists in the installation directory, use that file during the installation, and do not validate for it now"?

Chad Braun-Duin
  • 2,188
  • 2
  • 19
  • 26

1 Answers1

0

Directories are available with bracket notation as though they were regular properties. If you don't need to install the Dynamics.exe.config but just access it with XmlConfig elements, you can simply reference that directory and don't need to bother with the File element:

<Component Id="Dynamics.exe.config" KeyPath="yes" Guid="*">
  <util:XmlConfig Id="Dynamics.exe.config.XmlConfig1"
                  On="install"
                  Action="..."
                  File="[INSTALLDIR]\Dynamics.exe.config"
                  ...
                  />
  <util:XmlConfig Id="Dynamics.exe.config.XmlConfig2"
                  On="install"
                  Action="..."
                  File="[INSTALLDIR]\Dynamics.exe.config"
                  ...
                  />
</Component>
Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66