AppendSwitch() public method

Appends a command-line switch that has no separate value, without any quoting. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitch ( string switchName ) : void
switchName string The switch to append to the command line, may not be null
return void
        /// <summary>
        /// Generates the command line commands.
        /// </summary>
        protected override string GenerateCommandLineCommands()
        {
            ////if (this.Assemblies.Length != 1) {
            ////    throw new NotSupportedException("Exactly 1 assembly for signing is supported.");
            ////}
            CommandLineBuilder args = new CommandLineBuilder();
            args.AppendSwitch("-q");

            if (this.KeyFile != null) {
                args.AppendSwitch("-R");
            } else if (this.KeyContainer != null) {
                args.AppendSwitch("-Rc");
            } else {
                throw new InvalidOperationException("Either KeyFile or KeyContainer must be set.");
            }

            args.AppendFileNameIfNotNull(this.Assemblies[0]);
            if (this.KeyFile != null) {
                args.AppendFileNameIfNotNull(this.KeyFile);
            } else {
                args.AppendFileNameIfNotNull(this.KeyContainer);
            }

            return args.ToString();
        }
 public void AppendSwitchSimple()
 {
     CommandLineBuilder c = new CommandLineBuilder();
     c.AppendSwitch("/a");
     c.AppendSwitch("-b");
     Assert.Equal("/a -b", c.ToString());
 }
Exemplo n.º 3
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder builder = new CommandLineBuilder();
            builder.AppendSwitch("pack");

            if (!File.Exists(this.Target))
            {
                throw new FileNotFoundException(string.Format("The file '{0}' could not be found.", this.Target), this.Target);
            }

            builder.AppendFileNameIfNotNull(this.Target);
            builder.AppendSwitchIfTrue("-Symbols", this.Symbols);
            builder.AppendSwitchIfTrue("-NoDefaultExcludes", this.NoDefaultExcludes);
            builder.AppendSwitchIfTrue("-NoPackageAnalysis", this.NoPackageAnalysis);
            builder.AppendSwitchIfTrue("-ExcludeEmptyDirectories", this.ExcludeEmptyDirectories);
            builder.AppendSwitchIfTrue("-IncludeReferencedProjects", this.IncludeReferencedProjects);
            builder.AppendSwitchIfNotNull("-Version ", this.Version);
            builder.AppendSwitchIfNotNull("-Properties ", this.Properties, ";");
            builder.AppendSwitchIfNotNull("-Exclude ", this.Excluded, ";");
            builder.AppendSwitchIfNotNull("-MinClientVersion ", this.MinClientVersion);
            builder.AppendSwitchIfNotNull("-BasePath ", this.BasePath);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", this.OutputDirectory);
            builder.AppendSwitchIfNotNull("-Verbosity ", this.Verbosity);
            builder.AppendSwitch("-NonInteractive ");
            builder.AppendTextUnquotedIfNotNullOrEmpty(this.CustomSwitches);

            return builder.ToString();
        }
