Condividi tramite


CommandLineBuilder.AppendFileNameIfNotNull Method (String)

Appends the command line with file name represented by the parameter, inserting quotation marks if necessary.

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 Sub AppendFileNameIfNotNull ( _
    fileName As String _
)
public void AppendFileNameIfNotNull(
    string fileName
)
public:
void AppendFileNameIfNotNull(
    String^ fileName
)
member AppendFileNameIfNotNull : 
        fileName:string -> unit
public function AppendFileNameIfNotNull(
    fileName : String
)

Parameters

  • fileName
    Type: System.String

    The file name to append. If it is nulla null reference (Nothing in Visual Basic), then this method has no effect.

Remarks

This method appends the command line with a file name, and surrounds the file name with quotation marks as necessary.

If the first character of the file name is a dash, then .\ is added to the beginning of the file name to distinguish it from a switch.

If the command line is not empty, then this method also appends the command line with a space, before the file name.

Examples

AppendFileNameIfNotNull("-StrangeFileName.cs") yields .\-StrangeFileName.cs.

.NET Framework Security

See Also

Reference

CommandLineBuilder Class

AppendFileNameIfNotNull Overload

Microsoft.Build.Utilities Namespace