当前位置: 首页>>代码示例>>C#>>正文


C# CodeActivityContext.TrackBuildError方法代码示例

本文整理汇总了C#中CodeActivityContext.TrackBuildError方法的典型用法代码示例。如果您正苦于以下问题:C# CodeActivityContext.TrackBuildError方法的具体用法?C# CodeActivityContext.TrackBuildError怎么用?C# CodeActivityContext.TrackBuildError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeActivityContext的用法示例。


在下文中一共展示了CodeActivityContext.TrackBuildError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunProcess

        private int RunProcess(CodeActivityContext context, string fullPath, string workingDirectory, string arguments)
        {
            context.TrackBuildMessage("fullPath: " + fullPath, BuildMessageImportance.Low);
            context.TrackBuildMessage("workingDir: " + workingDirectory, BuildMessageImportance.Low);
            context.TrackBuildMessage("arguments: " + arguments, BuildMessageImportance.Low);
            using (Process proc = new Process())
            {
                proc.StartInfo.FileName = fullPath;

                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.Arguments = arguments;
                context.TrackBuildMessage("Running " + proc.StartInfo.FileName + " " + proc.StartInfo.Arguments, BuildMessageImportance.High);

                if (!string.IsNullOrEmpty(workingDirectory))
                {
                    proc.StartInfo.WorkingDirectory = workingDirectory;
                }

                proc.Start();

                string outputStream = proc.StandardOutput.ReadToEnd();
                if (outputStream.Length > 0)
                {
                    context.TrackBuildMessage(outputStream, BuildMessageImportance.Normal);
                }

                string errorStream = proc.StandardError.ReadToEnd();
                if (errorStream.Length > 0)
                {
                    context.TrackBuildError(errorStream);
                }

                proc.WaitForExit();
                context.TrackBuildMessage("Exit Code: " + proc.ExitCode, BuildMessageImportance.Low);
                return proc.ExitCode;
            }
        }
开发者ID:edwinf,项目名称:xUnitBuildWorkflow,代码行数:39,代码来源:PublishTestResults.cs

示例2: RunCommand

        private void RunCommand(string command, CodeActivityContext context)
        {
            LogMessage("@@@@@@@@@@@@", context);
            LogMessage("Apprenda: Executing command <<" + command + ">> as " + Environment.UserDomainName + @"\" + Environment.UserName, context);
            using (System.Diagnostics.Process process = new System.Diagnostics.Process())
            {
                process.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"PowerShell.exe");
                process.StartInfo.Arguments = " " + command;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.ErrorDialog = false;
                process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError = true;
                process.Start();
                
                string msTestOutput = process.StandardOutput.ReadToEnd();
                string msErrOutput = process.StandardError.ReadToEnd();
                LogMessage("Standard Output: " + msTestOutput, context);
                LogMessage("Error output: " + msErrOutput, context);
                    
                process.WaitForExit();

                if (process.ExitCode != 0)
                {
                    bool verboseLogging = context.GetValue(this.VerboseLogging);
                    // verboselogging would have printed out the process output already
                    if (!verboseLogging)
                    {
                        LogMessage("Apprenda: Executing command <<" + command + ">> as " + Environment.UserDomainName + @"\" + Environment.UserName, context);
                        LogMessage("Standard Output: " + msTestOutput, context, true);
                        LogMessage("Error output: " + msErrOutput, context, true);
                    }
                    context.TrackBuildError("Apprenda: Fail the Apprenda custom build activity because ACS failed with exit code " + process.ExitCode);
                }            
            }
            LogMessage("@@@@@@@@@@@@", context);
        }
开发者ID:claudiobernardoromao,项目名称:Apprenda-TFS-Integration,代码行数:37,代码来源:ApprendaCodeActivity.cs

示例3: TransformNUnitToMSTest

        private void TransformNUnitToMSTest(CodeActivityContext context, string nunitResultFile, string mstestResultFile)
        {
            context.TrackBuildMessage("input file: " + nunitResultFile);
            context.TrackBuildMessage("output file: " + mstestResultFile);
            Stream s = this.GetType().Assembly.GetManifestResourceStream("CustomBuildActivities.NUnitToMSTest.xslt");
            if (s == null)
            {
                context.TrackBuildError("Could not load NUnitToMSTest.xslt from embedded resources");
                return;
            }

            using (var reader = new XmlTextReader(s))
            {
                XslCompiledTransform transform = new XslCompiledTransform();
                transform.Load(reader);
                transform.Transform(nunitResultFile, mstestResultFile);
            }
        }
开发者ID:edwinf,项目名称:xUnitBuildWorkflow,代码行数:18,代码来源:PublishTestResults.cs


注:本文中的CodeActivityContext.TrackBuildError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。