Exemplo n.º 4
0
 protected override string GenerateCommandLineCommands()
 {
     Log.LogDebugMessage ("MDoc");
     Log.LogDebugMessage ("  RunExport: {0}", RunExport);
     Log.LogDebugMessage ("  TargetAssembly: {0}", TargetAssembly);
     Log.LogDebugMessage ("  References");
     if (References != null)
         foreach (var reference in References)
             Log.LogDebugMessage ("    {0}", reference);
     Log.LogDebugMessage ("  OutputDocDirectory: {0}", OutputDocDirectory);
     if (RunExport) {
         var cmd = new CommandLineBuilder ();
         cmd.AppendSwitch ("--debug");
         cmd.AppendSwitch ("export-msxdoc");
         cmd.AppendSwitchIfNotNull ("-o", Path.ChangeExtension (TargetAssembly, ".xml"));
         cmd.AppendSwitch (OutputDocDirectory);
         return cmd.ToString ();
     } else {
         var refPaths = References.Select (Path.GetDirectoryName).Distinct ();
         var cmd = new CommandLineBuilder ();
         cmd.AppendSwitch ("--debug");
         cmd.AppendSwitch ("update");
         cmd.AppendSwitch ("--delete");
         cmd.AppendSwitchIfNotNull ("-L", Path.GetDirectoryName (TargetAssembly));
         foreach (var rp in refPaths)
             cmd.AppendSwitchIfNotNull ("-L", rp);
         cmd.AppendSwitchIfNotNull ("-o", OutputDocDirectory);
         cmd.AppendSwitch (Path.GetFullPath (TargetAssembly));
         return cmd.ToString ();
     }
 }
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

            builder.AppendFileNameIfNotNull(Source);
            if (Source != null)
            {
                OutputRes = Path.ChangeExtension(OutputIL, ".res");
            }

            builder.AppendSwitch("/nobar");
            builder.AppendSwitchIfNotNull("/output=", OutputIL);
            if (Encoding == null || Encoding.StartsWith("uni", StringComparison.InvariantCultureIgnoreCase))
            {
                builder.AppendSwitch("/unicode");
            }
            if (Encoding != null && Encoding.StartsWith("utf", StringComparison.InvariantCultureIgnoreCase))
            {
                builder.AppendSwitch("/utf8");
            }
            builder.AppendSwitchIfNotNull("/item:", Item);

            Log.LogMessage(MessageImportance.High, "Disassembling {0}...", Source);
            return builder.ToString();
        }
        protected override void GenerateCommandLineCommands(CommandLineBuilder commandLineBuilder)
        {
            if (Source != null)
            {
                foreach (var item in Source)
                {
                    commandLineBuilder.AppendSwitchIfNotNull("-Source ", item.ItemSpec);
                }
            }

            if (FallbackSource != null)
            {
                foreach (var item in FallbackSource)
                {
                    commandLineBuilder.AppendSwitchIfNotNull("-FallbackSource ", item.ItemSpec);
                }
            }

            if (NoCache)
            {
                commandLineBuilder.AppendSwitch("-NoCache");
            }

            if (DisableParallelProcessing)
            {
                commandLineBuilder.AppendSwitch("-DisableParallelProcessing");
            }

            commandLineBuilder.AppendSwitchIfNotNull("-PackageSaveMode ", PackageSaveMode);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Generates the arguments.
        /// </summary>
        /// <param name="builder">The builder.</param>
        protected override void GenerateArguments(CommandLineBuilder builder)
        {
            builder.AppendSwitch("--count");

            base.GenerateArguments(builder);

            builder.AppendSwitch(Revision);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

            builder.AppendSwitch("uninstall");
            builder.AppendSwitch(PackageName);

            return builder.ToString();
        }
Exemplo n.º 9
0
		protected override string GenerateCommandLineCommands() {
			var args = new CommandLineBuilder();

			args.AppendSwitch("a");
			args.AppendSwitch("--");

			args.AppendFileNameIfNotNull(this.ZipFileName);

			return args.ToString();
		}
Exemplo n.º 10
0
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch(File);

            if (Args != null)
                builder.AppendSwitch(Args);

            return builder.ToString();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Generates the arguments.
        /// </summary>
        /// <param name="builder">The builder.</param>
        protected override void GenerateArguments(CommandLineBuilder builder)
        {
            builder.AppendSwitch("--verify");

            if (Short)
                builder.AppendSwitch("--short");

            base.GenerateArguments(builder);

            builder.AppendSwitch(Revision);
        }
Exemplo n.º 12
0
		/// <summary>See <see cref="ToolTask.GenerateCommandLineCommands"/>.</summary>
		protected override string GenerateCommandLineCommands()
		{
			CommandLineBuilder commandLineBuilder = new CommandLineBuilder();
			commandLineBuilder.AppendSwitchIfNotNull(this.Uninstall ? "uninstall " : "install ", this.AssemblyName);
			if (this.NoDependencies)
			{
				commandLineBuilder.AppendSwitch("/NoDependencies");
			}
			commandLineBuilder.AppendSwitch("/nologo");
			commandLineBuilder.AppendSwitch("/verbose");
			return commandLineBuilder.ToString();
		}
Exemplo n.º 13
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder cb = new CommandLineBuilder();

            //cb.AppendSwitch("-q");
            cb.AppendSwitch("-nologo");
            cb.AppendSwitch("--");

            cb.AppendFileNamesIfNotNull(Sources, " ");

            return cb.ToString();
        }
