/// <summary> /// Lance l'installation du service. /// </summary> /// <remarks><c>virtual void</c> afin de faciliter les tests unitaires.</remarks> /// <param name="serviceAssembly">Assembly du service. Faire <c>Assembly.GetExecutingAssembly()</c> pour l'obtenir.</param> /// <param name="args">Paramètres d'installation.</param> public virtual void Install(Assembly serviceAssembly, InstallArgs args) { using (var installer = new ServiceInstallerComponent(serviceAssembly, args)) using (var ti = new TransactedInstaller()) { ti.Installers.Add(installer); ti.Context = new InstallContext(logFilePath: null, commandLine: new string[] { "/assemblypath=" + installer.ServiceAssemblyPath }); ti.Install(new Hashtable()); } }
/// <summary> /// Constructeur pour une Installation. /// </summary> /// <param name="serviceAssembly">Assembly du service à installer. Faire <c>Assembly.GetExecutingAssembly()</c>.</param> /// <param name="args">Paramètres de l'installation.</param> /// <exception cref="ArgumentNullException"><paramref name="serviceAssembly"/> est nul.</exception> /// <exception cref="ArgumentNullException"><paramref name="args"/> est nul.</exception> public ServiceInstallerComponent(Assembly serviceAssembly, InstallArgs args) : this(serviceAssembly) { this.Args = args ?? throw new ArgumentNullException(nameof(args)); }