0

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.

Speedbird
  • 41
  • 1
  • 2
  • 7
  • take a look at this answer here in support of the answer from Lukas and my comment below. https://stackoverflow.com/questions/24484478/run-execommand-in-customaction-as-administrator-mode-in-wix-installer – Simon Price Sep 21 '17 at 07:02

2 Answers2

1

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

Lukas
  • 161
  • 7
  • You are on the right path with this and the OP will need to create a custom action. I have done this before a few moons ago with Wix Installers http://wixtoolset.org/ and its relatively simple to acheive. – Simon Price Sep 21 '17 at 07:00
0

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:

Overriding "Textboxes" dialog fields from the command line in MSI installer (Visual Studio 2010 Web Setup)

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.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Hi and thanks for the reply and sorry for my late one! I want to write data that the user puts into the EDIT boxes into a config (.txt) file. How can I do this? – Speedbird Oct 25 '17 at 12:29
  • Can you please give a litte code example in order to show me how i manage this in my c# code? I'm can't find anything about it except this from you but it's no help for me: They are not kept anywhere. If you want to save them you need to do it yourself. It's straightforward just to create a registry entry in the setup project's IDE where in the value part you put property name in square brackets, such as [EDITA1] – Speedbird Oct 27 '17 at 09:53