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)
Syntax
'Declaration
Public Function ExtractMessageCode ( _
message As String, _
<OutAttribute> ByRef messageWithoutCodePrefix As String _
) As String
public string ExtractMessageCode(
string message,
out string messageWithoutCodePrefix
)
public:
String^ ExtractMessageCode(
String^ message,
[OutAttribute] String^% messageWithoutCodePrefix
)
member ExtractMessageCode :
message:string *
messageWithoutCodePrefix:string byref -> string
public function ExtractMessageCode(
message : String,
messageWithoutCodePrefix : String
) : String
Parameters
message
Type: System.StringThe 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 nulla null reference (Nothing in Visual Basic) if there is no message code.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | message is nulla null reference (Nothing in Visual Basic). |
Remarks
Message code prefixes must match the following .NET regular expressions in order to be recognized: ^\s*[A-Za-z]+\d+:\s*.
Examples
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.