本文整理汇总了C#中Microsoft.Build.Tasks.CommandLineBuilderExtension.AppendSwitch方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineBuilderExtension.AppendSwitch方法的具体用法?C# CommandLineBuilderExtension.AppendSwitch怎么用?C# CommandLineBuilderExtension.AppendSwitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Tasks.CommandLineBuilderExtension
的用法示例。
在下文中一共展示了CommandLineBuilderExtension.AppendSwitch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddResponseFileCommands
protected internal override void AddResponseFileCommands (
CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull ("/algid:", AlgorithmId);
commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
commandLine.AppendSwitchIfNotNull ("/company:", CompanyName);
commandLine.AppendSwitchIfNotNull ("/configuration:", Configuration);
commandLine.AppendSwitchIfNotNull ("/culture:", Culture);
commandLine.AppendSwitchIfNotNull ("/copyright:", Copyright);
if (Bag ["DelaySign"] != null)
if (DelaySign)
commandLine.AppendSwitch ("/delaysign+");
else
commandLine.AppendSwitch ("/delaysign-");
commandLine.AppendSwitchIfNotNull ("/description:", Description);
if (EmbedResources != null) {
foreach (ITaskItem item in EmbedResources) {
string logical_name = item.GetMetadata ("LogicalName");
if (!string.IsNullOrEmpty (logical_name))
commandLine.AppendSwitchIfNotNull ("/embed:", string.Format ("{0},{1}", item.ItemSpec, logical_name));
else
commandLine.AppendSwitchIfNotNull ("/embed:", item.ItemSpec);
}
}
commandLine.AppendSwitchIfNotNull ("/evidence:", EvidenceFile);
commandLine.AppendSwitchIfNotNull ("/fileversion:", FileVersion);
commandLine.AppendSwitchIfNotNull ("/flags:", Flags);
if (GenerateFullPaths)
commandLine.AppendSwitch ("/fullpaths");
commandLine.AppendSwitchIfNotNull ("/keyname:", KeyContainer);
commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
if (LinkResources != null)
foreach (ITaskItem item in LinkResources)
commandLine.AppendSwitchIfNotNull ("/link:", item.ItemSpec);
commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
if (OutputAssembly != null)
commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
//platform
commandLine.AppendSwitchIfNotNull ("/product:", ProductName);
commandLine.AppendSwitchIfNotNull ("/productversion:", ProductVersion);
if (ResponseFiles != null)
foreach (string s in ResponseFiles)
commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", s));
if (SourceModules != null)
foreach (ITaskItem item in SourceModules)
commandLine.AppendFileNameIfNotNull (item.ItemSpec);
commandLine.AppendSwitchIfNotNull ("/target:", TargetType);
commandLine.AppendSwitchIfNotNull ("/template:", TemplateFile);
commandLine.AppendSwitchIfNotNull ("/title:", Title);
commandLine.AppendSwitchIfNotNull ("/trademark:", Trademark);
commandLine.AppendSwitchIfNotNull ("/version:", Version);
commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon);
commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
}
示例2: AddCommandLineCommands
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
{
this.CreateTemporaryBatchFile();
string batchFile = this.batchFile;
commandLine.AppendSwitch("/Q");
commandLine.AppendSwitch("/C");
if (batchFile.Contains("&") && !batchFile.Contains("^&"))
{
batchFile = Microsoft.Build.Shared.NativeMethodsShared.GetShortFilePath(batchFile).Replace("&", "^&");
}
commandLine.AppendFileNameIfNotNull(batchFile);
}
示例3: AddCommandLineCommands
protected internal override void AddCommandLineCommands (
CommandLineBuilderExtension commandLine)
{
if (Sources.Length == 0)
return;
foreach (ITaskItem item in Sources)
commandLine.AppendSwitchIfNotNull ("--complist=", item.ItemSpec);
commandLine.AppendSwitchIfNotNull ("--target=", LicenseTarget);
if (ReferencedAssemblies != null)
foreach (ITaskItem reference in ReferencedAssemblies)
commandLine.AppendSwitchIfNotNull ("--load=", reference.ItemSpec);
string outdir;
if (Bag ["OutputDirectory"] != null)
outdir = OutputDirectory;
else
outdir = ".";
commandLine.AppendSwitchIfNotNull ("--outdir=", outdir);
if (Bag ["NoLogo"] != null && NoLogo)
commandLine.AppendSwitch ("--nologo");
OutputLicense = new TaskItem (Path.Combine (OutputDirectory, LicenseTarget.ItemSpec + ".licenses"));
}
示例4: AddCommandLineCommands
protected internal override void AddCommandLineCommands (CommandLineBuilderExtension commandLine)
{
if (IsRunningOnWindows)
commandLine.AppendSwitch ("/q /c");
if (!String.IsNullOrEmpty (command)) {
scriptFile = Path.GetTempFileName ();
if (IsRunningOnWindows)
scriptFile = scriptFile + ".bat";
using (StreamWriter sw = new StreamWriter (scriptFile)) {
sw.Write (command);
}
commandLine.AppendFileNameIfNotNull (scriptFile);
}
base.AddCommandLineCommands (commandLine);
}
示例5: AddCommandLineCommands
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
{
commandLine.AppendSwitchIfNotNull("-m ", this.MetabasePath);
commandLine.AppendSwitchIfNotNull("-v ", this.VirtualPath);
commandLine.AppendSwitchIfNotNull("-p ", this.PhysicalPath);
if (this.Updateable)
{
commandLine.AppendSwitch("-u");
}
if (this.Force)
{
commandLine.AppendSwitch("-f");
}
if (this.Clean)
{
commandLine.AppendSwitch("-c");
}
if (this.Debug)
{
commandLine.AppendSwitch("-d");
}
if (this.FixedNames)
{
commandLine.AppendSwitch("-fixednames");
}
commandLine.AppendSwitchIfNotNull("", this.TargetPath);
if (this.AllowPartiallyTrustedCallers)
{
commandLine.AppendSwitch("-aptca");
}
if (this.DelaySign)
{
commandLine.AppendSwitch("-delaysign");
}
commandLine.AppendSwitchIfNotNull("-keyfile ", this.KeyFile);
commandLine.AppendSwitchIfNotNull("-keycontainer ", this.KeyContainer);
}
示例6: 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))
)
//.........这里部分代码省略.........
示例7: AddResponseFileCommands
protected internal override void AddResponseFileCommands (CommandLineBuilderExtension commandLine)
{
base.AddResponseFileCommands (commandLine);
if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
if (Bag ["AllowUnsafeBlocks"] != null)
if (AllowUnsafeBlocks)
commandLine.AppendSwitch ("/unsafe+");
else
commandLine.AppendSwitch ("/unsafe-");
//baseAddress
if (Bag ["CheckForOverflowUnderflow"] != null)
if (CheckForOverflowUnderflow)
commandLine.AppendSwitch ("/checked+");
else
commandLine.AppendSwitch ("/checked-");
if (!String.IsNullOrEmpty (DefineConstants)) {
string [] defines = DefineConstants.Split (new char [] {';', ' '},
StringSplitOptions.RemoveEmptyEntries);
if (defines.Length > 0)
commandLine.AppendSwitchUnquotedIfNotNull ("/define:",
String.Join (";", defines));
}
commandLine.AppendSwitchIfNotNull ("/nowarn:", DisabledWarnings);
commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
//errorReport
if (GenerateFullPaths)
commandLine.AppendSwitch ("/fullpaths");
commandLine.AppendSwitchIfNotNull ("/langversion:", LangVersion);
commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
//moduleAssemblyName
if (NoStandardLib)
commandLine.AppendSwitch ("/nostdlib");
//platform
//
if (References != null)
foreach (ITaskItem item in References)
commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
if (ResponseFiles != null)
foreach (ITaskItem item in ResponseFiles)
commandLine.AppendSwitchIfNotNull ("@", item.ItemSpec);
if (Bag ["WarningLevel"] != null)
commandLine.AppendSwitchIfNotNull ("/warn:", WarningLevel.ToString ());
commandLine.AppendSwitchIfNotNull ("/warnaserror+:", WarningsAsErrors);
commandLine.AppendSwitchIfNotNull ("/warnaserror-:", WarningsNotAsErrors);
if (Win32Resource != null)
commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
}
示例8: AddResponseFileCommands
protected internal override void AddResponseFileCommands (CommandLineBuilderExtension commandLine)
{
#if !NET_4_0
//pre-MSBuild 2 targets don't support multi-targeting, so tell compiler to use 2.0 corlib
commandLine.AppendSwitch ("/sdk:2");
#endif
base.AddResponseFileCommands (commandLine);
if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
if (Bag ["AllowUnsafeBlocks"] != null)
if (AllowUnsafeBlocks)
commandLine.AppendSwitch ("/unsafe+");
else
commandLine.AppendSwitch ("/unsafe-");
//baseAddress
if (Bag ["CheckForOverflowUnderflow"] != null)
if (CheckForOverflowUnderflow)
commandLine.AppendSwitch ("/checked+");
else
commandLine.AppendSwitch ("/checked-");
if (!String.IsNullOrEmpty (DefineConstants)) {
string [] defines = DefineConstants.Split (new char [] {';', ' '},
StringSplitOptions.RemoveEmptyEntries);
if (defines.Length > 0)
commandLine.AppendSwitchIfNotNull ("/define:",
String.Join (";", defines));
}
if (!String.IsNullOrEmpty (DisabledWarnings)) {
string [] defines = DisabledWarnings.Split (new char [] {';', ' ', ','},
StringSplitOptions.RemoveEmptyEntries);
if (defines.Length > 0)
commandLine.AppendSwitchIfNotNull ("/nowarn:", defines, ";");
}
commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
//errorReport
if (GenerateFullPaths)
commandLine.AppendSwitch ("/fullpaths");
commandLine.AppendSwitchIfNotNull ("/langversion:", LangVersion);
commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
//moduleAssemblyName
if (NoStandardLib)
commandLine.AppendSwitch ("/nostdlib");
//platform
commandLine.AppendSwitchIfNotNull ("/platform:", Platform);
//
if (References != null)
foreach (ITaskItem item in References) {
string aliases = item.GetMetadata ("Aliases") ?? String.Empty;
aliases = aliases.Trim ();
if (aliases.Length > 0)
commandLine.AppendSwitchIfNotNull ("/reference:" + aliases + "=", item.ItemSpec);
else
commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
}
if (ResponseFiles != null)
foreach (ITaskItem item in ResponseFiles)
commandLine.AppendSwitchIfNotNull ("@", item.ItemSpec);
if (Bag ["WarningLevel"] != null)
commandLine.AppendSwitchIfNotNull ("/warn:", WarningLevel.ToString ());
commandLine.AppendSwitchIfNotNull ("/warnaserror+:", WarningsAsErrors);
commandLine.AppendSwitchIfNotNull ("/warnaserror-:", WarningsNotAsErrors);
if (Win32Resource != null)
commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
}
示例9: GenerateResGenCommandLineWithoutResources
/// <summary>
/// Generate the parts of the resgen command line that are don't involve resgen.exe itself or the
/// resources to be generated.
/// </summary>
/// <comments>
/// Expects resGenCommand to be non-null -- otherwise, it doesn't get passed back to the caller, so it's
/// useless anyway.
/// </comments>
/// <param name="resGenCommand"></param>
private void GenerateResGenCommandLineWithoutResources(CommandLineBuilderExtension resGenCommand)
{
// Throw an internal error, since this method should only ever get called by other aspects of this task, not
// anything that the user touches.
ErrorUtilities.VerifyThrowInternalNull(resGenCommand, "resGenCommand");
// append the /useSourcePath flag if requested.
if (UseSourcePath)
{
resGenCommand.AppendSwitch("/useSourcePath");
}
// append the /publicClass flag if requested
if (PublicClass)
{
resGenCommand.AppendSwitch("/publicClass");
}
// append the references, if any
if (References != null)
{
foreach (ITaskItem reference in References)
{
resGenCommand.AppendSwitchIfNotNull("/r:", reference);
}
}
// append /compile switch if not creating strongly typed class
if (String.IsNullOrEmpty(StronglyTypedLanguage))
{
resGenCommand.AppendSwitch("/compile");
}
}
示例10: GenerateResGenCommands
private void GenerateResGenCommands(CommandLineBuilderExtension resGenArguments, bool useForResponseFile)
{
resGenArguments = resGenArguments ?? new CommandLineBuilderExtension();
if (IsNullOrEmpty(this.OutputFiles))
{
this.GenerateOutputFileNames();
}
string switchName = "/useSourcePath" + (useForResponseFile ? "\n" : string.Empty);
string str2 = "/publicClass" + (useForResponseFile ? "\n" : string.Empty);
resGenArguments.AppendWhenTrue(switchName, base.Bag, "UseSourcePath");
resGenArguments.AppendWhenTrue(str2, base.Bag, "PublicClass");
if (this.References != null)
{
foreach (ITaskItem item in this.References)
{
if (useForResponseFile && (item != null))
{
resGenArguments.AppendTextUnquoted("/r:");
resGenArguments.AppendTextUnquoted(item.ItemSpec);
resGenArguments.AppendTextUnquoted("\n");
}
else
{
resGenArguments.AppendSwitchIfNotNull("/r:", item);
}
}
}
if (string.IsNullOrEmpty(this.StronglyTypedLanguage))
{
resGenArguments.AppendSwitch("/compile" + (useForResponseFile ? "\n" : string.Empty));
if ((this.InputFiles != null) && (this.InputFiles.Length > 0))
{
ITaskItem[] inputFiles = this.InputFiles;
ITaskItem[] outputFiles = this.OutputFiles;
for (int i = 0; i < inputFiles.Length; i++)
{
if (useForResponseFile)
{
if ((inputFiles[i] != null) && (outputFiles[i] != null))
{
resGenArguments.AppendTextUnquoted(inputFiles[i].ItemSpec);
resGenArguments.AppendTextUnquoted(",");
resGenArguments.AppendTextUnquoted(outputFiles[i].ItemSpec);
resGenArguments.AppendTextUnquoted("\n");
}
}
else
{
resGenArguments.AppendFileNamesIfNotNull(new ITaskItem[] { inputFiles[i], outputFiles[i] }, ",");
}
}
}
}
else
{
resGenArguments.AppendFileNamesIfNotNull(this.InputFiles, " ");
resGenArguments.AppendFileNamesIfNotNull(this.OutputFiles, " ");
resGenArguments.AppendSwitchIfNotNull("/str:", new string[] { this.StronglyTypedLanguage, this.StronglyTypedNamespace, this.StronglyTypedClassName, this.StronglyTypedFileName }, ",");
}
}
示例11: AddResponseFileCommands
protected internal override void AddResponseFileCommands (
CommandLineBuilderExtension commandLine )
{
base.AddResponseFileCommands (commandLine);
commandLine.AppendSwitchIfNotNull ("/libpath:", AdditionalLibPaths, ",");
commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
if (DefineConstants != null)
commandLine.AppendSwitchUnquotedIfNotNull ("/define:",
String.Format ("\"{0}\"", EscapeDoubleQuotes (DefineConstants)));
// DisabledWarnings
commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
// ErrorReport
// GenerateDocumentation
if (Imports != null)
foreach (ITaskItem item in Imports)
commandLine.AppendSwitchIfNotNull ("/imports:", item.ItemSpec);
commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
// NoStandardLib
if (Bag ["NoStandardLib"] != null && NoStandardLib)
commandLine.AppendSwitch ("/nostdlib");
if (NoWarnings)
commandLine.AppendSwitch ("/nowarn");
commandLine.AppendSwitchIfNotNull ("/optioncompare:", OptionCompare);
if (Bag ["OptionExplicit"] != null)
if (OptionExplicit)
commandLine.AppendSwitch ("/optionexplicit+");
else
commandLine.AppendSwitch ("/optionexplicit-");
if (Bag ["OptionStrict"] != null)
if (OptionStrict)
commandLine.AppendSwitch ("/optionstrict+");
else
commandLine.AppendSwitch ("/optionstrict-");
if (Bag ["OptionInfer"] != null)
if (OptionInfer)
commandLine.AppendSwitch ("/optioninfer+");
else
commandLine.AppendSwitch ("/optioninfer-");
// OptionStrictType
// Platform
if (References != null)
foreach (ITaskItem item in References)
commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
if (Bag ["RemoveIntegerChecks"] != null)
if (RemoveIntegerChecks)
commandLine.AppendSwitch ("/removeintchecks+");
else
commandLine.AppendSwitch ("/removeintchecks-");
if (ResponseFiles != null)
foreach (ITaskItem item in ResponseFiles)
commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", item.ItemSpec));
commandLine.AppendSwitchIfNotNull ("/rootnamespace:", RootNamespace);
commandLine.AppendSwitchIfNotNull ("/sdkpath:", SdkPath);
// TargetCompactFramework
if (String.Compare (VBRuntime, "Embed", StringComparison.OrdinalIgnoreCase) == 0)
commandLine.AppendSwitch ("/vbruntime*");
// Verbosity
// WarningsAsErrors
// WarningsNotAsErrors
}
示例12: AddResponseFileCommands
protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
{
if (OutputGeneratedFile != null && !String.IsNullOrEmpty(OutputGeneratedFile.ItemSpec))
commandLine.AppendSwitchIfNotNull("/outputgeneratedfile:", OutputGeneratedFile);
commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(base.DefineConstants));
this.AddReferencesToCommandLine(commandLine);
base.AddResponseFileCommands(commandLine);
if (ResponseFiles != null)
{
foreach (ITaskItem item in ResponseFiles)
{
commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
}
}
if (ContentFiles != null)
{
foreach (var file in ContentFiles)
{
commandLine.AppendSwitchIfNotNull("/contentfile:", file.ItemSpec);
}
}
if (NoneFiles != null)
{
foreach (var file in NoneFiles)
{
commandLine.AppendSwitchIfNotNull("/nonefile:", file.ItemSpec);
}
}
if (SkcPlugins != null)
{
foreach (var file in SkcPlugins)
{
commandLine.AppendSwitchIfNotNull("/plugin:", file.ItemSpec);
}
}
if (SkcRebuild)
commandLine.AppendSwitch("/rebuild");
if (UseBuildService)
{
Log.LogMessage("CurrentDirectory is: " + Directory.GetCurrentDirectory());
commandLine.AppendSwitchIfNotNull("/dir:", Directory.GetCurrentDirectory());
}
commandLine.AppendSwitchIfNotNull("/TargetFrameworkVersion:", TargetFrameworkVersion);
}
示例13: AddCommandLineCommands
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
{
Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(!IsNullOrEmpty(this.InputFiles), "If InputFiles is empty, the task should have returned before reaching this point");
CommandLineBuilderExtension resGenArguments = new CommandLineBuilderExtension();
this.GenerateResGenCommands(resGenArguments, false);
string str = this.GenerateResGenFullPath();
if (this.TrackFileAccess)
{
string rootFiles = FileTracker.FormatRootingMarker(this.InputFiles);
string temporaryFile = Microsoft.Build.Shared.FileUtilities.GetTemporaryFile();
string fileTrackerPath = FileTracker.GetFileTrackerPath(this.ToolType, this.TrackerFrameworkPath);
using (StreamWriter writer = new StreamWriter(temporaryFile, false, this.ResponseFileEncoding))
{
writer.Write(FileTracker.TrackerResponseFileArguments(fileTrackerPath, this.TrackerLogDirectory, rootFiles));
}
commandLine.AppendTextUnquoted(this.GetResponseFileSwitch(temporaryFile));
commandLine.AppendSwitch(FileTracker.TrackerCommandArguments(str ?? string.Empty, resGenArguments.ToString()));
}
else if (((str == null) || !str.Equals(Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("resgen.exe", TargetDotNetFrameworkVersion.Version40)), StringComparison.OrdinalIgnoreCase)) || !string.IsNullOrEmpty(this.StronglyTypedLanguage))
{
commandLine.AppendTextUnquoted(resGenArguments.ToString());
}
}
示例14: AddResponseFileCommandsImpl
protected void AddResponseFileCommandsImpl(CommandLineBuilderExtension commandLine)
{
if (OutputAssembly == null && Sources != null && Sources.Length > 0 && ResponseFiles == null)
{
try
{
OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(Sources[0].ItemSpec));
}
catch (ArgumentException exception)
{
throw new ArgumentException(exception.Message, "Sources", exception);
}
var outputAssembly = OutputAssembly;
switch (TargetType.ToLowerInvariant())
{
case "library":
outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".dll";
break;
case "module":
outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".netmodule";
break;
default:
outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".exe";
break;
}
}
// Don't call base.AddResponseFileCommands()!
//base.AddResponseFileCommands(commandLine);
//System.Diagnostics.Debug.Assert(false);
if (RunDebugger)
commandLine.AppendSwitch("\n/debugger");
if (Optimize)
commandLine.AppendSwitch("\n/optimize");
commandLine.AppendPlusOrMinusSwitch("\n/checked", base.Bag, "CheckIntegerOverflow");
commandLine.AppendSwitch("\n/no-color");
commandLine.AppendSwitchIfNotNull("\n/lib:", base.AdditionalLibPaths, ",");
commandLine.AppendSwitchIfNotNull("\n/nowarn:", this.DisabledWarnings, ",");
commandLine.AppendSwitchIfNotNull("\n/dowarn:", this.EnabledWarnings, ",");
if (NoStdLib)
commandLine.AppendSwitch("\n/no-stdlib");
if (NoStdMacros)
commandLine.AppendSwitch("\n/no-stdmacros");
if (!GreedyReferences)
commandLine.AppendSwitch("\n/greedy-references:-");
if (WarningLevel != 4)
commandLine.AppendSwitchIfNotNull("\n/warn:", this.WarningLevel.ToString());
if (IndentationSyntax)
commandLine.AppendSwitch("\n/indentation-syntax");
commandLine.AppendSwitchIfNotNull("\n/doc:", this.DocumentationFile);
if (!string.IsNullOrEmpty(base.DefineConstants))
{
var defines = base.DefineConstants
.Split(new char[] { ';', ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
commandLine.AppendSwitchUnquotedIfNotNull("\n/define:", String.Join(";", defines));
}
commandLine.AppendSwitchIfNotNull("\n/win32res:", base.Win32Resource);
commandLine.AppendSwitchIfNotNull("\n/platform:", this.Platform);
// Switchs from base.AddResponseFileCommands()
commandLine.AppendSwitchIfNotNull("\n/addmodule:", this.AddModules, ",");
commandLine.AppendPlusOrMinusSwitch("\n/delaysign", base.Bag, "DelaySign");
commandLine.AppendSwitchIfNotNull("\n/keycontainer:", this.KeyContainer);
commandLine.AppendSwitchIfNotNull("\n/keyfile:", this.KeyFile);
commandLine.AppendSwitchIfNotNull("\n/linkresource:", this.LinkResources, new[] { "LogicalName", "Access" });
if (NoLogo)
commandLine.AppendSwitch("\n/nologo");
commandLine.AppendSwitchIfNotNull("\n/resource:", this.Resources, new[] { "LogicalName", "Access" });
commandLine.AppendSwitchIfNotNull("\n/target:", this.TargetType);
commandLine.AppendPlusOrMinusSwitch("\n/warnaserror", base.Bag, "TreatWarningsAsErrors");
commandLine.AppendSwitchIfNotNull("\n/win32icon:", this.Win32Icon);
commandLine.AppendPlusOrMinusSwitch("\n/debug", base.Bag, "EmitDebugInformation");
commandLine.AppendSwitchIfNotNull("\n/project-path:", this.ProjectPath);
commandLine.AppendSwitchIfNotNull("\n/root-namespace:", this.RootNamespace);
commandLine.AppendSwitchIfNotNull("\n/main:", this.MainEntryPoint);
if (CompilerStackSize > 0)
commandLine.AppendSwitchIfNotNull("\n/stack-size:", this.CompilerStackSize.ToString());
// Not supported options:
//commandLine.AppendSwitchWithInteger("\n/codepage:", base.Bag, "CodePage");
//commandLine.AppendSwitchIfNotNull("/debug:", this.DebugType);
//commandLine.AppendSwitchWithInteger("\n/filealign:", base.Bag, "FileAlignment");
//commandLine.AppendWhenTrue("\n/utf8output", base.Bag, "Utf8Output");
// Add sources
if (this.Sources != null)
{
commandLine.Append("\n\n");
commandLine.AppendFileNamesIfNotNull(this.Sources, "\n");
commandLine.Append("\n");
}
if (null != base.ResponseFiles)
{
foreach (var it in base.ResponseFiles)
//.........这里部分代码省略.........
示例15: GenerateResGenCommandLineWithoutResources
private void GenerateResGenCommandLineWithoutResources(CommandLineBuilderExtension resGenCommand)
{
Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInternalNull(resGenCommand, "resGenCommand");
if (this.UseSourcePath)
{
resGenCommand.AppendSwitch("/useSourcePath");
}
if (this.PublicClass)
{
resGenCommand.AppendSwitch("/publicClass");
}
if (this.References != null)
{
foreach (ITaskItem item in this.References)
{
resGenCommand.AppendSwitchIfNotNull("/r:", item);
}
}
}