Prompt Class

MSBuild

Displays a message on the console and waits for user input.


Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class Prompt
    Inherits Task
C#
public class Prompt : Task
C++
ref class Prompt : Task
J#
public class Prompt extends Task
JScript
public class Prompt extends Task

Example

Pause the build if the interactive property is set:

 Copy Code
            <!-- Pause when invoked with the interactive property: msbuild myproject.proj /property:interactive=true -->
            
            <Prompt Text="You can now attach the debugger to the msbuild.exe process..." Condition="'$(Interactive)' == 'True'" />
            
Obtain user input during the build: (Note: in most cases, it is recommended that users instead provide custom values to your build through the /property argument of msbuild.exe)
 Copy Code
            <Prompt Text="Tell me your name:" Condition="'$(Interactive)' == 'True'" >
              <Output TaskParameter="UserInput" PropertyName="PersonName" />
            </Prompt>
            <Message Text="Hello $(PersonName)" />
            

Remarks

It is important to note that the message is not written to the MSBuild logger, it is always written to the console, no matter which logger is configured.

This task requires user input from the console. Do not use this task for projects that will be executed unattended. It is recommended that you always add a Condtion so that this task is only enabled when a custom property is set through the command line. This will ensure that the other users do not attempt to execute the task in unattended mode.

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      MSBuild.Community.Tasks.Prompt

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.