TaskLoggingHelper::ExtractMessageCode Method (String^, String^)

 

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

MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Namespace:   Microsoft.Build.Utilities
Assembly:  Microsoft.Build.Utilities.Core (in Microsoft.Build.Utilities.Core.dll)

public:
String^ ExtractMessageCode(
	String^ message,
	[OutAttribute] String^% messageWithoutCodePrefix
)

Parameters

message
Type: System::String^

The full message to parse that includes code prefix.

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

Exception Condition
ArgumentNullException

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.

Return to top
Show: