Sdílet prostřednictvím


TextTransformation.Warning – metoda

Vytvoří nové upozornění k ukládání informací o chybách během procesu transformace textu šablony.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.10.0 (v Microsoft.VisualStudio.TextTemplating.10.0.dll)

Syntaxe

'Deklarace
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
)

Parametry

Poznámky

Přidá k odběru upozornění Errors pro text šablony transformačního procesu. Standardně nastaví číslo chyby a číslo sloupce chyba-1 -1.

Příklady

Následující příklad kódu ukazuje volání Warning Metoda z textu šablony. Vložte tento kód do šablony libovolný textový soubor a spusťte transformace textu šablony výsledky. Upozornění se zobrazí v Seznam chyb.

<#
    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
#>

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

TextTransformation Třída

Microsoft.VisualStudio.TextTemplating – obor názvů

Errors

Další zdroje

How to: Generate Errors and Warnings from Text Templates