AppendSwitchIfNotNull() public method

Appends a command-line switch that takes a single string parameter, quoting the parameter if necessary. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitchIfNotNull ( string switchName, string parameter ) : void
switchName string The switch to append to the command line, may not be null
parameter string Switch parameter to append, quoted if necessary. If null, this method has no effect.
return void
Exemplo n.º 1
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()
 {
     CommandLineBuilder builder = new CommandLineBuilder();
     builder.AppendSwitchIfNotNull("/d:", ChmDirectory);
     builder.AppendSwitchIfNotNull("/l:", LanguageId ?? "1033");
     return builder.ToString();
 }
Exemplo n.º 2
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();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Construct the command line from the task properties by using the CommandLineBuilder
        /// </summary>
        /// <returns></returns>
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder builder = new CommandLineBuilder();

            foreach(ITaskItem iti in this._sources)
            {
                builder.AppendFileNameIfNotNull(iti);
            }

            if (this._configurationFile != null)
            {
                builder.AppendSwitchIfNotNull("/config:", new string[] {this._configurationFile}, ":");
            }

            if (this._filename != null)
            {
                builder.AppendSwitchIfNotNull("/fileName:", new string[] {this._filename}, ":");
            }

            // Log a High importance message stating the file that we are assembling
            Log.LogMessage(MessageImportance.High, "Assembling {0}", this._sources);

            // We have all of our switches added, return the commandline as a string
            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.º 6
0
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

            builder.AppendSwitchIfNotNull("/source:", SourceDirectory);
            builder.AppendSwitchIfNotNull("/target:", TargetDirectory);
            builder.AppendSwitchIfNotNull("/output:", OutputUpdateFile);

            return builder.ToString();
        }
Exemplo n.º 7
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.º 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("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.º 9
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.º 10
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.º 11
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();
        }
Exemplo n.º 12
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();
        }
		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.º 14
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()
 {
     CommandLineBuilder builder = new CommandLineBuilder();
     builder.AppendSwitchIfNotNull("/config:", ConfigFile);
     builder.AppendFileNameIfNotNull(ManifestFile);
     return builder.ToString();
 }
Exemplo n.º 15
0
        protected override string GenerateCommandLineCommands()
        {
            CommandLineBuilder commandLineBuilder = new CommandLineBuilder();

            GenerateCommandLineCommands(commandLineBuilder);

            commandLineBuilder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);

            if (_commandVerbosity != CommandVerbosity.None)
            {
                commandLineBuilder.AppendSwitchIfNotNull("-Verbosity ", _commandVerbosity.ToString());
            }

            commandLineBuilder.AppendSwitchIfTrue("-NonInteractive", NonInteractive);

            return commandLineBuilder.ToString();
        }
Exemplo n.º 16
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.º 17
0
        protected override string GenerateCommandLineCommands()
        {
            //   Running command: C:\Program Files (x86)\Java\jdk1.6.0_20\bin\javac.exe
            //     "-J-Dfile.encoding=UTF8"
            //     "-d" "bin\classes"
            //     "-classpath" "C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\AndroidMSBuildTest\AndroidMSBuildTest\obj\Debug\android\bin\mono.android.jar"
            //     "-bootclasspath" "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-8\android.jar"
            //     "-encoding" "UTF-8"
            //     "@C:\Users\Jonathan\AppData\Local\Temp\tmp79c4ac38.tmp"

            //var android_dir = MonoDroid.MonoDroidSdk.GetAndroidProfileDirectory (TargetFrameworkDirectory);

            var cmd = new CommandLineBuilder ();

            cmd.AppendSwitchIfNotNull ("-J-Dfile.encoding=", "UTF8");

            cmd.AppendSwitchIfNotNull ("-d ", ClassesOutputDirectory);

            cmd.AppendSwitchIfNotNull ("-classpath ", Jars == null || !Jars.Any () ? null : string.Join (Path.PathSeparator.ToString (), Jars.Select (i => i.ItemSpec)));
            cmd.AppendSwitchIfNotNull ("-bootclasspath ", JavaPlatformJarPath);
            cmd.AppendSwitchIfNotNull ("-encoding ", "UTF-8");
            cmd.AppendFileNameIfNotNull (string.Format ("@{0}", TemporarySourceListFile));
            cmd.AppendSwitchIfNotNull ("-target ", JavacTargetVersion);
            cmd.AppendSwitchIfNotNull ("-source ", JavacSourceVersion);

            return cmd.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("restore");
            builder.AppendFileNameIfNotNull(Solution);
            builder.AppendSwitchIfNotNull("-PackagesDirectory ", PackagesDirectory);
            builder.AppendSwitchIfNotNull("-SolutionDirectory ", SolutionDirectory);
            builder.AppendSwitchIfNotNull("-Source ", Source);
            builder.AppendSwitchIfNotNull("-Verbosity ", Verbosity);
            builder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);

            if (DisableParallelProcessing)
                builder.AppendSwitch("-DisableParallelProcessing");
            if (NoCache)
                builder.AppendSwitch("-NoCache");

            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
