Export (0) Print
Expand All

TaskLoggingHelper.ExtractMessageCode Method

Extracts the message code prefix from the given full message string.

Namespace:  Microsoft.Build.Utilities
Assembly:  Microsoft.Build.Utilities.v4.0 (in Microsoft.Build.Utilities.v4.0.dll)

public string ExtractMessageCode(
	string message,
	out string messageWithoutCodePrefix


Type: System.String

The full message to parse that includes code prefix.

Type: System.String

The message with the code prefix removed.

Return Value

Type: System.String
The message code prefix that is extracted from the full message string, or null if there is no message code.


message is null.

Message code prefixes must match the following .NET regular expressions in order to be recognized: ^\s*[A-Za-z]+\d+:\s*.

If this method is given the full message string MYTASK1001: This is an error message. and it accepts This is an error message. as the value for the messageWithoutCodePrefix parameter, then it returns MYTASK1001.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft