Russell Stevens
4/6/2006 6:53:00 PM
Phil,
In another post you write
*********
The difficulty is when you try to add [TARGETDIR] as well it no longer
works. A CustomActionData that says /src=[SourceDir] /dst=[TARGETDIR] fails
with the FileNotFoundException. The issue seems to be that internally, the
project is generating a Windows Installer custom action that calls the
embedded InstallUtil DLL, passing:
/installtype=notransaction /action=install /LogFile= /src=[SourceDir]
/dst=[TARGETDIR] "[#_01E5F33094CF446280D30C8F055503CE]" "[VSDFxConfigFile]"
What happens is the the /src and /dst specs are in the middle of a logfile
specification, which breaks.
***************
Of course, if you want to copy files from the source to the target, you
need to know both at the same time. One workaround that seems to work;
1. Do the normal [TARGETDIR] custom action in the override for the install
class. While you are in there you can do your normal stuff.
2. In the Registry section, write the value of the [TARGETDIR] to the
registry (create a new key for your app).
3. Add another custom action for the commit phase to get the [SourceDir]
4. In the override for the commit class retrieve the [TARGETDIR] from the
registry, get the [SorceDir] from argument parameters. You now have
everything you need to copy stuff from the msi source folder to the target
folder. This is done in the commit phase instead of the install phase but
who cares after wasting all this time trying to figure out how to do it at
all <g>.
This works but why does Microsoft make something that should be trivial so
complicated <g>. Note the [SourceDir] only has a single "\" in the front if
the source is a UNC path - just another gotcha.....