CommandLineBuilder.AppendSwitchUnquotedIfNotNull Method

Definition

Appends the command line with a switch, without attempting to encapsulate the switch parameters with quotation marks.

Overloads

AppendSwitchUnquotedIfNotNull(String, ITaskItem)

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull(String, String)

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull(String, ITaskItem[], String)

Appends a command-line switch that takes a ITaskItem[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull(String, String[], String)

Appends a command-line switch that takes a string[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull(String, ITaskItem)

Source:
CommandLineBuilder.cs

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.

C#
public void AppendSwitchUnquotedIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem parameter);

Parameters

switchName
String

The switch to append to the command line, may not be null

parameter
ITaskItem

Switch parameter to append, not quoted. If null, this method has no effect.

Examples

See example in AppendSwitchUnquotedIfNotNull.

See the string overload version

Remarks

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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

AppendSwitchUnquotedIfNotNull(String, String)

Source:
CommandLineBuilder.cs

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.

C#
public void AppendSwitchUnquotedIfNotNull(string switchName, string parameter);

Parameters

switchName
String

The switch to append to the command line, may not be null

parameter
String

Switch parameter to append, not quoted. If null, this method has no effect.

Examples

AppendSwitchUnquotedIfNotNull("/source:", "File Name.cs") yields /source:File Name.cs.

AppendSwitchUnquotedIfNotNull("/source:", "File Name.cs") => "/source:File Name.cs"

Remarks

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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

AppendSwitchUnquotedIfNotNull(String, ITaskItem[], String)

Source:
CommandLineBuilder.cs

Appends a command-line switch that takes a ITaskItem[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.

C#
public void AppendSwitchUnquotedIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem[] parameters, string delimiter);

Parameters

switchName
String

The switch to append to the command line, may not be null

parameters
ITaskItem[]

Switch parameters to append, not quoted. If null, this method has no effect.

delimiter
String

Delimiter to put between individual parameters, may not be null (may be empty)

Examples

See example in AppendSwitchUnquotedIfNotNull.

See the string[] overload version

Remarks

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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

AppendSwitchUnquotedIfNotNull(String, String[], String)

Source:
CommandLineBuilder.cs

Appends a command-line switch that takes a string[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.

C#
public void AppendSwitchUnquotedIfNotNull(string switchName, string[] parameters, string delimiter);

Parameters

switchName
String

The switch to append to the command line, may not be null

parameters
String[]

Switch parameters to append, not quoted. If null, this method has no effect.

delimiter
String

Delimiter to put between individual parameters, may not be null (may be empty)

Examples

AppendSwitchUnquotedIfNotNull("/sources:", new string[] {"Alpha.cs", "Be ta.cs"}, ";") yields /sources:Alpha.cs;Be ta.cs.

AppendSwitchUnquotedIfNotNull("/sources:", new string[] {"Alpha.cs", "Be ta.cs"}, ";") => "/sources:Alpha.cs;Be ta.cs"

Remarks

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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1