2
votes

I would like to add a Virtual directory to my Web Application that points to a certain folder outside the TARGETDIR,

any idea or example of how could I achieve this with WIX?

Thanks in advance.

1

1 Answers

0
votes

The WebVirtualDir element must point to a Directory element. Fortunately, you can easily retarget a Directory in many different ways. Assuming a directory tree like this:

<Directory Id="TARGETDIR" Name="Source">
  <Directory Id="VIRTUALDIR" Name="retargeted">
  </Directory>
</Directory>

And Component like:

<Component Id="Vdir" Directory="VIRTUALDIR">
   <File Source="myweb.dll" />
   <iis:WebVirtualDir Id="Myvdir" Directory="VIRTUALDIR" Alias="my/app/here" />
</Component>

Now you can treat the VIRTUALDIR like a Property. Because it is all caps you can set it on the command-line:

msiexec /i foo.msi /l*v log.txt VIRTUALDIR=C:\root\web\vdirhere

Or set it via a UI element in an MSI dialog (too much code to show example) or even use a search to set it:

<Property Id="VIRTUALDIR">
  <RegistrySearch Id="FindPlaceToPutVdir" ... />
</Property>

Lots of options.