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)

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.

Return to top