InstallException Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la classe InstallException.
Surcharges
| Nom | Description |
|---|---|
| InstallException() |
Initialise une nouvelle instance de la classe InstallException. |
| InstallException(String) |
Initialise une nouvelle instance de la InstallException classe et spécifie le message à afficher à l’utilisateur. |
| InstallException(SerializationInfo, StreamingContext) |
Initialise une nouvelle instance de la classe InstallException avec des données sérialisées. |
| InstallException(String, Exception) |
Initialise une nouvelle instance de la InstallException classe et spécifie le message à afficher à l’utilisateur, ainsi qu’une référence à l’exception interne qui est la cause de cette exception. |
InstallException()
Initialise une nouvelle instance de la classe InstallException.
public:
InstallException();
public InstallException();
Public Sub New ()
Exemples
L’exemple suivant illustre le InstallException constructeur. Il fait partie de l’exemple de la InstallException classe.
Dans cet exemple, Installutil.exe appelle la Commit méthode. Le code dans Commit les présumes qu’un fichier nommé FileDoesNotExist.txt existe avant que l’installation de l’assembly puisse être validée. Si le fichier FileDoesNotExist.txt n’existe pas, Commit déclenche un InstallException.
Note
Cet exemple montre comment utiliser l’une des versions surchargées du InstallException constructeur. Pour obtenir d’autres exemples qui peuvent être disponibles, consultez les rubriques sur les surcharges individuelles.
virtual void Commit( IDictionary^ savedState ) override
{
Installer::Commit( savedState );
Console::WriteLine( "Commit ..." );
// Throw an error if a particular file doesn't exist.
if ( !File::Exists( "FileDoesNotExist.txt" ) )
throw gcnew InstallException;
// Perform the final installation if the file exists.
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
Console.WriteLine("Commit ...");
// Throw an error if a particular file doesn't exist.
if(!File.Exists("FileDoesNotExist.txt"))
throw new InstallException();
// Perform the final installation if the file exists.
}
Public Overrides Sub Commit(savedState As IDictionary)
MyBase.Commit(savedState)
Console.WriteLine("Commit ...")
' Throw an error if a particular file doesn't exist.
If Not File.Exists("FileDoesNotExist.txt") Then
Throw New InstallException()
End If
' Perform the final installation if the file exists.
End Sub
S’applique à
InstallException(String)
Initialise une nouvelle instance de la InstallException classe et spécifie le message à afficher à l’utilisateur.
public:
InstallException(System::String ^ message);
public InstallException(string message);
new System.Configuration.Install.InstallException : string -> System.Configuration.Install.InstallException
Public Sub New (message As String)
Paramètres
- message
- String
Message à afficher à l’utilisateur.
Exemples
L’exemple suivant illustre le InstallException constructeur. Il fait partie de l’exemple de la InstallException classe.
Dans cet exemple, Installutil.exe appelle la Uninstall méthode. La désinstallation se produit uniquement si un fichier nommé FileDoesNotExist.txt existe. Sinon, elle déclenche un InstallException.
Note
Cet exemple montre comment utiliser l’une des versions surchargées du InstallException constructeur. Pour obtenir d’autres exemples qui peuvent être disponibles, consultez les rubriques sur les surcharges individuelles.
virtual void Uninstall( IDictionary^ savedState ) override
{
Installer::Uninstall( savedState );
Console::WriteLine( "UnInstall ..." );
// Throw an error if a particular file doesn't exist.
if ( !File::Exists( "FileDoesNotExist.txt" ) )
throw gcnew InstallException( "The file 'FileDoesNotExist' does not exist" );
// Perform the uninstall activites if the file exists.
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
Console.WriteLine("UnInstall ...");
// Throw an error if a particular file doesn't exist.
if(!File.Exists("FileDoesNotExist.txt"))
throw new InstallException("The file 'FileDoesNotExist'" +
" does not exist");
// Perform the uninstall activites if the file exists.
}
Public Overrides Sub Uninstall(savedState As IDictionary)
MyBase.Uninstall(savedState)
Console.WriteLine("UnInstall ...")
' Throw an error if a particular file doesn't exist.
If Not File.Exists("FileDoesNotExist.txt") Then
Throw New InstallException("The file 'FileDoesNotExist'" + " does not exist")
End If
' Perform the uninstall activites if the file exists.
End Sub
S’applique à
InstallException(SerializationInfo, StreamingContext)
Initialise une nouvelle instance de la classe InstallException avec des données sérialisées.
protected:
InstallException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected InstallException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Configuration.Install.InstallException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Configuration.Install.InstallException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Paramètres
- info
- SerializationInfo
SerializationInfo Qui contient les données d’objet sérialisées sur l’exception levée.
- context
- StreamingContext
Qui StreamingContext contient des informations contextuelles sur la source ou la destination.
S’applique à
InstallException(String, Exception)
Initialise une nouvelle instance de la InstallException classe et spécifie le message à afficher à l’utilisateur, ainsi qu’une référence à l’exception interne qui est la cause de cette exception.
public:
InstallException(System::String ^ message, Exception ^ innerException);
public InstallException(string message, Exception innerException);
new System.Configuration.Install.InstallException : string * Exception -> System.Configuration.Install.InstallException
Public Sub New (message As String, innerException As Exception)
Paramètres
- message
- String
Message à afficher à l’utilisateur.
- innerException
- Exception
Exception qui est la cause de l’exception actuelle. Si le innerException paramètre n’est pas null, l’exception actuelle est levée dans un catch bloc qui gère l’exception interne.