vidur
Posts: 43
Joined: Thu Jul 31, 2014 4:21 am

Getting MSI name

Hi,

So ive been trying to make a backup copy of my msi installer on the user's PC while installing. I can do this with the help of custom actions and file operations. But when i Do this, I have to specify the File Name in the file operation. In the case the .msi name has changed i will miss to make the copy.

For now I'm using the following technique

Make property :MSIFODLER
use custom action to set property - "SourceDir" to MSIFODLER
Make property based folder from MSIFODLER
File operation copy from MSIFODLER to app dir , "Filename: Myapp.msi"

The problem is, if someone renames the MyApp.msi , it will fail to copy.
I know we can use property : "[OriginalDatabase]" to get full path (in which case it will be "C:\user\documents\myapp.msi" ) but i cant use this in the file operation.

QUERY:
Is there a way i can extract the name of the MSIfrom this path in advanced installer or is there a property i can use which has just the MSI name?

Thanks
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Getting MSI name

Hello,

You can take advantage of the OriginalDatabase to get the full path and then you can retrieve the name of the .msi file using a custom action.
For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

Please let me know if that helped, otherwise give me more details.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vidur
Posts: 43
Joined: Thu Jul 31, 2014 4:21 am

Re: Getting MSI name

Hi Dan,

Thanks for your reply. The VB script worked fine to get the name and assign it to a property.
But now im having trouble using that property in the copy file operation. Are we allowed to use properties in the file name section of the file copy operation? If not is there a work around?
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Getting MSI name

Hi,

Indeed, the file name section is not of formatted data type, so you are not able to use references to properties.

The workaround would be to use custom action to perform the backup operation. Please take a look on the Options to integrate and debug custom actions article which may be useful to you.

Let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vidur
Posts: 43
Joined: Thu Jul 31, 2014 4:21 am

Re: Getting MSI name

Hi Dan,

Thanks again for your reply. The workaround works fine. I copy the MSI to another location using custom dll.

I still have one problem though. The reason why im trying to do this is so that I can patch using MSI even if the MSI is deleted from the PC. By making a copy i can ensure that there is a copy of that MSI on the System.
The problem arises in making the installer Point to my MSI instead of the original.
I understand that the values for the package name is stored at
HKEY_CLASSES_ROOT\Installer\Products\[PRODUCTID]\SourceList
key -
PackageName
in the registry and the source folder is at
HKEY_CLASSES_ROOT\Installer\Products\PRODUCTID\SourceList\Net
.
Is there any way i can change the values of this registry during installation? (Any installer property that corresponds to these registry values?)

Thanks again for your support
Codename K
Posts: 471
Joined: Fri Jan 29, 2010 3:04 pm

Re: Getting MSI name

K
Catalin
Posts: 6600
Joined: Wed Jun 13, 2018 7:49 am

Re: Getting MSI name

Hello K,

Thank you for your followup on this and for sharing the solution!

It will for sure be of help for further users facing a similar scenario.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”