cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JohnBrent
Level 5

preloading custom install-time dialog

i found an article online that instructed me on tweaking a BASIC MSI dialog, adding an edit field thru which i can modify an included CONFIG file = perfect

well, almost perfect

what would really be perfect is if i could populate that dialog edit field with the value that is in the included CONFIG file - as presented in the dialog, the field is blank

here's the link i used to help with the BASIC MSI tweak ... http://helpnet.installshield.com/installshield18helplib/TextFileChanges-MSIProps.htm

any help for the noob who wants that field preloaded?

thanks!
Labels (1)
0 Kudos
(14) Replies
ElenaN
Level 6

You should just set Property associated with the edit field into value from the CONFIG file before you show your dialog
0 Kudos
JohnBrent
Level 5

i can see how to use a custom action to set the value of the editfield property, but as far as i know (which is not much) i can only do that manually

i really want to automatically extract the value from the CONFIG and plug it in there - can i do that?
0 Kudos
JohnBrent
Level 5

okay, how about this?

i see i can capture the CONFIG settings by importing the file in the XML FILE CHANGES wizard

at what point in the process does that happen? i tried a little dummy package, but all the values came back to my dialog as "0" - has the import not happened yet? can i get it to fire earlier than normal just so i can read those values?
0 Kudos
ElenaN
Level 6

>> i really want to automatically extract the value from the CONFIG and plug it in there - can i do that?
As a variant – try System Search with “XML file value” type. However I personally never used that one, so can’t really advice here. System Search goes during AppSearch action (as far as I know) which is before dialogs are shown.


In my project config file is encrypted. So to read from it I needed to write custom action dll. I read necessary value from config file via c++ code and pass it to the installer using MsiSetProperty function. To learn more about this approach google for “Windows Installer DLL Custom Actions” or “MSI Custom Action DLL”.
0 Kudos
DebbieL
Level 17

The example in the following topic may be helpful:
Searching for XML Data
0 Kudos
JohnBrent
Level 5

DebbieL wrote:
The example in the following topic may be helpful:
Searching for XML Data


YIKES - it works

i had seen that wizard previously, but i jumped in without knowing what i was doing -- i got close to getting it right, but apparently the hints shown in the wizard dialog aren't accurate --> for instance, when it shows the example for the XPath, it shows "Element/SubElement" --> well, it doesn't work without a leading "/" = "/Element/SubElement", which the linked topic shows

so, yay, thanks to everyone who pointed me in the right direction! 🙂
0 Kudos
JohnBrent
Level 5

well, it works because ...

(1) the installation media was copied to a local drive

this allows the SYSTEM SEARCH to find the file i need to examine, even tho at install-time it only exists in the installation

(2) the file i need to examine has a unique name

if i needed to search for something with a name like WEB.CONFIG, i'd be screwed unless i knew the exact path to look in
0 Kudos
JohnBrent
Level 5

JohnBrent wrote:
if i needed to search for something with a name like WEB.CONFIG, i'd be screwed unless i knew the exact path to look in


in my installation package that successfully modified an included .CONFIG, the filename was "appname.exe.config" - and i used the TXT CHANGE wizard - yay for me

as i tried to apply the things i did in the successful package to a new installation - one where the contents are an ASP web site - and the file i want to change is WEB.CONFIG --- i found that what i learned the 1st time around don't work so well this time

apparently, you can't modify a file named "web.config" with the TXT CHANGE wizard -- i'm guessing because that's a protected file??? (not because of any MS attribute, but because it's a web page file???)

BUT using the XML CHANGE wizard works like a champ changing that pesky web.config

yay for me again 🙂

the only hack i had to employ was to include a copy of the web.config pre-renamed to some unique name - so that i don't have to know the exact path to the file & so that it wouldnt get lost among all the other web.configs on the system
0 Kudos
DebbieL
Level 17

I'm not sure that I understand. Are you familiar with using Windows Installer properties for the path to the file that you want to change?

The following help topic contains an example of how to modify a file called web.config by using the INSTALLDIR property to specify its path:
Using Windows Installer Properties to Dynamically Modify Text Files

