InstallContext.LogMessage(String) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
メッセージをコンソールとインストール ログ ファイルに書き込みます。
public:
void LogMessage(System::String ^ message);
public void LogMessage (string message);
member this.LogMessage : string -> unit
Public Sub LogMessage (message As String)
パラメーター
- message
- String
書き込むメッセージ。
例
この例は、クラスのクラスの概要の例の InstallContext 抜粋です。
パラメーターが IsParameterTrue 設定されているかどうかを調べるには、 メソッドを LogtoConsole
使用します。 の場合 yes
は、 メソッドを LogMessage 使用して、インストール ログ ファイルとコンソールにステータス メッセージを書き込みます。
// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) )
{
// Display the message to the console and add it to the logfile.
myInstallContext->LogMessage( "The 'Install' method has been called" );
}
// Check whether the "LogtoConsole" parameter has been set.
if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true )
{
// Display the message to the console and add it to the logfile.
myInstallContext.LogMessage( "The 'Install' method has been called" );
}
' Check wether the "LogtoConsole" parameter has been set.
If myInstallContext.IsParameterTrue("LogtoConsole") = True Then
' Display the message to the console and add it to the logfile.
myInstallContext.LogMessage("The 'Install' method has been called")
End If
注釈
インストーラーはこのメソッドを呼び出して、進行状況やその他の状態情報をログ ファイルに書き込むことができます。 コマンド ライン パラメーターでユーザー インターフェイスを表示するように指定されている場合、インストーラーでは、 メソッドの呼び出しに加えて、メッセージ ボックスを表示するか、クエリを実行する LogMessage 必要があります。 InstallUtil.exe を使用してインストールを実行し、コマンド ラインで "/LogToConsole= true" を指定しない限り、ログ ファイルに書き込まれたテキストはユーザーに表示されません。
適用対象
こちらもご覧ください
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示