Exemplo n.º 1
0
        protected AnalyzerResult DesignTimeBuild()
        {
            using (var operation = _log.OnEnterAndConfirmOnExit())
            {
                var csProj    = this.GetProjectFile();
                var logWriter = new StringWriter();
                var manager   = new AnalyzerManager(new AnalyzerManagerOptions
                {
                    LogWriter = logWriter
                });

                var analyzer = manager.GetProject(csProj.FullName);
                analyzer.AddBinaryLogger(Path.Combine(Directory.FullName, DesignTimeBuildBinlogFileName));
                var languageVersion = csProj.SuggestedLanguageVersion();
                analyzer.SetGlobalProperty("langVersion", languageVersion);
                var result = analyzer.Build().Results.First();
                DesignTimeBuildResult = result;
                LastDesignTimeBuild   = Clock.Current.Now();
                if (result.Succeeded == false)
                {
                    var logData = logWriter.ToString();
                    File.WriteAllText(
                        LastBuildErrorLogFile.FullName,
                        string.Join(Environment.NewLine, "Design Time Build Error", logData));
                }
                else if (LastBuildErrorLogFile.Exists)
                {
                    LastBuildErrorLogFile.Delete();
                }

                operation.Succeed();

                return(result);
            }
        }
Exemplo n.º 2
0
        protected async Task DotnetBuild()
        {
            using (var operation = Log.OnEnterAndConfirmOnExit())
            {
                this.CleanObjFolder();
                var projectFile = this.GetProjectFile();
                var args        = $"/bl:{FullBuildBinlogFileName}";
                if (projectFile?.Exists == true)
                {
                    args = $@"""{projectFile.FullName}"" {args}";
                }


                operation.Info("Building package {name} in {directory}", Name, Directory);

                var result = await new Dotnet(Directory).Build(args: args);

                if (result.ExitCode != 0)
                {
                    File.WriteAllText(
                        LastBuildErrorLogFile.FullName,
                        string.Join(Environment.NewLine, result.Error));
                }
                else if (LastBuildErrorLogFile.Exists)
                {
                    LastBuildErrorLogFile.Delete();
                }

                result.ThrowOnFailure();
                operation.Succeed();
            }
        }
Exemplo n.º 3
0
        protected async Task DotnetBuild()
        {
            {
                this.CleanObjFolder();
                var projectFile = this.GetProjectFile();
                var args        = $"/bl:{FullBuildBinlogFileName}";
                if (projectFile?.Exists == true)
                {
                    args = $@"""{projectFile.FullName}"" {args}";
                }


                var result = await new Dotnet(Directory).Build(args: args);

                if (result.ExitCode != 0)
                {
                    File.WriteAllText(
                        LastBuildErrorLogFile.FullName,
                        string.Join(Environment.NewLine, result.Error));
                }
                else if (LastBuildErrorLogFile.Exists)
                {
                    LastBuildErrorLogFile.Delete();
                }

                result.ThrowOnFailure();
            }
        }