There is a "bug" (or lack of functionality according to InstallShield) in
both Developer 7 and 8 standard projects which prevents the Windows
Installer "Browse For Source" dialog appearing when you try and repair,
modify or patch an installation _AND_ the original source media (CD, network
or local drive) is not available. (This may be because standard projects use
an External UI?)
The installation simply fails, where as with a Basic MSI project you get the
WI dialog, can pick an alternative location, and the installation continues
as normal. I reported this in the summer of last year, and when I was told
this was not fixed in V8, I've decided I'd like to do something about it
myself.
What I'd like to do is for modify/repair/patch _IF_ the source media is not
available, either force the WI dialog to appear, or pop up a custom dialog,
allow the user to type/browse for a location, and then set the INSTALLSOURCE
to the chosen location.
I want to do this in a way that keeps the installer happy.
I'm probably going to have to do this either in INSTALLSCRIPT, or via a
custom action written in VBScript.
Anybody got any bright ideas on this topic?
Alastair
In decreasing order of cleanliness, here are three potential solutions:
If an External UI is used and you can tweak its behavior, by far the easiest
solution is to simply call MsiSetInternalUI and pass the
INSTALLUILEVEL_SOURCERESONLY flag along with INSTALLUILEVEL_NONE. This tells MSI
to use its own internal source resolution dialog but to forward all other
messages to the ExternalUI. If you can do this, it should solve your problem by
itself. Be aware that this flag is only available with MSI 2.0 and later.
Another possibility is to schedule a custom action after CostFinalize and have
it do the following:
1) Call MsiDoAction("ResolveSource")
2) If that returns failure, pop your browse dialog.
3) If the user browsed to a source you want to try, call
MsiSourceListAddSource()
4) Goto step 1 and repeat until it succeeds.
There are quite a few drawbacks to this proposal though: First, it will not work
for URL sources because MsiSourceListAddSource doesn't support URL sources.
(Media are no problem, you don't need to call MsiSourceListAddSource for them at
all, they're automatically checked if media is enabled for the package.) Second,
once you add a source to the list it will remain there and be checked every time
a source is needed unless you also call MsiSourceListClearAll(), which clears
the entire network source list (including any pre-existing sources). Third, it
doesn't hook MSI's "need source" logic, it always requires a source. Fourth, it
can't help you if a source is required before your custom action runs (such as
due to a REINSTALLMODE of "v" or some other reason. Fifth, you have to handle
your own UILevel checking for silent installs. And finally, drawback #6, I've
never tried it and don't know anybody who has tried it. The advantage is that
MSI is responsible for validating that the path is a valid source and
integrating with system policy. Plus you're contained in the MSI file itself and
can run regardless of how the package is launched.
If that won't work for some reason, your other alternative is to verify a source
before triggering the MSI install via a bootstrapper of some sort and then
either use the SourceList API to add that source before triggering the install
or trigger the install directly from that path. Unfortunately, the drawbacks are
many: It requires a bootstrapper, the same SourceList API limitations apply,
you're responsible for your own source validation, you don't get good retry
behavior, and it always requires a source.
Hopefully one of the above proposals will help you perform some investigation.
Each possibility has its advantages and drawbacks, so you'll have to decide
whether any of them meet your needs.
-Chris Gouge
Microsoft Windows Installer Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
MSI FAQ:
<http://www.microsoft.com/windows2000/community/centers/management/msi_faq.asp>
"Alastair Cameron" <alastair...@blueyonder.co.uk> wrote in message
news:#pYZUa3yCHA.1636@TK2MSFTNGP12...