CommandLineBuilder.AppendFileNameIfNotNull Method (String)


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

Namespace:   Microsoft.Build.Utilities
Assembly:  Microsoft.Build.Utilities.v4.0 (in Microsoft.Build.Utilities.v4.0.dll)

public void AppendFileNameIfNotNull(
	string fileName


Type: System.String

The file name to append. If it is null, then this method has no effect.

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.

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

.NET Framework
Available since 2.0
Return to top