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) 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); }
/// <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) { // .ocx file being imported commandLine.AppendFileNameIfNotNull(TypeLibName); // options commandLine.AppendSwitchIfNotNull("/asmversion:", (AssemblyVersion != null) ? AssemblyVersion.ToString() : null); commandLine.AppendSwitchIfNotNull("/namespace:", AssemblyNamespace); commandLine.AppendSwitchIfNotNull("/machine:", Machine); commandLine.AppendWhenTrue("/noclassmembers", Bag, "PreventClassMembers"); commandLine.AppendWhenTrue("/nologo", Bag, "NoLogo"); commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly); commandLine.AppendWhenTrue("/silent", Bag, "Silent"); commandLine.AppendWhenTrue("/sysarray", Bag, "SafeArrayAsSystemArray"); commandLine.AppendSwitchIfNotNull("/transform:", ConvertTransformFlagsToCommandLineCommand(Transform)); commandLine.AppendWhenTrue("/verbose", Bag, "Verbose"); if (ReferenceFiles != null) { foreach (var referenceFile in ReferenceFiles) { commandLine.AppendSwitchIfNotNull("/reference:", referenceFile); } } base.AddCommandLineCommands(commandLine); }
/// <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); }
void AddCommandLineCommands (CommandLineBuilderExtension commandLine) { if (Resources.Length == 0) return; commandLine.AppendFileNameIfNotNull (OutputFile); commandLine.AppendFileNamesIfNotNull (Resources, " "); }
/// <summary> /// Adds the arguments for cmd.exe /// </summary> /// <param name="commandLine">command line builder class to add arguments to</param> protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { // Create the batch file now, // so we have the file name for the cmd.exe command line CreateTemporaryBatchFile(); string batchFileForCommandLine = _batchFile; // Unix consoles cannot have their encodings changed in place (like chcp on windows). // Instead, unix scripts receive encoding information via environment variables before invocation. // In consequence, encoding setup has to be performed outside the script, not inside it. if (NativeMethodsShared.IsUnixLike) { commandLine.AppendSwitch("-c"); commandLine.AppendTextUnquoted(" \""); commandLine.AppendTextUnquoted("export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; . "); commandLine.AppendFileNameIfNotNull(batchFileForCommandLine); commandLine.AppendTextUnquoted("\""); } else { if (NativeMethodsShared.IsWindows) { commandLine.AppendSwitch("/Q"); // echo off if (!Traits.Instance.EscapeHatches.UseAutoRunWhenLaunchingProcessUnderCmd) { commandLine.AppendSwitch("/D"); // do not load AutoRun configuration from the registry (perf) } commandLine.AppendSwitch("/C"); // run then terminate // If for some crazy reason the path has a & character and a space in it // then get the short path of the temp path, which should not have spaces in it // and then escape the & if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&")) { batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine); batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&"); } } commandLine.AppendFileNameIfNotNull(batchFileForCommandLine); } }
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); }
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); }
/// <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) { // .ocx file being imported commandLine.AppendFileNameIfNotNull(ActiveXControlName); // options commandLine.AppendWhenTrue("/nologo", Bag, "NoLogo"); commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly); commandLine.AppendSwitchIfNotNull("/rcw:", RuntimeCallableWrapperAssembly); commandLine.AppendWhenTrue("/silent", Bag, "Silent"); commandLine.AppendWhenTrue("/source", Bag, "GenerateSource"); commandLine.AppendWhenTrue("/verbose", Bag, "Verbose"); base.AddCommandLineCommands(commandLine); }
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); }
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); }
/// <summary> /// Adds the arguments for cmd.exe /// </summary> /// <param name="commandLine">command line builder class to add arguments to</param> protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { // Create the batch file now, // so we have the file name for the cmd.exe command line CreateTemporaryBatchFile(); string batchFileForCommandLine = _batchFile; commandLine.AppendSwitch("/Q"); // echo off commandLine.AppendSwitch("/C"); // run then terminate // If for some crazy reason the path has a & character and a space in it // then get the short path of the temp path, which should not have spaces in it // and then escape the & if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&")) { batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine); batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&"); } commandLine.AppendFileNameIfNotNull(batchFileForCommandLine); }
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { #if RUNTIME_TYPE_NETCORE commandLine.AppendFileNameIfNotNull(_executablePath.Value); commandLine.AppendTextUnquoted(" "); #endif commandLine.AppendSwitchIfTrue("/noconfig", NoConfig); if (References != null) { foreach (ITaskItem reference in References) { commandLine.AppendSwitchIfNotNull(ReferenceSwitch, reference.ItemSpec); } } commandLine.AppendPlusOrMinusSwitch("/deterministic", Deterministic); commandLine.AppendSwitchIfTrue("/nologo", NoLogo); commandLine.AppendPlusOrMinusSwitch("/optimize", Optimize); commandLine.AppendSwitchIfNotNull("/target:", TargetType); commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly); commandLine.AppendFileNamesIfNotNull(Sources, " "); }
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) { 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); }
/// <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); }
/// <summary> /// Adds the arguments for cmd.exe /// </summary> /// <param name="commandLine">command line builder class to add arguments to</param> protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { // Create the batch file now, // so we have the file name for the cmd.exe command line CreateTemporaryBatchFile(); string batchFileForCommandLine = _batchFile; commandLine.AppendSwitch("/Q"); // echo off commandLine.AppendSwitch("/C"); // run then terminate // If for some crazy reason the path has a & character and a space in it // then get the short path of the temp path, which should not have spaces in it // and then escape the & if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&")) { batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine); batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&"); } commandLine.AppendFileNameIfNotNull(batchFileForCommandLine); }
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 (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-"); } } // 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 // Verbosity // WarningsAsErrors // WarningsNotAsErrors }
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { commandLine.AppendFileNameIfNotNull(this.TypeLibName); commandLine.AppendSwitchIfNotNull("/asmversion:", (this.AssemblyVersion != null) ? this.AssemblyVersion.ToString() : null); commandLine.AppendSwitchIfNotNull("/namespace:", this.AssemblyNamespace); commandLine.AppendSwitchIfNotNull("/machine:", this.Machine); commandLine.AppendWhenTrue("/noclassmembers", base.Bag, "PreventClassMembers"); commandLine.AppendWhenTrue("/nologo", base.Bag, "NoLogo"); commandLine.AppendSwitchIfNotNull("/out:", this.OutputAssembly); commandLine.AppendWhenTrue("/silent", base.Bag, "Silent"); commandLine.AppendWhenTrue("/sysarray", base.Bag, "SafeArrayAsSystemArray"); commandLine.AppendSwitchIfNotNull("/transform:", this.ConvertTransformFlagsToCommandLineCommand(this.Transform)); commandLine.AppendWhenTrue("/verbose", base.Bag, "Verbose"); if (this.ReferenceFiles != null) { foreach (string str in this.ReferenceFiles) { commandLine.AppendSwitchIfNotNull("/reference:", str); } } base.AddCommandLineCommands(commandLine); }
protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { commandLine.AppendFileNameIfNotNull(this.ActiveXControlName); commandLine.AppendWhenTrue("/nologo", base.Bag, "NoLogo"); commandLine.AppendSwitchIfNotNull("/out:", this.OutputAssembly); commandLine.AppendSwitchIfNotNull("/rcw:", this.RuntimeCallableWrapperAssembly); commandLine.AppendWhenTrue("/silent", base.Bag, "Silent"); commandLine.AppendWhenTrue("/source", base.Bag, "GenerateSource"); commandLine.AppendWhenTrue("/verbose", base.Bag, "Verbose"); base.AddCommandLineCommands(commandLine); }
/// <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) { // .ocx file being imported commandLine.AppendFileNameIfNotNull(TypeLibName); // options commandLine.AppendSwitchIfNotNull("/asmversion:", (AssemblyVersion != null) ? AssemblyVersion.ToString() : null); commandLine.AppendSwitchIfNotNull("/namespace:", AssemblyNamespace); commandLine.AppendSwitchIfNotNull("/machine:", Machine); commandLine.AppendWhenTrue("/noclassmembers", Bag, "PreventClassMembers"); commandLine.AppendWhenTrue("/nologo", Bag, "NoLogo"); commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly); commandLine.AppendWhenTrue("/silent", Bag, "Silent"); commandLine.AppendWhenTrue("/sysarray", Bag, "SafeArrayAsSystemArray"); commandLine.AppendSwitchIfNotNull("/transform:", ConvertTransformFlagsToCommandLineCommand(Transform)); commandLine.AppendWhenTrue("/verbose", Bag, "Verbose"); if (ReferenceFiles != null) { foreach (var referenceFile in ReferenceFiles) { commandLine.AppendSwitchIfNotNull("/reference:", referenceFile); } } base.AddCommandLineCommands(commandLine); }
protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine) { JarCommand command; string flags = ""; switch (Command.ToLowerInvariant()) { case "create": command = JarCommand.Create; flags += "c"; break; case "update": command = JarCommand.Update; flags += "u"; break; case "extract": command = JarCommand.Extract; flags += "x"; break; case "index": command = JarCommand.Index; flags += "i"; break; case "list": command = JarCommand.List; flags += "t"; break; default: throw new InvalidOperationException(); } if (command != JarCommand.Index && JarFile != null && JarFile.ItemSpec != null) flags += 'f'; if (Verbose && command != JarCommand.Index) flags += 'v'; if (command == JarCommand.Create || command == JarCommand.Update) { if (!Compress) flags += '0'; if (!CreateManifest) flags += 'M'; if (Manifest != null && Manifest.Length == 0 && Manifest[0].ItemSpec != null) flags += 'm'; } commandLine.AppendSwitch(flags); if (JarFile != null && JarFile.ItemSpec != null) commandLine.AppendFileNameIfNotNull(JarFile); if (command == JarCommand.Create || command == JarCommand.Update) { if (Manifest != null && Manifest.Length == 0 && Manifest[0].ItemSpec != null) commandLine.AppendFileNameIfNotNull(Manifest[0]); } ILookup<string, ITaskItem> inputs = Inputs.ToLookup(i => i.GetMetadata("BaseOutputDirectory") ?? string.Empty); commandLine.AppendFileNamesIfNotNull(inputs[string.Empty].ToArray(), " "); foreach (var pair in inputs) { if (pair.Key == string.Empty) continue; foreach (var file in pair) { commandLine.AppendSwitchIfNotNull("-C ", pair.Key); commandLine.AppendFileNameIfNotNull(file.ItemSpec.StartsWith(pair.Key) ? file.ItemSpec.Substring(pair.Key.Length) : file.ItemSpec); } //commandLine.AppendSwitchIfNotNull("-C ", pair.Key); //commandLine.AppendFileNamesIfNotNull(pair.Select(i => i.ItemSpec.StartsWith(pair.Key) ? i.ItemSpec.Substring(pair.Key.Length) : i.ItemSpec).ToArray(), " "); } if (!string.IsNullOrEmpty(EntryPoint)) commandLine.AppendSwitchIfNotNull("-e ", EntryPoint); }
/// <summary> /// Logs a Resgen.exe command line that indicates what parameters were /// passed to this task. Since this task is replacing Resgen, and we used /// to log the Resgen.exe command line, we need to continue logging an /// equivalent command line. /// </summary> /// <param name="inputFiles"></param> /// <param name="outputFiles"></param> private void LogResgenCommandLine(List<ITaskItem> inputFiles, List<ITaskItem> outputFiles) { CommandLineBuilderExtension commandLineBuilder = new CommandLineBuilderExtension(); // start the command line with the path to Resgen.exe commandLineBuilder.AppendFileNameIfNotNull(Path.Combine(_resgenPath, "resgen.exe")); GenerateResGenCommandLineWithoutResources(commandLineBuilder); if (StronglyTypedLanguage == null) { // append the resources to compile for (int i = 0; i < inputFiles.Count; ++i) { if (!ExtractResWFiles) { commandLineBuilder.AppendFileNamesIfNotNull ( new string[] { inputFiles[i].ItemSpec, outputFiles[i].ItemSpec }, "," ); } else { commandLineBuilder.AppendFileNameIfNotNull(inputFiles[i].ItemSpec); } } } else { // append the resource to compile commandLineBuilder.AppendFileNamesIfNotNull(inputFiles.ToArray(), " "); commandLineBuilder.AppendFileNamesIfNotNull(outputFiles.ToArray(), " "); // append the strongly-typed resource details commandLineBuilder.AppendSwitchIfNotNull ( "/str:", new string[] { StronglyTypedLanguage, StronglyTypedNamespace, StronglyTypedClassName, StronglyTypedFileName }, "," ); } Log.LogCommandLine(MessageImportance.Low, commandLineBuilder.ToString()); }
private void LogResgenCommandLine(List<ITaskItem> inputFiles, List<ITaskItem> outputFiles) { CommandLineBuilderExtension resGenCommand = new CommandLineBuilderExtension(); resGenCommand.AppendFileNameIfNotNull(Path.Combine(this.resgenPath, "resgen.exe")); this.GenerateResGenCommandLineWithoutResources(resGenCommand); if (this.StronglyTypedLanguage == null) { resGenCommand.AppendSwitch("/compile"); for (int i = 0; i < inputFiles.Count; i++) { resGenCommand.AppendFileNamesIfNotNull(new string[] { inputFiles[i].ItemSpec, outputFiles[i].ItemSpec }, ","); } } else { resGenCommand.AppendFileNamesIfNotNull(inputFiles.ToArray(), " "); resGenCommand.AppendFileNamesIfNotNull(outputFiles.ToArray(), " "); resGenCommand.AppendSwitchIfNotNull("/str:", new string[] { this.StronglyTypedLanguage, this.StronglyTypedNamespace, this.StronglyTypedClassName, this.StronglyTypedFileName }, ","); } base.Log.LogCommandLine(MessageImportance.Low, resGenCommand.ToString()); }
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 }
protected internal override void AddResponseFileCommands ( CommandLineBuilderExtension commandLine) { if (AddModules != null && AddModules.Length > 0) commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ","); if (Bag ["CodePage"] != null) commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ()); commandLine.AppendSwitchIfNotNull ("/debug:", DebugType); if (Bag ["DelaySign"] != null) if (DelaySign) commandLine.AppendSwitch ("/delaysign+"); else commandLine.AppendSwitch ("/delaysign-"); if (Bag ["EmitDebugInformation"] != null) if (EmitDebugInformation) commandLine.AppendSwitch ("/debug+"); else commandLine.AppendSwitch ("/debug-"); //fileAlignment commandLine.AppendSwitchIfNotNull ("/keycontainer:", KeyContainer); commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile); // FIXME: add ids from metadata if (LinkResources != null) foreach (ITaskItem item in LinkResources) commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec); if (NoLogo) commandLine.AppendSwitch ("/nologo"); if (Bag ["Optimize"] != null) if (Optimize) commandLine.AppendSwitch ("/optimize+"); else commandLine.AppendSwitch ("/optimize-"); if (OutputAssembly != null) commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec); if (Resources != null) foreach (ITaskItem item in Resources) { string logical_name = item.GetMetadata ("LogicalName"); if (logical_name.Length > 0) commandLine.AppendSwitchIfNotNull ("/resource:", String.Format ("{0},{1}", item.ItemSpec, logical_name)); else commandLine.AppendSwitchIfNotNull ("/resource:", item.ItemSpec); } if (Sources != null) foreach (ITaskItem item in Sources) commandLine.AppendFileNameIfNotNull (item.ItemSpec); if (TargetType != null) commandLine.AppendSwitchIfNotNull ("/target:", TargetType); if (Bag ["TreatWarningsAsErrors"] != null) if (TreatWarningsAsErrors) commandLine.AppendSwitch ("/warnaserror+"); else commandLine.AppendSwitch ("/warnaserror-"); commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon); }
protected internal override void AddResponseFileCommands( CommandLineBuilderExtension commandLine) { if (AddModules != null && AddModules.Length > 0) { commandLine.AppendSwitchIfNotNull("/addmodule:", AddModules, ","); } if (Bag ["CodePage"] != null) { commandLine.AppendSwitchIfNotNull("/codepage:", CodePage.ToString()); } commandLine.AppendSwitchIfNotNull("/debug:", DebugType); if (Bag ["DelaySign"] != null) { if (DelaySign) { commandLine.AppendSwitch("/delaysign+"); } else { commandLine.AppendSwitch("/delaysign-"); } } if (Bag ["EmitDebugInformation"] != null) { if (EmitDebugInformation) { commandLine.AppendSwitch("/debug+"); } else { commandLine.AppendSwitch("/debug-"); } } //fileAlignment commandLine.AppendSwitchIfNotNull("/keycontainer:", KeyContainer); commandLine.AppendSwitchIfNotNull("/keyfile:", KeyFile); // FIXME: add ids from metadata if (LinkResources != null) { foreach (ITaskItem item in LinkResources) { commandLine.AppendSwitchIfNotNull("/linkresource:", item.ItemSpec); } } if (NoLogo) { commandLine.AppendSwitch("/nologo"); } if (Bag ["Optimize"] != null) { if (Optimize) { commandLine.AppendSwitch("/optimize+"); } else { commandLine.AppendSwitch("/optimize-"); } } if (OutputAssembly != null) { commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly.ItemSpec); } if (Resources != null) { foreach (ITaskItem item in Resources) { string logical_name = item.GetMetadata("LogicalName"); if (logical_name.Length > 0) { commandLine.AppendSwitchIfNotNull("/resource:", String.Format("{0},{1}", item.ItemSpec, logical_name)); } else { commandLine.AppendSwitchIfNotNull("/resource:", item.ItemSpec); } } } if (Sources != null) { foreach (ITaskItem item in Sources) { commandLine.AppendFileNameIfNotNull(item.ItemSpec); } } if (TargetType != null) { commandLine.AppendSwitchIfNotNull("/target:", TargetType); } if (Bag ["TreatWarningsAsErrors"] != null) { if (TreatWarningsAsErrors) { commandLine.AppendSwitch("/warnaserror+"); } else { commandLine.AppendSwitch("/warnaserror-"); } } commandLine.AppendSwitchIfNotNull("/win32icon:", Win32Icon); }
private void AddCommandLineCommands(CommandLineBuilderExtension commandLine) { string outputDirectory = Path.GetDirectoryName(this.OutputFile); if(!Directory.Exists( outputDirectory )) Directory.CreateDirectory( outputDirectory ); commandLine.AppendSwitch( "-q" ); if (m_inputDirectories != null) { commandLine.AppendSwitch("-r"); } commandLine.AppendFileNameIfNotNull( this.m_outputFile ); if (m_inputFiles != null) { foreach (ITaskItem inputFile in InputFiles) { Log.LogMessage("Adding file {0}", inputFile.ItemSpec); commandLine.AppendFileNameIfNotNull(inputFile.ItemSpec); } } if (m_inputDirectories != null) { foreach (ITaskItem inputDirectory in InputDirectories) { Log.LogMessage("Adding directory {0}", inputDirectory.ItemSpec); commandLine.AppendFileNameIfNotNull(inputDirectory.ItemSpec); } } }