How to replace a file in an MSI using a transform
The following article uses options that are available starting with the Architect edition and project type.
Let’s assume that you have an MSI and you want to change a certain file that it installs. e.g. [ProgramFiles64Folder]CompanyName\Example\NewFile.txt
We create a transform (MST) that replaces the file that you want during installation.
You have a folder [ProgramFiles64Folder]CompanyName\Example
- Open Advanced Installer, click New in the left pane. In the Start Page select MST, click on New Transform and Create Project
- Select the MSI that you want to change.
- Navigate to Files and Folders page
- Right-click on [ProgramFiles64Folder]CompanyName\Example -> New Folder and name it TestFolder. You should have a structure as [ProgramFiles64Folder]CompanyName\Example\TestFolder Right-click TestFolder, check “Install folder content into the parent folder”
- Place the new file in TestFolder
- After the desired changes are done, click File > Save
Besides the MSI a new MST and CAB is created. You can check the name of the new CAB file in Builds Page, Advanced CAB Layout section or the Table Editor, Media table.
That’s it; Advanced Installer automatically places a late sequence for the new file. When you now install the application use the following command line:
msiexec /i NameofMSI.msi transforms=NameofMST.mst
If you have multiple files with the same name in one location, for example, having three "NewFile.txt", the one with the highest sequence is placed at install time. You can check the sequence for each file in Table Editor, File table.