Installer.Install(IDictionary) Installer.Install(IDictionary) Installer.Install(IDictionary) Installer.Install(IDictionary) Method

Definição

Quando substituído em uma classe derivada, executa a instalação.When overridden in a derived class, performs the installation.

public:
 virtual void Install(System::Collections::IDictionary ^ stateSaver);
public virtual void Install (System.Collections.IDictionary stateSaver);
abstract member Install : System.Collections.IDictionary -> unit
override this.Install : System.Collections.IDictionary -> unit
Public Overridable Sub Install (stateSaver As IDictionary)

Parâmetros

stateSaver
IDictionary IDictionary IDictionary IDictionary

Um IDictionary usado para salvar as informações necessárias para realizar uma confirmação, reversão ou operação de desinstalação.An IDictionary used to save information needed to perform a commit, rollback, or uninstall operation.

Exceções

O parâmetro stateSaver é null.The stateSaver parameter is null.

Ocorreu uma exceção no manipulador de evento BeforeInstall de um dos instaladores na coleção.An exception occurred in the BeforeInstall event handler of one of the installers in the collection.

- ou --or- Ocorreu uma exceção no manipulador de evento AfterInstall de um dos instaladores na coleção.An exception occurred in the AfterInstall event handler of one of the installers in the collection.

Exemplos

O exemplo a seguir demonstra Install o método Installer da classe.The following example demonstrates the Install method of the Installer class. Uma classe é derivada da Installer classe base e o Install método é substituído.A class is derived from the Installer base class and the Install method is overridden.

   // Override the 'Install' method of the Installer class.
public:
   virtual void Install( IDictionary^ mySavedState ) override
   {
      Installer::Install( mySavedState );
      // Code maybe written for installation of an application.
      Console::WriteLine( "The Install method of 'MyInstallerSample' has been called" );
   }
// Override the 'Install' method of the Installer class.
public override void Install( IDictionary mySavedState )
{
   base.Install( mySavedState );
   // Code maybe written for installation of an application.
   Console.WriteLine( "The Install method of 'MyInstallerSample' has been called" );
}
' Override the 'Install' method of the Installer class.
Public Overrides Sub Install(mySavedState As IDictionary)
   MyBase.Install(mySavedState)
   ' Code maybe written for installation of an application.
   Console.WriteLine("The Install method of 'MyInstallerSample' has been called")
End Sub 'Install

Notas aos Herdeiros

-Se você substituir o Install(IDictionary) método em uma classe derivada, certifique-se de chamar primeiro o método Install(IDictionary) da classe base em seu método derivado.- If you override the Install(IDictionary) method in a derived class, be sure to call the base class's Install(IDictionary) method first in your derived method. O Install(IDictionary) método chama o Install(IDictionary) método de Installers cada instalador contido na propriedade dessa instância.The Install(IDictionary) method calls the Install(IDictionary) method of each installer contained in the Installers property of this instance. Depois que os instaladores contidos forem executados, esse método IDictionary atualizará o objeto ( stateSaver especificado por meio do parâmetro) para refletir o status da instalação.After the contained installers run, this method updates the IDictionary object (specified through the stateSaver parameter) to reflect the status of the installation. O IDictionary deve estar vazio quando passado para o Install(IDictionary) método.The IDictionary should be empty when passed to the Install(IDictionary) method. Se todos Install(IDictionary) os métodos forem bem-sucedidos, Commit(IDictionary) o método será chamado.If all the Install(IDictionary) methods succeed, the Commit(IDictionary) method is called. Caso contrário, Rollback(IDictionary) o método será chamado.Otherwise, the Rollback(IDictionary) method is called.

-Se você precisar adicionar instâncias do instalador à Installers coleção Install(IDictionary) no método, certifique-se de executar as mesmas adições Uninstall(IDictionary) à coleção no método.- If you need to add installer instances to the Installers collection in the Install(IDictionary) method, be sure to perform the same additions to the collection in the Uninstall(IDictionary) method. No entanto, você pode evitar manter a coleção em ambos os métodos se adicionar instâncias do Installers instalador à coleção no construtor de classe do instalador personalizado.However, you can avoid maintaining the collection in both methods if you add installer instances to the Installers collection in the class constructor for your custom installer.

Aplica-se a

Veja também