Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Creates a new error to store information about errors that occur during the text template transformation process.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.0.dll)
Syntax
'Declaration
Public Sub Error ( _
message As String _
)
public void Error(
string message
)
public:
void Error(
String^ message
)
member Error :
message:string -> unit
public function Error(
message : String
)
Parameters
message
Type: System.StringA message that describes the error.
Remarks
Adds the error to the collection of Errors for the text template transformation process. Sets the line number of the error to -1, and the column number of the error to -1 by default.
Examples
The following code example demonstrates calling the Error method from a text template. Paste this code into any text template file and run the text template transformation to see the results. The error will appear in the Error List.
<#
string firstName = null;
if(string.IsNullOrEmpty(firstName))
{
//raise an error, this will appear in the error list
Error("I have no name.");
}
#>
<#
Dim firstName as string = ""
If string.IsNullOrEmpty(firstName) Then
'raise an error, this will appear in the error list
Me.Error("I have no name.")
End If
#>
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.TextTemplating Namespace