アプリケーションのインストール時に実行される System.Configuration.Install.Installer を拡張する があります。MSI ファイルに設定されているいくつかのプロパティにアクセスする必要があります (たとえば、INSTALLDIR、および取得する必要があるその他のパス)。ヘルパー アセンブリ内から MSI プロパティにアクセスする方法はありますか?
インストーラーは WiX 3.5 を使用して構築されていることに注意してください。
これについてご支援いただきありがとうございます。
編集これがクラスの現在のコードです。
[RunInstaller(true)]
public class MxServeInstaller : Installer
{
private ServiceInstaller myServiceInstaller;
private ServiceProcessInstaller myServiceProcessInstaller;
public MyProductInstaller()
{
this.myServiceInstaller = new ServiceInstaller();
this.myServiceInstaller.StartType = ServiceStartMode.Automatic;
this.myServiceInstaller.ServiceName = MyProduct.SERVICE_NAME;
this.myServiceInstaller.Description = "Provides software copy protection and token pool management services for the Mx-Suite from Company";
this.myServiceInstaller.ServicesDependedOn = new string[] { "Crypkey License" };
Installers.Add(this.myServiceInstaller);
this.myServiceProcessInstaller = new ServiceProcessInstaller();
this.myServiceProcessInstaller.Account = ServiceAccount.LocalSystem;
Installers.Add(this.myServiceProcessInstaller);
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
ServiceController controller = new ServiceController(MyProduct.SERVICE_NAME);
try
{
controller.Start();
}
catch( Exception ex )
{
string source = "My-Product Installer";
string log = "Application";
if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, log);
EventLog eventLog = new EventLog();
eventLog.Source = source;
eventLog.WriteEntry(string.Format("Failed to start My-Product!{1}", ex.Message), EventLogEntryType.Error);
}
}
}
私が追加しようとしているのは、少なくともインストーラーで設定された INSTALLDIR プロパティを知る必要がある AfterInstall のフェーズです。