本文整理汇总了C#中Microsoft.Build.Tasks.CommandLineBuilderExtension.AppendSwitchWithSplitting方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineBuilderExtension.AppendSwitchWithSplitting方法的具体用法?C# CommandLineBuilderExtension.AppendSwitchWithSplitting怎么用?C# CommandLineBuilderExtension.AppendSwitchWithSplitting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Tasks.CommandLineBuilderExtension
的用法示例。
在下文中一共展示了CommandLineBuilderExtension.AppendSwitchWithSplitting方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddResponseFileCommands
protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("/lib:", base.AdditionalLibPaths, ",");
commandLine.AppendPlusOrMinusSwitch("/unsafe", base.Bag, "AllowUnsafeBlocks");
commandLine.AppendPlusOrMinusSwitch("/checked", base.Bag, "CheckForOverflowUnderflow");
commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
commandLine.AppendWhenTrue("/fullpaths", base.Bag, "GenerateFullPaths");
commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
commandLine.AppendSwitchIfNotNull("/pdb:", this.PdbFile);
commandLine.AppendPlusOrMinusSwitch("/nostdlib", base.Bag, "NoStandardLib");
commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
commandLine.AppendSwitchWithInteger("/warn:", base.Bag, "WarningLevel");
commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
commandLine.AppendSwitchIfNotNull("/baseaddress:", this.BaseAddress);
commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(base.DefineConstants));
commandLine.AppendSwitchIfNotNull("/win32res:", base.Win32Resource);
commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
commandLine.AppendSwitchIfNotNull("/appconfig:", this.ApplicationConfiguration);
this.AddReferencesToCommandLine(commandLine);
base.AddResponseFileCommands(commandLine);
commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
if (base.ResponseFiles != null)
{
foreach (ITaskItem item in base.ResponseFiles)
{
commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
}
}
}
示例2: AddResponseFileCommands
/// <summary>
/// Looks at all the parameters that have been set, and builds up the string
/// containing all the command-line switches.
/// </summary>
/// <param name="commandLine"></param>
protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
commandLine.AppendSwitchIfNotNull("/libpath:", this.AdditionalLibPaths, ",");
commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
// Make sure this /doc+ switch comes *before* the /doc:<file> switch (which is handled in the
// ManagedCompiler.cs base class). /doc+ is really just an alias for /doc:<assemblyname>.xml,
// and the last /doc switch on the command-line wins. If the user provided a specific doc filename,
// we want that one to win.
commandLine.AppendPlusOrMinusSwitch("/doc", this.Bag, "GenerateDocumentation");
commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
commandLine.AppendPlusOrMinusSwitch("/optionexplicit", this.Bag, "OptionExplicit");
// Make sure this /optionstrict+ switch appears *before* the /optionstrict:xxxx switch below
/* In Orcas a change was made that set Option Strict-, whenever this.DisabledWarnings was
* empty. That was clearly the wrong thing to do and we found it when we had a project with all the warning configuration
* entries set to WARNING. Because this.DisabledWarnings was empty in that case we would end up sending /OptionStrict-
* effectively silencing all the warnings that had been selected.
*
* Now what we do is:
* If option strict+ is specified, that trumps everything and we just set option strict+
* Otherwise, just set option strict:custom.
* You may wonder why we don't try to set Option Strict- The reason is that Option Strict- just implies a certain
* set of warnings that should be disabled (there's ten of them today) You get the same effect by sending
* option strict:custom on along with the correct list of disabled warnings.
* Rather than make this code know the current set of disabled warnings that comprise Option strict-, we just send
* option strict:custom on with the understanding that we'll get the same behavior as option strict- since we are passing
* the /nowarn line on that contains all the warnings OptionStrict- would disable anyway. The IDE knows what they are
* and puts them in the project file so we are good. And by not making this code aware of which warnings comprise
* Option Strict-, we have one less place we have to keep up to date in terms of what comprises option strict-
*/
// Decide whether we are Option Strict+ or Option Strict:custom
object optionStrictSetting = this.Bag["OptionStrict"];
bool optionStrict = optionStrictSetting != null ? (bool)optionStrictSetting : false;
if (optionStrict)
{
commandLine.AppendSwitch("/optionstrict+");
}
else // OptionStrict+ wasn't specified so use :custom.
{
commandLine.AppendSwitch("/optionstrict:custom");
}
commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
commandLine.AppendWhenTrue("/nowarn", this.Bag, "NoWarnings");
commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", ';', ',');
commandLine.AppendPlusOrMinusSwitch("/optioninfer", this.Bag, "OptionInfer");
commandLine.AppendWhenTrue("/nostdlib", this.Bag, "NoStandardLib");
commandLine.AppendWhenTrue("/novbruntimeref", this.Bag, "NoVBRuntimeReference");
commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
commandLine.AppendSwitchIfNotNull("/platform:", this.PlatformWith32BitPreference);
commandLine.AppendPlusOrMinusSwitch("/removeintchecks", this.Bag, "RemoveIntegerChecks");
commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
commandLine.AppendWhenTrue("/netcf", this.Bag, "TargetCompactFramework");
commandLine.AppendSwitchIfNotNull("/preferreduilang:", this.PreferredUILang);
commandLine.AppendPlusOrMinusSwitch("/highentropyva", this.Bag, "HighEntropyVA");
if (0 == String.Compare(this.VBRuntimePath, this.VBRuntime, StringComparison.OrdinalIgnoreCase))
{
commandLine.AppendSwitchIfNotNull("/vbruntime:", this.VBRuntimePath);
}
else if (this.VBRuntime != null)
{
string vbRuntimeSwitch = this.VBRuntime;
if (0 == String.Compare(vbRuntimeSwitch, "EMBED", StringComparison.OrdinalIgnoreCase))
{
commandLine.AppendSwitch("/vbruntime*");
}
else if (0 == String.Compare(vbRuntimeSwitch, "NONE", StringComparison.OrdinalIgnoreCase))
{
commandLine.AppendSwitch("/vbruntime-");
}
else if (0 == String.Compare(vbRuntimeSwitch, "DEFAULT", StringComparison.OrdinalIgnoreCase))
{
commandLine.AppendSwitch("/vbruntime+");
}
else
{
commandLine.AppendSwitchIfNotNull("/vbruntime:", vbRuntimeSwitch);
}
}
// Verbosity
if (
(this.Verbosity != null) &&
(
(0 == String.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase)) ||
(0 == String.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase))
)
//.........这里部分代码省略.........
示例3: AddResponseFileCommands
/// <summary>
/// Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
/// </summary>
override protected internal void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("/lib:", this.AdditionalLibPaths, ",");
commandLine.AppendPlusOrMinusSwitch("/unsafe", this.Bag, "AllowUnsafeBlocks");
commandLine.AppendPlusOrMinusSwitch("/checked", this.Bag, "CheckForOverflowUnderflow");
commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", ';', ',');
commandLine.AppendWhenTrue("/fullpaths", this.Bag, "GenerateFullPaths");
commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
commandLine.AppendSwitchIfNotNull("/pdb:", this.PdbFile);
commandLine.AppendPlusOrMinusSwitch("/nostdlib", this.Bag, "NoStandardLib");
commandLine.AppendSwitchIfNotNull("/platform:", this.PlatformWith32BitPreference);
commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
commandLine.AppendSwitchWithInteger("/warn:", this.Bag, "WarningLevel");
commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
commandLine.AppendSwitchIfNotNull("/baseaddress:", this.BaseAddress);
commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(this.DefineConstants));
commandLine.AppendSwitchIfNotNull("/win32res:", this.Win32Resource);
commandLine.AppendSwitchIfNotNull("/main:", this.MainEntryPoint);
commandLine.AppendSwitchIfNotNull("/appconfig:", this.ApplicationConfiguration);
commandLine.AppendWhenTrue("/errorendlocation", this.Bag, "ErrorEndLocation");
commandLine.AppendSwitchIfNotNull("/preferreduilang:", this.PreferredUILang);
commandLine.AppendPlusOrMinusSwitch("/highentropyva", this.Bag, "HighEntropyVA");
// If not design time build and the globalSessionGuid property was set then add a -globalsessionguid:<guid>
bool designTime = false;
if (this.HostObject != null)
{
var csHost = this.HostObject as ICscHostObject;
designTime = csHost.IsDesignTime();
}
if (!designTime)
{
if (!string.IsNullOrWhiteSpace(this.VsSessionGuid))
{
commandLine.AppendSwitchIfNotNull("/sqmsessionguid:", this.VsSessionGuid);
}
}
this.AddReferencesToCommandLine(commandLine);
base.AddResponseFileCommands(commandLine);
// This should come after the "TreatWarningsAsErrors" flag is processed (in managedcompiler.cs).
// Because if TreatWarningsAsErrors=false, then we'll have a /warnaserror- on the command-line,
// and then any specific warnings that should be treated as errors should be specified with
// /warnaserror+:<list> after the /warnaserror- switch. The order of the switches on the command-line
// does matter.
//
// Note that
// /warnaserror+
// is just shorthand for:
// /warnaserror+:<all possible warnings>
//
// Similarly,
// /warnaserror-
// is just shorthand for:
// /warnaserror-:<all possible warnings>
commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", ';', ',');
commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", ';', ',');
// It's a good idea for the response file to be the very last switch passed, just
// from a predictability perspective.
if (this.ResponseFiles != null)
{
foreach (ITaskItem response in this.ResponseFiles)
{
commandLine.AppendSwitchIfNotNull("@", response.ItemSpec);
}
}
}
示例4: AddResponseFileCommands
protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
commandLine.AppendSwitchIfNotNull("/libpath:", base.AdditionalLibPaths, ",");
commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
commandLine.AppendPlusOrMinusSwitch("/doc", base.Bag, "GenerateDocumentation");
commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
commandLine.AppendPlusOrMinusSwitch("/optionexplicit", base.Bag, "OptionExplicit");
object obj2 = base.Bag["OptionStrict"];
if ((obj2 != null) ? ((bool) obj2) : false)
{
commandLine.AppendSwitch("/optionstrict+");
}
else
{
commandLine.AppendSwitch("/optionstrict:custom");
}
commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
commandLine.AppendWhenTrue("/nowarn", base.Bag, "NoWarnings");
commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
commandLine.AppendPlusOrMinusSwitch("/optioninfer", base.Bag, "OptionInfer");
commandLine.AppendWhenTrue("/nostdlib", base.Bag, "NoStandardLib");
commandLine.AppendWhenTrue("/novbruntimeref", base.Bag, "NoVBRuntimeReference");
commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
commandLine.AppendPlusOrMinusSwitch("/removeintchecks", base.Bag, "RemoveIntegerChecks");
commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
commandLine.AppendWhenTrue("/netcf", base.Bag, "TargetCompactFramework");
if (this.VBRuntime != null)
{
string vBRuntime = this.VBRuntime;
if (string.Compare(vBRuntime, "EMBED", StringComparison.OrdinalIgnoreCase) == 0)
{
commandLine.AppendSwitch("/vbruntime*");
}
else if (string.Compare(vBRuntime, "NONE", StringComparison.OrdinalIgnoreCase) == 0)
{
commandLine.AppendSwitch("/vbruntime-");
}
else if (string.Compare(vBRuntime, "DEFAULT", StringComparison.OrdinalIgnoreCase) == 0)
{
commandLine.AppendSwitch("/vbruntime+");
}
else
{
commandLine.AppendSwitchIfNotNull("/vbruntime:", vBRuntime);
}
}
if ((this.Verbosity != null) && ((string.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase) == 0)))
{
commandLine.AppendSwitchIfNotNull("/", this.Verbosity);
}
commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
commandLine.AppendSwitchUnquotedIfNotNull("/define:", GetDefineConstantsSwitch(base.DefineConstants));
this.AddReferencesToCommandLine(commandLine);
commandLine.AppendSwitchIfNotNull("/win32resource:", base.Win32Resource);
if (string.Compare("Sub Main", base.MainEntryPoint, StringComparison.OrdinalIgnoreCase) != 0)
{
commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
}
base.AddResponseFileCommands(commandLine);
commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
if (base.ResponseFiles != null)
{
foreach (ITaskItem item in base.ResponseFiles)
{
commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
}
}
}
示例5: AddCommandLineCommands
/// <summary>
/// Fills the provided CommandLineBuilderExtension with all the command line options used when
/// executing this tool
/// </summary>
/// <param name="commandLine">Gets filled with command line commands</param>
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("/d:", OutputDocumentationFile);
commandLine.AppendSwitchIfNotNull("/md:", InputDocumentationFile);
commandLine.AppendSwitchIfNotNull("/mp:", InputPDBFile);
commandLine.AppendSwitchIfNotNull("/pdb:", OutputPDBFile);
commandLine.AppendSwitchIfNotNull("/assemblyunificationpolicy:", AssemblyUnificationPolicy);
if (String.IsNullOrEmpty(OutputWindowsMetadataFile))
{
OutputWindowsMetadataFile = Path.ChangeExtension(WinMDModule, ".winmd");
}
commandLine.AppendSwitchIfNotNull("/out:", OutputWindowsMetadataFile);
commandLine.AppendSwitchWithSplitting("/nowarn:", DisabledWarnings, ",", ';', ',');
commandLine.AppendWhenTrue("/warnaserror+", this.Bag, "TreatWarningsAsErrors");
commandLine.AppendWhenTrue("/utf8output", this.Bag, "UTF8Output");
if (References != null)
{
// Loop through all the references passed in. We'll be adding separate
foreach (ITaskItem reference in this.References)
{
commandLine.AppendSwitchIfNotNull("/reference:", reference.ItemSpec);
}
}
commandLine.AppendFileNameIfNotNull(WinMDModule);
base.AddCommandLineCommands(commandLine);
}