Mic*_*ndl 3 c# installer service-installer
这是否有区别(嵌套安装程序)
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "MyService";
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
spi.Installers.Add(si);
this.Installers.Add(spi);
Run Code Online (Sandbox Code Playgroud)
还有这个?(TransactedInstaller)
TransactedInstaller ti = new TransactedInstaller();
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "MyService";
ti.Installers.Add(si);
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ti.Installers.Add(spi);
this.Installers.Add(ti);
Run Code Online (Sandbox Code Playgroud)
嵌套安装程序是否默认处理?应该选择哪种款式?
如果自定义操作成功/失败, TransactedInstaller将自动调用Commit/Rollback.
使用嵌套安装程序,您将需要在发生错误的情况下对回滚/提交您自己进行排序,如果您没有明确告诉它们运行,则不会调用它们.