benshaws
Hobbyist Programmer
Hi again,
Visual Studio Community Edition 2019.
.Net Framework 4.6
I have written a simple Windows service. I also have a separate interface to, install the service, set the initial variables for the service and uninstall the service. Install and uninstall both make use of the InstalUtil.exe included in the .Net framework.
On my development computer all my code works fine. However, installion could occur on old pc's running Windows Vista SP2, Windows Server 2012 onwards upto the latest from Microsoft. There will also be x32 and x64 builds of my project.
Currently, I have this:-
Is there a way to obtain the correct path to the correct InstallUtil.exe at runtime?
Is the path to InstallUtil.exe only ever going to be in two directories depending on if x32 or x64.
Hope someone can please advise and thanks for reading.
Benshaws.
Visual Studio Community Edition 2019.
.Net Framework 4.6
I have written a simple Windows service. I also have a separate interface to, install the service, set the initial variables for the service and uninstall the service. Install and uninstall both make use of the InstalUtil.exe included in the .Net framework.
On my development computer all my code works fine. However, installion could occur on old pc's running Windows Vista SP2, Windows Server 2012 onwards upto the latest from Microsoft. There will also be x32 and x64 builds of my project.
Currently, I have this:-
VB.Net 4.6:
'Install the service.
Dim appPath As String = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe"
Dim binPath As String = TxbxProgramPath.Text + "calibre-service.exe"
Dim installUtil As New Process()
Dim installStartInfo As New ProcessStartInfo With {
.FileName = appPath,
.Arguments = binPath,
.Verb = "runas",
.CreateNoWindow = True,
.RedirectStandardOutput = True,
.UseShellExecute = False
}
installUtil.StartInfo = installStartInfo
installUtil.Start()
Is there a way to obtain the correct path to the correct InstallUtil.exe at runtime?
Is the path to InstallUtil.exe only ever going to be in two directories depending on if x32 or x64.
Hope someone can please advise and thanks for reading.
Benshaws.