如何从服务安装程序写入InstallLog?
我已经覆盖了我的类的OnBeforeInstall
方法(它派生自System.Configuration.Install.Installer
),现在我想写入安装程序日志。但我找不到任何可以让我这样做的东西。
Console.WriteLine
会将内容写入控制台,但不会写入日志。
如何从服务安装程序写入InstallLog?
我已经覆盖了我的类的OnBeforeInstall
方法(它派生自System.Configuration.Install.Installer
),现在我想写入安装程序日志。但我找不到任何可以让我这样做的东西。
Console.WriteLine
会将内容写入控制台,但不会写入日志。
public void SetupLog(string sLine) {
using(StreamWriter w = File.AppendText("c:\\mysetup.log"))
w.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss} {sLine}");
}