In this example, the web.config file is installed at run time and then modified based on changes that are configured through the Text File Changes view. At run time, Windows Installer resolves INSTALLDIR to the main product installation directory that is defined in the General Information view.

The same sort of thing can be done to specify the path to the file for changes that are configured through the XML File Changes view.
0 Kudos
JohnBrent
Level 5

plan =
1. package an installation that includes the file "xxxxx.config"
2. have the installation present a dialog that will gather info with which to modify file xxxxx.config
3. have that dialog pre-populated with the data from file xxxxx.config
4. NOT have to know where the installation media resides

system = C:, D:, E:, F:

package 1 works =
1. installation media copied to temp folder on local drive E:
2. file name = "applicationxyz.exe.config"
3. system search of path "\" finds file & extracts XML values
4. dialog presents values, accepts new values
5. TXT CHANGE wizard applies new values to designated file

package 2 didn't work as follows =
1. installation media copied to temp folder on local drive E:
2. file name = "web.config"
3. system search finds 1st file with that name - it's the wrong file, so values are not extracted
4. dialog fields are blank 😞
5. installation stopped 😞

package 2 didn't work as follows =
1. installation media copied to known folder on local drive C:
2. file name = "web.config"
3. system search to known path finds file, values are extracted
4. dialog presents values, accepts new values
5. TXT CHANGE wizard does NOT modify file

package 2 DOES work as follows =
1. installation media copied to known folder on local drive C:
2. package includes web.config (to be modified) and copy of web.config (renamed "uniquename.config"
3. system search of path "\" finds unique file, values are extracted
4. dialog presents values, accepts new values
5. XML CHANGE wizard successfully updated web.config
0 Kudos
DebbieL
Level 17

How are you finding the .config file? (What did you enter in the System Search Wizard panel shown below?) It sounds like your search is looking in too many places.

By the way, does your installation really need to search to find the default values? Can you instead just define your properties with default values through the Property Manager view?
0 Kudos
JohnBrent
Level 5

interesting ...

i changed my "Look in-full path" to SUPPORTDIR but that didnt work (appears to be undefined at this point?)

then i changed it to SOURCEDIR - and that worked!

BUT

now my DESTINATION_FOLDER dialog shows that my INSTALLDIR has changed to the exact path to the web.config file in the "sourcedir"

here's what INSTALLDIR should be, as specified in the General Info page =

[ProgramFilesFolder]VOLT Delta\ReplicationDirector
(which should be C:\program files\...)

here's the string that shows up as INSTALLDIR on the DESTINATION_FOLDER dialog =

E:\INSTALLATION MEDIA\repdir004\DISK1\program files\VOLT Delta\ReplicationDirector\Web.config\

... i'm so confused ... 😞
0 Kudos
JohnBrent
Level 5

JohnBrent wrote:
... i'm so confused ... 😞


maybe not

after rebuilding the package a few more times, running the setup now croaks at the "calculating size requirements" billboard

maybe i shouldve included the following info earlier, but ... this install package is part of a Visual Studio 2010 project --- and i think the installation is getting corrupted by VS

what other explanation can there be for INSTALLDIR now pointing to some non-local device?

[aside - i've built a new package completely separated from VS & it works fine 🙂 ]
0 Kudos
DebbieL
Level 17

It is difficult to determine what's going on with your project without seeing it. It sounds like perhaps a control on one of your dialogs got erroneously associated with the wrong property, and maybe by re-creating the project, you've eliminated the problem. I'm not aware of Visual Studio corrupting InstallShield projects when the projects are part of a Visual Studio solution.

If you're curious, you may want to use a diff to see what's different between two projects. This may also be useful if you occasionally backed up copies of your project in a source code control system; you'd be able to see differences between different saved versions of your project and determine when a problem was introduced. If your InstallShield projects are saved as XML, you can use any diff tool that lets you compare text files. If your InstallShield projects are saved as binary files, you can use InstallShield MSI Diff.

Another troubleshooting tool you'll want to consider if you run into problems again is the run-time log. KB article Q104807 explains how to log an installation.
0 Kudos