Exemplo n.º 19
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.º 20
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.º 21
0
        protected override string GenerateCommandLineCommands()
        {
            if (!Directory.Exists (OutputDocDirectory))
                Directory.CreateDirectory (OutputDocDirectory);

            var cmd = new CommandLineBuilder ();
            cmd.AppendSwitch (Path.GetFullPath (TargetAssembly));
            //foreach (var r in References)
            //	cmd.AppendSwitch (r);
            cmd.AppendSwitch ("-v=2");
            cmd.AppendSwitchIfNotNull ("--out=", OutputDocDirectory);
            foreach (var j in JavaDocs)
                cmd.AppendSwitchIfNotNull ("--doc-dir=", Path.GetDirectoryName (j));
            foreach (var t in Transforms) {
                if (t.EndsWith ("Metadata.xml", StringComparison.InvariantCultureIgnoreCase))
                    cmd.AppendSwitchIfNotNull ("--metadata=", t);
                else
                    cmd.AppendSwitchIfNotNull ("--enum-map=", t);
            }
            return cmd.ToString ();
        }
Exemplo n.º 22
0
		/// <summary>
		/// Generates the command line commands.
		/// </summary>
		protected override string GenerateCommandLineCommands() {
			CommandLineBuilder builder = new CommandLineBuilder();

			if (this.DelaySign) {
				builder.AppendSwitch("/delaysign");
			}

			builder.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);

			builder.AppendFileNameIfNotNull(this.Assembly);

			return builder.ToString();
		}
Exemplo n.º 23
0
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();
            builder.AppendSwitch("pack");
            builder.AppendFileNameIfNotNull(NuSpecPath);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", OutputDirectory);
            builder.AppendSwitchIfNotNull("-Properties ", Properties);

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

            if (NoPackageAnalysis)
                builder.AppendSwitch("-NoPackageAnalysis");

            if (NoDefaultExcludes)
                builder.AppendSwitch("-NoDefaultExcludes");

            if (ExcludeEmptyDirectories)
                builder.AppendSwitch("-ExcludeEmptyDirectories");

            return builder.ToString();
        }
Exemplo n.º 24
0
        /// <summary>
        /// This method constructs the correct Tracker.exe response file arguments from its parameters
        /// </summary>
        /// <param name="dllName">The name of the dll that will do the tracking</param>
        /// <param name="intermediateDirectory">Intermediate directory where tracking logs will be written</param>
        /// <param name="rootFiles">Rooting marker</param>
        /// <param name="cancelEventName">If a cancel event has been created that Tracker should be listening for, its name is passed here</param>
        /// <returns>The arguments as a string</returns>
        public static string TrackerResponseFileArguments(string dllName, string intermediateDirectory, string rootFiles, string cancelEventName)
        {
            CommandLineBuilder builder = new CommandLineBuilder();

            builder.AppendSwitchIfNotNull("/d ", dllName);

            if (!String.IsNullOrEmpty(intermediateDirectory))
            {
                intermediateDirectory = FileUtilities.NormalizePath(intermediateDirectory);
                // If the intermediate directory ends up with a trailing slash, then be rid of it!
                if (FileUtilities.EndsWithSlash(intermediateDirectory))
                {
                    intermediateDirectory = Path.GetDirectoryName(intermediateDirectory);
                }
                builder.AppendSwitchIfNotNull("/i ", intermediateDirectory);
            }

            builder.AppendSwitchIfNotNull("/r ", rootFiles);

            builder.AppendSwitchIfNotNull("/b ", cancelEventName); // b for break

            return(builder.ToString() + " ");
        }
