サービス名を引数リストに渡しますが、インストーラーのコンテキストを見るとそこにはありません:
args = new[] { Assembly.GetExecutingAssembly().Location, "/ServiceName=WinService1" };
ManagedInstallerClass.InstallHelper(args);
キーと値のペアがインストーラーのコンテキストに渡されないのはなぜですか?
public override void Install(IDictionary stateSaver)
{
foreach (var param in Context.Parameters)
{
// ServiceName is not available in the Parameters collection
}
}