Hi,
I am trying to install a VB .NET Service. Before InitializeComponent() method in Sub New() of the ProjectInstaller class, I am creating an object of a Windows form to get the user input (UserName, Password, and some other text boxes for the setup which service will use later). I was able to successfully install and start the service if I set either Account = User or Account = LocalSystem in the Properties window of ServiceProcessInstaller.
Now, I want to let user select and based on the input I want to change the Account Type. For this, I have radio buttons to select either of the two options and in Sub New() method, I have the following code, which isn't working -
Public Sub New()
MyBase New()
NewForm.ShowDialog()
If NewForm.RadioButton1.Checked Then
Me.ServiceProcessInstaller1.Account = ServiceAccount.User
UserNameString = "ABC"
PasswordString = "ABC"
ElseIf NewForm.RadioButton2.Checked Then
Me.ServiceProcessInstaller1.Account = ServiceAccount.LocalSystem
End if
End Sub
I think its because the installstate and other service installation files are already copied to the installation folder before NewForm pop-ups and it has Account type already set to either User or LocalSystem.
Can anyone suggest me a way to perform the tweak and make it running?
Thanks!
Regards.
Vishal Sheth