Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Creates a new warning 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 Warning ( _
    message As String _
)
public void Warning(
    string message
)
public:
void Warning(
    String^ message
)
member Warning : 
        message:string -> unit
public function Warning(
    message : String
)
Parameters
- message 
 Type: System.String- A message that describes the warning. 
Remarks
Adds the warning 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 Warning method from a text template. Paste this code into any text template file and run the text template transformation to see the results. The warning will appear in the Error List.
<#
    string lastName = "short";
    if(lastName.Length < 6)
    {
        //raise a warning, this will appear in the error list
        Warning("I have a really short name.");
    }
#> 
<#
    Dim lastName as string = "short"
    If lastName.Length < 6 Then
        'raise a warning, this will appear in the error list
        Me.Warning("I have a really short 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