cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DLee65
Level 13

Text Replacement not working

I have a basic MSI project that includes a .reg file that I want to modify with installation specific data.
This should be a great job for the text replacement feature in InstallShield.

In the IDE I have added myfile.reg to a component for myfile.reg
Select the Text File changes option and add a replacement set
For component set it to Myfile component.
Target folder is [INSTALLDIR]
Include Files myfile.reg
add three replacements.

  • InstallPath
  • ComputerName
  • MainComputer


For InstallPath set the Find What value to: "InstallPath"="[INSTALLDIR]", the Replace with value to the same value.
For ComputerName set the Find What value to: "SQLserverLocation"="[COMPUTERNAME]", the replace with value to "SQLserverLocation"="[ComputerName]"
For MainComputer set the Find What value to: "MainComputer"="[MainComputer]", the replace with value to "MainComputer"="[MAIN_COMPUTER]"

When I run the install the .reg file installs correctly.
The msi log file shows where it attempts the process

MSI (s) (9C:4C) [13:28:54:446]: Executing op: ActionStart(Name=ISXmlUnInstall,,)
InstallShield 13:28:54: Processing the replacement set 'MyFile.reg'; Target Folder: C:\Program Files (x86)\Amazing Charts\, Include Files: MyFile.reg, Exclude Files: , Include Subfolders: No, Look in Unicode Files: Yes, Look in ANSI Files: Yes
MSI (s) (9C:4C) [13:28:54:446]: Executing op: CustomActionSchedule(Action=ISXmlUnInstall,ActionType=3073,Source=BinaryData,Target=ISXmlUnInstall,CustomActionData=C:\Users\qa\AppData\Local\Temp\XMLA365.tmp)

There is no indication of any problems.
However, the myfile.reg still appears as it appears on my development machine with all the placeholder values.

What am I doing wrong in my implementation?
The find what values are literal copy / paste from the .reg file

Thank you for any insight on this.

EDIT: I have a suspicion that I am testing now. The encoding for the .reg file was not ANSI, but UCS-2 Little Endian. I have converted it to ANSI so let's see what this does.
EDIT2: I tested with ANSI formatted .reg file and that did not fix my problem. MSI Log file reads the same as before. Actually I just realized that the log file has more data:
[code]
MSI (s) (1C:88) [14:42:16:318]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIC20E.tmp, Entrypoint: ISSearchReplaceInstall
InstallShield 14:42:16: Processing the replacement set 'AmazingCharts.xml'; Target Folder: C:\Program Files (x86)\Amazing Charts\, Include Files: AmazingCharts.xml, Exclude Files: , Include Subfolders: No, Look in Unicode Files: Yes, Look in ANSI Files: Yes
InstallShield 14:42:16: Processing the replacement set 'ACConfigUserProfile.reg'; Target Folder: C:\Program Files (x86)\Amazing Charts\, Include Files: ACConfigUserProfile.reg, Exclude Files: , Include Subfolders: No, Look in Unicode Files: Yes, Look in ANSI Files: Yes
InstallShield 14:42:16: Processing the file 'C:\Program Files (x86)\Amazing Charts\ACConfigUserProfile.reg'...
InstallShield 14:42:16: Reading the file C:\Program Files (x86)\Amazing Charts\ACConfigUserProfile.reg...
InstallShield 14:42:16: Processing the replacement item 'MainComputer'...
InstallShield 14:42:16: Number of items replaced: 0
InstallShield 14:42:16: Processing the replacement item 'RegInstallPath'...
InstallShield 14:42:16: Number of items replaced: 0
InstallShield 14:42:16: Processing the replacement item 'ComputerName'...
InstallShield 14:42:16: Number of items replaced: 0
MSI (s) (1C:58) [14:42:16:427]: Executing op: ActionStart(Name=RegisterFonts,Description=Registering fonts,Template=Font: [1])[/code]
Labels (1)
0 Kudos
(1) Reply
DLee65
Level 13

After some trial and error, the problem is with using square brackets in the target file for words to find. I suspect that the setup assumes these are properties and gets confused when I intended them to be plain text.

So I modified the .reg file to use braces in place of the square brackets.
I updated the Find text value to match.
After this change and a recompile the process now works.

Just a recommendation - the help should specify that the target file cannot use square brackets if it is not going to support it for the find text.

Hopefully this saves someone else a day's worth of work. 😄
0 Kudos