示例#1
0
        /// <summary>
        /// Returns the collection of argument strings defined by this instance.
        /// </summary>
        public IEnumerable <string> GetArguments()
        {
            if (DetailedSummary)
            {
                yield return("/ds");
            }

            if (IgnoreProjectExtensions?.Any() ?? false)
            {
                yield return($"/ignore:{string.Join(";", IgnoreProjectExtensions)}");
            }

            if (MaxCpuCount == 0)
            {
                yield return("/m");
            }

            if (MaxCpuCount > 1)
            {
                yield return($"/m:{MaxCpuCount}");
            }

            if (NoAutoResponse)
            {
                yield return("/noautorsp");
            }

            if (!NodeReuse)
            {
                yield return("/nr:false");
            }

            if (NoLogo)
            {
                yield return("/nologo");
            }

            if (!string.IsNullOrEmpty(PreProcess))
            {
                yield return($"/pp:\"{PreProcess}\"");
            }

            foreach (var property in Properties)
            {
                yield return($"/p:{property.Key}=\"{property.Value}\"");
            }

            foreach (var target in Targets)
            {
                yield return($"/t:\"{target}\"");
            }

            if (!string.IsNullOrEmpty(ToolsVersion))
            {
                yield return($"/tv:\"{ToolsVersion}\"");
            }

            if (!string.IsNullOrEmpty(Validate))
            {
                yield return($"/val:\"{Validate}\"");
            }

            if (Verbosity != MSBuildVerbosityLevels.Normal)
            {
                yield return($"/v:{MSBuildVerbosityLevel.GetString(Verbosity)}");
            }

            if (Version)
            {
                yield return("/ver");
            }

            foreach (var arg in AdditionalArguments)
            {
                yield return(arg);
            }

            foreach (var arg in Logger.GetArguments())
            {
                yield return(arg);
            }

            if (!string.IsNullOrEmpty(ProjectFile))
            {
                yield return($"\"{ProjectFile}\"");
            }
        }
示例#2
0
        /// <summary>
        /// Returns the collection of argument strings defined by this instance.
        /// </summary>
        public IEnumerable <string> GetArguments()
        {
            if (ConsoleLoggerParameters != MSBuildConsoleLoggerParameters.Default)
            {
                var args = new List <string>();

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.PerformanceSummary))
                {
                    args.Add("PerformanceSummary");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.Summary))
                {
                    args.Add("Summary");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.NoSummary))
                {
                    args.Add("NoSummary");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.ErrorsOnly))
                {
                    args.Add("ErrorsOnly");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.WarningsOnly))
                {
                    args.Add("WarningsOnly");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.NoItemAndPropertyList))
                {
                    args.Add("NoItemAndPropertyList");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.ShowCommandLine))
                {
                    args.Add("ShowCommandLine");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.ShowTimestamp))
                {
                    args.Add("ShowTimestamp");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.ShowEventId))
                {
                    args.Add("ShowEventId");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.ForceNoAlign))
                {
                    args.Add("ForceNoAlign");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.DisableConsoleColor))
                {
                    args.Add("DisableConsoleColor");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.DisableMPLogging))
                {
                    args.Add("DisableMPLogging");
                }

                if (ConsoleLoggerParameters.HasFlag(MSBuildConsoleLoggerParameters.EnableMPLogging))
                {
                    args.Add("EnableMPLogging");
                }

                yield return($"/clp:{string.Join(";", args)}");
            }

            if (Verbosity.HasValue)
            {
                yield return($"/verbosity:{MSBuildVerbosityLevel.GetString(Verbosity.Value)}");
            }

            if (!string.IsNullOrEmpty(DistributedFileLogger))
            {
                yield return($"/dfl:\"{DistributedFileLogger}\"");
            }

            foreach (var logger in DistributedLoggers)
            {
                yield return($"/dl:\"{logger}\"");
            }

            if (FileLogger.Default)
            {
                yield return("/fl");
            }

            foreach (var key in FileLoggerParameters.Default.Keys)
            {
                yield return($"/flp:{key}=\"{FileLoggerParameters.Default[key]}\"");
            }

            for (var i = 1; i < 10; i++)
            {
                if (FileLogger[i])
                {
                    yield return($"/fl{i}");
                }

                foreach (var key in FileLoggerParameters[i].Keys)
                {
                    yield return($"/flp{i}:{key}=\"{FileLoggerParameters[i][key]}\"");
                }
            }

            foreach (var logger in Loggers)
            {
                yield return($"/l:\"{logger}\"");
            }

            if (NoConsoleLogger)
            {
                yield return("/noconlog");
            }
        }