We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

swilliams
Posts: 7
Joined: Wed Jul 03, 2013 12:45 pm

Using existing service's version number as condition

I'm trying to see what I can do natively in AI without having to create my own custom action dll...

What I have to deal with...
I have some application extensions to install.
The application always installs a particular service.
The application version can be determined from the version number of the service executable.
There are different sets of files for different versions of the application.
The extension files should be installed to the same folder as the service executable.
The extension files are .NET and some need to be registered with installutil.
The same extension files are to be installed for both 32bit and 64bit computers. (Were compiled as "Any CPU")
The correct bitness installutil (\Windows\Microsoft.NET\Framework\ or \Windows\Microsoft.NET\Framework64\) needs to be used

What I have working so far...
Query registry for full path to service executable (Registry Search)
Query the state of the service (DetectService custom action)


My questions...
Given a full file path (C:\Program Files\OtherCompany\OtherProduct\TheService.exe), how can I extract the path and use it as a target folder?
Given a full file path, how can I extract the version number of the file and use PARTS of it in a condition (only major.minor for instance)
How can I cause the install to halt if the service isn't installed? (Service state = Not Found)
How can I cause the install to pause and wait (or just halt) for the service to be stopped? (The installer should NOT stop the service)

I know I can create a custom action DLL, but I'd like to see what can be accomplished without that.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Using existing service's version number as condition

Hello,
Given a full file path (C:\Program Files\OtherCompany\OtherProduct\TheService.exe), how can I extract the path and use it as a target folder?
In order to achieve that you can add a property based folder using the [New folder ] >> [Property based] toolbar button. Property based folders will be resolved at install time to the values from the respective property. This property can be one of the Windows Installer Folders, the result of a Search operation or a custom property set in the Install Parameters page.
Given a full file path, how can I extract the version number of the file and use PARTS of it in a condition (only major.minor for instance)
In order to search for a file version you can go in the “Search” page and use the [New Extended Search] >> [File Version] toolbar button .
How can I cause the install to halt if the service isn't installed? (Service state = Not Found)
After your previously added “Detect service” custom action, you can add Launch Attached file custom action and select to execute a function from a script that will end the execution. You should conditionate the execution of that custom action if the Service State = “Not Found”. I've atached a .zip containing a script that can be used for that. Just edit the “Function” field : ExitSetupFromVBS.
How can I cause the install to pause and wait (or just halt) for the service to be stopped? (The installer should NOT stop the service)
You can do the same thing, by adding another Launch Attached file custom action and select to execute the custom action if the Service State = “Running”.

Let us know if that helped otherwise give us more details about your scenario.

Best regards,
Dan
Attachments
exit.zip
(266 Bytes) Downloaded 317 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
swilliams
Posts: 7
Joined: Wed Jul 03, 2013 12:45 pm

Re: Using existing service's version number as condition

Scott wrote: Given a full file path (C:\Program Files\OtherCompany\OtherProduct\TheService.exe), how can I extract the path and use it as a target folder?
Dan wrote: In order to achieve that you can add a property based folder using the [New folder ] >> [Property based] toolbar button. Property based folders will be resolved at install time to the values from the respective property. This property can be one of the Windows Installer Folders, the result of a Search operation or a custom property set in the Install Parameters page.
I saw the property based folders. However, when I search for the service's ImagePath in the registry, it includes the service filename. How would I tell the property-based folder to use just the path from a property with a value like "c:\program files\company\product\TheService.exe" ?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Using existing service's version number as condition

Hello,

Unfortunately you will have to do your own custom action which will parse the associated property of the related search and extract the desired path and, then set accordingly (with the extracted value) the property used for property-based folder.

Please notice that you should add your custom action before “Wizard Dialogs stage” >> “Paths Resolution”.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”