Exemplo n.º 14
0
		/// <summary>
		/// Generates the command line commands.
		/// </summary>
		protected override string GenerateCommandLineCommands() {
			CommandLineBuilder builder = new CommandLineBuilder();
			builder.AppendSwitch("-q");
			if (this.SkipVerification) {
				builder.AppendSwitch("-Vr");
			} else {
				builder.AppendSwitch("-Vu");
			}

			builder.AppendFileNameIfNotNull(this.AssemblyName + "," + this.PublicKeyToken);
			return builder.ToString();
		}
Exemplo n.º 15
0
		/// <summary>See <see cref="ToolTask.GenerateCommandLineCommands"/>.</summary>
		protected override string GenerateCommandLineCommands()
		{
			CommandLineBuilder commandLineBuilder = new CommandLineBuilder();
			commandLineBuilder.AppendSwitch("/nologo");
			if (this.Force)
			{
				commandLineBuilder.AppendSwitch("/f");
			}
			commandLineBuilder.AppendSwitch(this.Uninstall ? "/u" : "/i");
			commandLineBuilder.AppendFileNameIfNotNull(this.Assembly);
			return commandLineBuilder.ToString();
		}
Exemplo n.º 16
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder builder = new CommandLineBuilder();
            builder.AppendSwitch("spec");

            builder.AppendSwitchIfNotNull("-AssemblyPath ", this.AssemblyPath);
            builder.AppendSwitchIfNotNull("-Verbosity ", this.Verbosity);
            builder.AppendSwitchIfTrue("-Force", this.Force);
            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
Exemplo n.º 17
0
        protected override string GenerateCommandLineCommands()
        {
            var args = new CommandLineBuilder ();

            args.AppendSwitch ("-convert");
            args.AppendSwitch ("binary1");
            args.AppendSwitch ("-o");
            args.AppendFileNameIfNotNull (Output.ItemSpec);
            args.AppendFileNameIfNotNull (Input.ItemSpec);

            return args.ToString ();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch("push");
            builder.AppendFileNameIfNotNull(File);
            builder.AppendFileNameIfNotNull(APIKey);
            builder.AppendSwitchIfNotNull("-Source ", Source);
            if (CreateOnly)
                builder.AppendSwitch("-CreateOnly");

            return builder.ToString();
        }
Exemplo n.º 19
0
        protected override string GenerateCommandLineCommands()
        {
            var args = new CommandLineBuilder ();

            args.AppendSwitch ("-t");
            args.AppendSwitch ("4");
            args.AppendSwitch ("-z");
            args.AppendSwitch ("-o");
            args.AppendFileNameIfNotNull (DSymDir);
            args.AppendFileNameIfNotNull (Executable);

            return args.ToString ();
        }
Exemplo n.º 20
0
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch("pack");
            builder.AppendFileNameIfNotNull(Package);
            builder.AppendSwitchIfNotNull("-Version ", Version);
            builder.AppendSwitchIfNotNull("-BasePath ", BasePath);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", OutputDirectory);

            if (Symbols)
              builder.AppendSwitch("-symbols");

            return builder.ToString();
        }
Exemplo n.º 21
0
        protected virtual CommandLineBuilder CreateCommandLine()
        {
            var cmd = new CommandLineBuilder ();

            cmd.AppendSwitch (Command);
            if (Verbose) {
                cmd.AppendSwitch ("-V");
            }
            cmd.AppendSwitchIfNotNull ("-alias ", KeyAlias);
            cmd.AppendSwitchIfNotNull ("-storepass ", StorePass);
            cmd.AppendSwitchIfNotNull ("-keypass ", KeyPass);
            cmd.AppendSwitchIfNotNull ("-keystore ", KeyStore);
            return cmd;
        }
Exemplo n.º 22
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder builder = new CommandLineBuilder();
            builder.AppendSwitch("push");

            builder.AppendFileNameIfNotNull(this.PackagePath);
            builder.AppendSwitchIfNotNull("-ApiKey ", this.ApiKey);
            builder.AppendSwitchIfNotNull("-ConfigFile ", this.ConfigFile);
            builder.AppendSwitchIfNotNull("-Source ", this.Source);
            builder.AppendSwitchIfNotNull("-Verbosity ", this.Verbosity);
            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
		protected override string GenerateCommandLineCommands()
		{
			var builder = new CommandLineBuilder();
			builder.AppendSwitch(NuGetVerb);

			builder.AppendFileNameIfNotNull(PackagePath);
			builder.AppendSwitch("-NonInteractive");
			builder.AppendSwitchIfNotNull("-Source ", Source);
			builder.AppendSwitchIfNotNull("-ApiKey ", ApiKey);
			builder.AppendSwitchIfNotNull("-Verbosity ", Verbosity);
			builder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);
			builder.AppendSwitchIfNotNullOrEmpty(PushArguments);

			return builder.ToString();
		}
