cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
installarama
Level 2

Renaming and Program Files folder...

During install, we have to rename 64 *or* 32 bit compatible DLLs (depending on Win archtecture) and those files get installed in the "Program Files" folder.

The tough part is, the user may not have sufficient rights to allow renaming files in the "Program Files" folder itself.

So we are interested in ideas that will allow us to rename files during install *before* they arrive in the Program Files folder ...and we are thinking that some sort of trick or workaround or "pre-install" step might be needed.

We have tried things like simple InstallShield script as follows, but insufficient rights will be a problem:

function MyFunction(hMSI)
begin
if (SYSINFO.bIsWow64) then
RenameFile(INSTALLDIR+"\\64_name.dll",INSTALLDIR+"\\generic_name.dll");
endif;
end;

We'd appreciate any recommendations for how to rename files that belong in a potentially read-only folder...

Thanks!
Labels (1)
0 Kudos
(4) Replies
TsungH
Level 12

I would recommend having the same filename for both 32- and 64-bit binaries, and installing the components conditionally based on the OS platform.
0 Kudos
installarama
Level 2

TsungH and others:
We are not familiar with the techniques to do this...could you say a little more?
0 Kudos
skolte
Level 7

I have used a C# custom action to rename the files. Basically you need to write a C# class with just one method that renames the files. Compile this class as a managed DLL and add that as a custom action to your installer project. In my case, the files are predefined and C# code determines the architecture so no need to pass anything from the installer. In case, you need to pass info to the C# custom action, you can always set the MSI Properties and read them in your custom action class.

The second approach much easier now, is the way 'TsungH' suggested. You create two components, one with 64bit assemblies, the other with 32bit assemblies. Select the 64bit Component, go to properties and you can simply set '64-Bit Component' property to Yes. You can use 'SYSINFO.bIsWow64 = 0' condition on 32 bit to ensure it install only when architecture is not 64bit.
I am not sure if you have already looked at this thread.
0 Kudos
TsungH
Level 12

To elaborate further, create 2 sets of components, 1 set for 32-bit, the other for 64-bit. It should follow best practice to have 1 file (exe, ocx, dll, chm or hlp) per component.

Set condition in Coponent Settings to install component conditionally. You will find a list of built-in Windows Installer properties here.
0 Kudos