cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jdykstra
Level 3

Rename file while installing

Hi,

I'm hoping to build an installer that can take a generically named file, reference it from a .ism file to produce a .msi, but have the .msi call the file something different when it's installed to the end-user's PC. In other words, I would like the file to be renamed as part of the compilation or installation process.

For example, if I have have a file called application.exe on the machine where the installer is being compiled, I want to make an installer that places the same file on the end-user's PC, but have it called application_v3.exe. It doesn't matter to me if the file is stored internally in the .msi as application.exe or application_v3.exe.

To compound things, I would like the version to come from a property, if possible.

I realize there are other options, such as placing the file in a folder that contains the version number, and/or using the version property of application.exe, but for various business reasons, I need to include the version in the name of the file itself.

Thanks!
Labels (1)
0 Kudos
(5) Replies
RobertDickau
Flexera Alumni

For two sort-of built-in options, you might look at using the DuplicateFile table (to make a copy of a file you just installed with a component) or the MoveFile table (to copy a file that already exists somewhere---perhaps a support file?). You can access both tables in the Direct Editor view, and the MSI help describes what to enter...
0 Kudos
jdykstra
Level 3

Thanks.

Do you know if either the DuplicateFile or MoveFile support using [] or {} in the filenames themselves?

The renaming part isn't difficult--just use the direct editor on the Files table--but I cannot derive part of the name from a property using this method, and was really hoping to do that.

JD.
0 Kudos
RobertDickau
Flexera Alumni

Alas, no, it appears DuplicateFile and MoveFile don't support [PropName] expressions in the target file name. In general, you can look at the MSI topic for a table; a field using the "Formatted" data type supports expanding [Prop] values.

So it seems some sort of custom action will be required to go down this road. (As you know, any technique involving a renamed file will probably affect future patching, will need to address uninstallations and repairs, and so on, so those are things to consider...)
0 Kudos
jdykstra
Level 3

Thanks again Robert.

For now, I'll just leave it the way it is and when I want to change the value of the file name, update it in multiple places. It's not ideal, but it works. Much less of a headache than going the CA route.

Perhaps a future release suggestion - Scan the files table as part of the [] and/or {} interpolation process, extending this preprocessing step to as many tables as possible.
0 Kudos
RobertDickau
Flexera Alumni

I'm sure this is what you're describing, but you can use MSI Automation if your .ism project is in binary format, or text/XML processing if your .ism project is in XML format, so at least you can set up a process to avoid manually changing the table values before a build.
0 Kudos