I'm trying to retrieve data from a Textbox in Visual Studio Project Installer but I simply keep failing. I have no idea how to retrieve data from, let's say the EDITA2 field and it seems the internet has no answers so far.
The project I'm talking about is a windows service you install with the mentioned installer. In the installer you can configure the service. I want to get data like server IPs and computer names and I want to use this data later in the running service. Talking of service, is there a possibility to automatically start the service after installation?
Summing up, i want to write data from the installer to a text file and to start a batch file after the installation process is completet. Can you help me please?
Thanks in advance for an answer.
I think you are searching for Custom Actions
https://msdn.microsoft.com/library/d9k65z2d(v=vs.100).aspx
https://msdn.microsoft.com/en-us/library/9cdb5eda(v=vs.100).aspx
To setup the StartType of a Service you require a ServiceInstaller
Maybe this helps http://www.docstorus.com/viewer.aspx?code=7c7ccc28-6503-4779-877e-f350faab6741
This is the documentation for the Textboxes user interface dialog:
https://msdn.microsoft.com/en-us/library/e04k6f53(v=vs.100).aspx
The identifier EDITA1 (and others) is a property name that you can use later in (for example) custom actions. Without knowing exactly what kind of custom action you might be thinking of it's hard to say how you use it. In general, specifying it as a parameter to the custom action as [EDITA1] will cause it to be resolved to its actual value. But if you just want to store the values in the registry you'd create a registry item with the value [EDITA1].
To start the service in Visual Studio setups that install services with installer classes you'd need to overwrite the Install method, calling base.Install() and then adding code to start the service. Similarly at uninstall or upgrade time you can override the Uninstall method and stop the service before calling base.Uninstall().
These posts have some Textboxes examples:
Setup Project: user enters a value then store it in a text file or database
Visual Studio setups are not very useful with services and UI. There is no way to validate what the user enters at the time it is entered - if you validate it with a custom action it will be at the end of the install and the entire install will fail and roll back. Windows Installer has built-in support to start/stop/delete/install services but VS setups don't use it. If this is something you do regularly it might be useful to consider another tool, and that might have a learning curve but the resulting MSI will be more reliable and easier to use.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.