public bool Build()
        {
            ConsoleOutputUtil.WriteHeader("Building", _output);

            var result = _proj.MsBuild.Build(new List <ILogger>()
            {
                new ConsoleBuildLogger(_output)
            });

            if (result.OverallResult == BuildResultCode.Success)
            {
                _output.Standard.WriteLine("Build completed successfully");
                return(true);
            }

            _output.Error.Write("Build failed");
            if (result.Exception != null)
            {
                var ex = result.Exception;
                while (ex != null)
                {
                    _output.Error.WriteLine("{0}\r\n{1}", ex.Message, ex.StackTrace);
                    ex = ex.InnerException;
                }
            }

            return(false);
        }
        public void PatchAssemblyVersion(string versionPattern)
        {
            ConsoleOutputUtil.WriteHeader("Patching Assembly Version", _output);

            _output.Standard.WriteLine("Current Version:\t\t{0}", _proj.AssemblyInfo.CurrentAssemblyInfoVersion);
            _proj.AssemblyInfo.Patch(versionPattern);
            _output.Standard.WriteLine("Patched Version:\t\t{0}", _proj.AssemblyInfo.CurrentAssemblyInfoVersion);

            _output.Standard.WriteLine();
            _output.Standard.WriteLine("- Done -");
        }
        public bool Pack(bool doCreateSymbolsPackage = true)
        {
            ConsoleOutputUtil.WriteHeader("Creating NuGet Package", _output);
            if (_proj.NuGet.Pack(new ProcessLogger(_output.Standard, _output.Error), doCreateSymbolsPackage))
            {
                _output.Standard.WriteLine("- Done -");
                return(true);
            }

            _output.Warning.WriteLine("- Done with Errors -");
            return(false);
        }
        public bool Push(NugetPushConfiguration config)
        {
            ConsoleOutputUtil.WriteHeader("Pushing NuGet Package", _output);

            var rootPackageFilename = Path.GetFileNameWithoutExtension(_proj.TargetProjectFile);

            if (string.IsNullOrEmpty(rootPackageFilename))
            {
                throw new Exception(string.Format("Cannot derive root package file name from project path, \"{0}\"", _proj.TargetProjectFile));
            }

            var targetPackagePath = Path.Combine(_proj.TargetProjectDirectoryPath, string.Format("{0}.{1}.nupkg",
                                                                                                 rootPackageFilename,
                                                                                                 _proj.AssemblyInfo.CurrentAssemblyInfoVersion));

            var targetSymbolsPath = Path.Combine(_proj.TargetProjectDirectoryPath, string.Format("{0}.{1}.symbols.nupkg",
                                                                                                 rootPackageFilename,
                                                                                                 _proj.AssemblyInfo.CurrentAssemblyInfoVersion));

            if (!Push(targetPackagePath, config == null ? null : config.PackageConfiguration))
            {
                _output.Warning.WriteLine("- Done with Errors -");
                return(false);
            }

            if (config != null && config.SymbolsConfiguration != null &&
                !string.IsNullOrEmpty(config.SymbolsConfiguration.Source))
            {
                if (!Push(targetSymbolsPath, config.SymbolsConfiguration))
                {
                    _output.Warning.WriteLine("- Done with Errors -");
                    return(false);
                }
            }

            _output.Standard.WriteLine("- Done -");
            return(true);
        }