philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Using value from a dialogue and using it to install a Windows Service

Hi,

I'm building an installer that installs my application as a windows service. So far, so good but i'm struggling with the next part.

My application relies on a central configuration file, the location/name of this can vary depending on the target network so i've created a dialogue with a text box to enter the data. I've called this text box "ConfigPath".

I was about to ask this question when i realised that i could get the property by specifying it inside the square brackets so i have the following

-config [ConfigPath]\config.conf -config-directory C:\ProgramData\somedata\config --reloadConfigInterval 120 start= delayed-auto

The problem is the value is blank when the service installs and it ends up point the service to use
-config \config.conf -config-directory C:\ProgramData\Prevensys\config --reloadConfigInterval 120 start= delayed-auto

Really it should be a UNC path to a network share
-config \\UNC_PATH_FROM_TEXTBOX\config.conf -config-directory C:\ProgramData\Prevensys\config --reloadConfigInterval 120 start= delayed-auto

How can i get this information? I tried to output it to a text file to see if the value was being carried over but it hasn't which makes me think i've probably missed something super simple.

Thanks

Phil
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Using value from a dialogue and using it to install a Windows Service

Hello Phil and welcome to our forums,

Most likely this happens because you have used a private property name (i.e. "ConfigPath") instead of a public property name (e.g. CONFIG_PATH). A private property value is reset to default (or deleted if no default is defined in the setup project) when the installation goes from Wizard Dialogs Stage to Install Execution Stage. While the value of a public property is preserver between the two execution stages. A public property name can not include any lower case letter.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Re: Using value from a dialogue and using it to install a Windows Service

Hi Daniel, Thanks for getting back to me.

So it is literally a case of changing the name from configPAth to CONFIG_PATH?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Using value from a dialogue and using it to install a Windows Service

Hi,

Yes, this is my assumption. If this still doesn't work just let me know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Re: Using value from a dialogue and using it to install a Windows Service

Thanks Daniel, this was the case.
I changed the name and provided a default value. Now when i run the installer it either uses the default value or a custom one entered during installation.

I meant to respond sooner but I've only just got round to working on this again.
Catalin
Posts: 6596
Joined: Wed Jun 13, 2018 7:49 am

Re: Using value from a dialogue and using it to install a Windows Service

You are always welcome, Phil.

We are glad you got this working.

Just let us know anytime you got a question and we will be glad to assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Re: Using value from a dialogue and using it to install a Windows Service

Thanks! i do have another question but I'll open a separate topic for that.
Catalin
Posts: 6596
Joined: Wed Jun 13, 2018 7:49 am

Re: Using value from a dialogue and using it to install a Windows Service

Thanks! i do have another question but I'll open a separate topic for that.
Sure Phill, I have already answered your new thread here:

viewtopic.php?f=5&t=39843&p=107412#p107412

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

Return to “Building Installers”