InstallException Constructor (String^)

 

Initializes a new instance of the InstallException class, and specifies the message to display to the user.

Namespace:   System.Configuration.Install
Assembly:  System.Configuration.Install (in System.Configuration.Install.dll)

public:
InstallException(
	String^ message
)

Parameters

message
Type: System::String^

The message to display to the user.

The following example demonstrates the InstallException constructor. It is a part of the example of the InstallException class.

In this example, Installutil.exe calls the Uninstall method. Uninstallation will only happen if a file named FileDoesNotExist.txt exists. Otherwise it raises an InstallException.

System_CAPS_noteNote

This example shows how to use one of the overloaded versions of the InstallException constructor. For other examples that might be available, see the individual overload topics.

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.
}

.NET Framework
Available since 1.1
Return to top
Show: