Skip to content

Commit 0ed07aa

Browse files
committed
Instalutil logs moved
1 parent 8482525 commit 0ed07aa

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tulpep.NetworkAutoSwitch.Service/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ static int Main(string[] args)
2323
switch (string.Concat(args))
2424
{
2525
case "--install":
26-
26+
string currentPath = Assembly.GetExecutingAssembly().Location;
2727
string pathOfService = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "NetworkAutoSwitch.exe");
28+
string logFile = Path.Combine(Path.GetDirectoryName(currentPath), "NetworkAutoSwitch.InstallLog");
2829
Logging.WriteMessage("Copying file to " + pathOfService);
29-
File.Copy(Assembly.GetExecutingAssembly().Location, pathOfService, true);
30-
ManagedInstallerClass.InstallHelper(new string[] { pathOfService });
30+
File.Copy(currentPath, pathOfService, true);
31+
ManagedInstallerClass.InstallHelper(new string[] { "/LogFile=" + logFile, "/LogToConsole=true", pathOfService });
3132
Logging.WriteMessage("Service Installed");
3233
const string serviceName = "NetworkAutoSwitch";
3334
int timeout = 5000;
@@ -36,7 +37,7 @@ static int Main(string[] args)
3637
StartService(serviceName, timeout);
3738
return 0;
3839
case "--uninstall":
39-
ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetExecutingAssembly().Location });
40+
ManagedInstallerClass.InstallHelper(new string[] { "/uninstall", "/LogToConsole=true", Assembly.GetExecutingAssembly().Location });
4041
Logging.WriteMessage("Service Uninstalled");
4142
return 0;
4243
default:

0 commit comments

Comments
 (0)