Exemplo n.º 24
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch("delete");
            builder.AppendFileNameIfNotNull(Package);
            builder.AppendFileNameIfNotNull(Version);
            builder.AppendSwitchIfNotNull("-ApiKey ", ApiKey);
            builder.AppendSwitchIfNotNull("-Source ", Source);
            builder.AppendSwitchIfNotNull("-Verbosity ", Verbosity);
            builder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);

            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
Exemplo n.º 25
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder clb = new CommandLineBuilder();
            clb.AppendSwitch("describe");

            return clb.ToString();
        }
Exemplo n.º 26
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch("update");
            builder.AppendFileNameIfNotNull(Package);
            builder.AppendSwitchIfNotNull("-Version ", Version);
            builder.AppendSwitchIfNotNull("-Source ", Source);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", OutputDirectory);
            builder.AppendSwitchIfNotNull("-RepositoryPath ", RepositoryPath);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", OutputDirectory);
            builder.AppendSwitchIfNotNull("-FileConflictAction ", FileConflictAction);
            builder.AppendSwitchIfNotNull("-Verbosity ", Verbosity);
            builder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);

            if (Prerelease)
                builder.AppendSwitch("-Prerelease");
            if (Safe)
                builder.AppendSwitch("-Safe");
            if (Self)
                builder.AppendSwitch("-Self");

            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
Exemplo n.º 27
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

            builder.AppendSwitch("wait-for-device");

            return builder.ToString();
        }
Exemplo n.º 28
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

            builder.AppendSwitch("kill-server");

            return builder.ToString();
        }
        protected override void GenerateCommandLineCommands(CommandLineBuilder commandLineBuilder)
        {
            commandLineBuilder.AppendSwitch("setApiKey");

            commandLineBuilder.AppendFileNameIfNotNull(ApiKey);

            commandLineBuilder.AppendSwitchIfNotNullOrWhiteSpace("-Source ", Source);
        }
Exemplo n.º 30
0
		protected override string GenerateCommandLineCommands ()
		{
			var builder = new CommandLineBuilder ();
			builder.AppendSwitch("p");
			builder.AppendSwitch("-f");
			
			var resdir = Path.Combine (ProjectDir, "res");
			var reszip = Path.Combine (ProjectDir, ProjectName + "-res.zip");
			
			if (Directory.Exists (resdir)) {
				builder.AppendSwitch("-S");
				builder.AppendFileNameIfNotNull (resdir);
			}
			
			builder.AppendSwitch("-F");
			builder.AppendFileNameIfNotNull (reszip);
			
			builder.AppendSwitch("-J");
			builder.AppendFileNameIfNotNull (ProjectDir);
			
			builder.AppendSwitch ("-M");
			builder.AppendFileNameIfNotNull (AndroidManifest);
			
			builder.AppendSwitch ("-I");
			builder.AppendFileNameIfNotNull (FrameworkApk);
			
			return builder.ToString ();
		}
Exemplo n.º 31
0
 static internal void AddImportParametersFilesOptions(Utilities.CommandLineBuilder commandLineBuilder, string parameterFlag, Framework.ITaskItem[] items)
 {
     if (commandLineBuilder != null &&
         !string.IsNullOrEmpty(parameterFlag) &&
         items != null)   // Dev10 bug 496639 foreach will throw the exception if the replaceRuleItem is null
     {
         foreach (Framework.ITaskItem item in items)
         {
             string fileName = item.ItemSpec;
             if (!string.IsNullOrEmpty(fileName))
             {
                 commandLineBuilder.AppendSwitch(string.Concat(parameterFlag, "\"", fileName, "\""));
             }
         }
     }
 }