Exemplo n.º 25
0
        protected override string GenerateCommandLineCommands()
        {
            var cmd = new CommandLineBuilder ();

            cmd.AppendSwitchIfNotNull ("-tsa ", TimestampAuthorityUrl);
            cmd.AppendSwitchIfNotNull ("-tsacert ", TimestampAuthorityCertificateAlias);
            cmd.AppendSwitchIfNotNull ("-keystore ", KeyStore);
            cmd.AppendSwitchIfNotNull ("-storepass ", StorePass);
            cmd.AppendSwitchIfNotNull ("-keypass ", KeyPass);
            cmd.AppendSwitchIfNotNull ("-digestalg ", "SHA1");
            cmd.AppendSwitchIfNotNull ("-sigalg ", "md5withRSA");
            cmd.AppendSwitchIfNotNull ("-signedjar ", String.Format ("{0}{1}{2}-Signed-Unaligned.apk", SignedApkDirectory, Path.DirectorySeparatorChar, Path.GetFileNameWithoutExtension (UnsignedApk)));

            cmd.AppendFileNameIfNotNull (UnsignedApk);
            cmd.AppendSwitch (KeyAlias);

            return cmd.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("install");
            builder.AppendFileNameIfNotNull(Package);
            builder.AppendSwitchIfNotNull("-Version ", Version);
            builder.AppendSwitchIfNotNull("-Source ", Source);
            builder.AppendSwitchIfNotNull("-OutputDirectory ", OutputDirectory);
            builder.AppendSwitchIfNotNull("-SolutionDirectory ", SolutionDirectory);
            builder.AppendSwitchIfNotNull("-Verbosity ", Verbosity);
            builder.AppendSwitchIfNotNull("-ConfigFile ", ConfigFile);

            if (ExcludeVersion)
                builder.AppendSwitch("-ExcludeVersion");
            if (Prerelease)
                builder.AppendSwitch("-Prerelease");
            if (NoCache)
                builder.AppendSwitch("-NoCache");

            builder.AppendSwitch("-NonInteractive");

            return builder.ToString();
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
0
		public void TestAppendSwitchIfNotNull12()
		{
			clb = new CommandLineBuilder();
			clb.AppendSwitchIfNotNull("/z:", "x \"hello\" y");
		}
Exemplo n.º 29
0
		public void TestAppendSwitchIfNotNul11()
		{
			clb = new CommandLineBuilder();

			clb.AppendSwitchIfNotNull("/z:", " a  b");
			clb.AppendSwitchIfNotNull("/z:", "c\tb");
			clb.AppendSwitchIfNotNull("/z:", "ab\n");
			clb.AppendSwitchIfNotNull("/z:", "xyz\u000babc");
			clb.AppendSwitchIfNotNull("/z:", "\u000cabc");
			clb.AppendSwitchIfNotNull("/z:", "a 'hello' b");
			clb.AppendSwitchIfNotNull("/z:", "a;b");

			Assert.AreEqual("/z:\" a  b\" /z:\"c\tb\" /z:\"ab\n\" " +
				"/z:\"xyz\u000babc\" /z:\"\u000cabc\" /z:\"a 'hello' b\" /z:\"a;b\"",
				clb.ToString(), "A1");
		}
Exemplo n.º 30
0
		public void TestAppendSwitchIfNotNull10 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchIfNotNull ("/switch:", (ITaskItem[]) null, ";");
			Assert.AreEqual (String.Empty, clb.ToString (), "A1");
			
			clb.AppendSwitchIfNotNull ("/switch:", items, ";");
			Assert.AreEqual ("/switch:a;b", clb.ToString (), "A2");

			clb.AppendSwitchIfNotNull("/switch:", new ITaskItem[] { new TaskItem("a'b"), new TaskItem("c") }, ";");
			Assert.AreEqual ("/switch:a;b /switch:\"a'b\";c", clb.ToString(), "A3");
		}
Exemplo n.º 31
0
		public void TestAppendSwitchIfNotNull9 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchIfNotNull ("/switch", items, null);
		}
Exemplo n.º 32
0
		public void TestAppendSwitchIfNotNull8 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchIfNotNull (null, items, "delimiter");
		}