Exemplo n.º 32
0
        /// <summary>
        /// Generates command line arguments for msdeploy.exe
        /// </summary>
        protected override string GenerateCommandLineCommands()
        {
            Utilities.CommandLineBuilder commandLine = new Utilities.CommandLineBuilder();
            AddDestinationProviderSettingToObject(commandLine, "-source:", this.Source, m_strValueQuote, null, this);
            AddDestinationProviderSettingToObject(commandLine, "-dest:", this.Destination, m_strValueQuote, AdditionalDestinationProviderOptions, this);

            commandLine.AppendSwitchUnquotedIfNotNull("-verb:", m_verb);
            commandLine.AppendSwitchUnquotedIfNotNull("-failureLevel:", m_failureLevel);
            commandLine.AppendSwitchUnquotedIfNotNull("-xpath:", m_xpath);
            commandLine.AppendSwitchUnquotedIfNotNull("-replace:", m_replace);
            commandLine.AppendSwitchUnquotedIfNotNull("-skip:", m_skip);

            GenerateSwitchPerItem(commandLine, "-enableRule:", m_enableRule);
            GenerateSwitchPerItem(commandLine, "-disableRule:", m_disableRule);
            GenerateSwitchPerItem(commandLine, "-enableLink:", m_enableLink);
            GenerateSwitchPerItem(commandLine, "-disableLink:", m_disableLink);
            GenerateSwitchPerItem(commandLine, "-disableSkipDirective:", m_disableSkipDirective);
            GenerateSwitchPerItem(commandLine, "-enableSkipDirective:", m_enableSkipDirective);

            // this allow multiple replace rule to happen, we should consider do the same thing for skip:
            AddReplaceRulesToOptions(commandLine, m_replaceRuleItemsITaskItem, m_strValueQuote);
            AddSkipDirectiveToBaseOptions(commandLine, m_skipRuleItemsITaskItem, m_strValueQuote);
            AddImportDeclareParametersFilesOptions(commandLine, m_importDeclareParametersItems);
            AddDeclareParametersOptions(commandLine, m_declareParameterItems, m_strValueQuote, OptimisticParameterDefaultValue);

            AddImportSetParametersFilesOptions(commandLine, m_importSetParametersItems);
            AddSimpleSetParametersToObject(commandLine, m_simpleSetParamterItems, m_strValueQuote, OptimisticParameterDefaultValue);
            AddSetParametersToObject(commandLine, m_setParamterItems, m_strValueQuote, OptimisticParameterDefaultValue);

            if (m_xml)
            {
                commandLine.AppendSwitch("-xml");
            }
            if (m_whatif)
            {
                commandLine.AppendSwitch("-whatif");
            }
            if (m_verbose)
            {
                commandLine.AppendSwitch("-verbose");
            }
            if (m_allowUntrusted)
            {
                commandLine.AppendSwitch("-allowUntrusted");
            }
            if (m_useChecksum)
            {
                commandLine.AppendSwitch("-useChecksum");
            }

            if (m_enableTransaction)
            {
                commandLine.AppendSwitch("-enableTransaction");
            }
            if (m_retryAttempts > 0)
            {
                commandLine.AppendSwitchUnquotedIfNotNull("-retryAttempts=", m_retryAttempts.ToString(CultureInfo.InvariantCulture));
            }
            if (m_retryInterval > 0)
            {
                commandLine.AppendSwitchUnquotedIfNotNull("-retryInterval=", m_retryInterval.ToString(CultureInfo.InvariantCulture));
            }

            if (!string.IsNullOrEmpty(UserAgent))
            {
                commandLine.AppendSwitchUnquotedIfNotNull("-userAgent=", string.Concat("\"", UserAgent, "\""));
            }

            //IISExpress support
            //public const string AppHostConfigDirectory = "-appHostConfigDir";
            // *    public const string WebServerDirectory = "-webServerDir";
            //      public const string WebServerManifest = "-webServerManifest";
            commandLine.AppendSwitchIfNotNull("-appHostConfigDir:", WebServerAppHostConfigDirectory);
            commandLine.AppendSwitchIfNotNull("-webServerDir:", WebServerDirectory);
            // bug in msdeploy.exe currently only take the file name
            commandLine.AppendSwitchIfNotNull("-webServerManifest:", System.IO.Path.GetFileName(WebServerManifest));

            m_lastCommandLine = commandLine.ToString();

            // show arguments in the output
            Log.LogMessage(Framework.MessageImportance.Low, string.Concat("\"", GenerateFullPathToTool(), "\" ", m_lastCommandLine));
            return(m_lastCommandLine);
        }