示例#1
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            var ser = new XmlSerializer(typeof(PackagesConfig), "urn:ZenCore:NuGet:configuration");
            PackagesConfig cfg;
            List<NugetPackage> packageList;

            string configFile = "packagesList.xml";

            if (!File.Exists(configFile))
            {
                cfg=new PackagesConfig()
                    {
                        BuildType = "Release",
                        SolutionPath = "C:\\src\\Zen.Core",
                        VersionString = "1.2.0.20"
                    };
                packageList = new List<NugetPackage>()
                    {
                        new NugetPackage()
                            {
                                Name = "Zen.Core",
                                Projects = new List<Project>()
                                    {
                                        new Project() {Name = "Zen"},
                                        new Project() {Name = "Zen.DataStore"},
                                    }
                            }
                    };
                cfg.Packages = packageList;
                
                using (var wr = File.CreateText(configFile))
                {
                    ser.Serialize(wr, cfg);
                }
            }
            else
            {
                using (var rdr = File.OpenText(configFile))
                {
                    cfg = (PackagesConfig)ser.Deserialize(rdr);
                }
            }

            //Console.WriteLine("1");
            var nuget = new NugetRunner(cfg.SolutionPath, cfg.BuildType, cfg.VersionString,cfg.Publish,cfg.PublishKey);
            //nuget.Update();
            nuget.BuildSolutions();
            foreach (var nugetPackage in cfg.Packages)
            {
                nuget.CopyPackageFiles(nugetPackage);                
                nuget.Pack(nugetPackage);
            }
            //Console.WriteLine("2");
            Console.WriteLine("Процесс сборки пакетов завершен. Нажмите любую клавишу для продолжения.");
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            var                 ser = new XmlSerializer(typeof(PackagesConfig), "urn:ZenCore:NuGet:configuration");
            PackagesConfig      cfg;
            List <NugetPackage> packageList;

            string configFile = "packagesList.xml";

            if (!File.Exists(configFile))
            {
                cfg = new PackagesConfig()
                {
                    BuildType     = "Release",
                    SolutionPath  = "C:\\src\\Zen.Core",
                    VersionString = "1.2.0.20"
                };
                packageList = new List <NugetPackage>()
                {
                    new NugetPackage()
                    {
                        Name     = "Zen.Core",
                        Projects = new List <Project>()
                        {
                            new Project()
                            {
                                Name = "Zen"
                            },
                            new Project()
                            {
                                Name = "Zen.DataStore"
                            },
                        }
                    }
                };
                cfg.Packages = packageList;

                using (var wr = File.CreateText(configFile))
                {
                    ser.Serialize(wr, cfg);
                }
            }
            else
            {
                using (var rdr = File.OpenText(configFile))
                {
                    cfg = (PackagesConfig)ser.Deserialize(rdr);
                }
            }

            //Console.WriteLine("1");
            var nuget = new NugetRunner(cfg.SolutionPath, cfg.BuildType, cfg.VersionString, cfg.Publish, cfg.PublishKey);

            //nuget.Update();
            nuget.BuildSolutions();
            foreach (var nugetPackage in cfg.Packages)
            {
                nuget.CopyPackageFiles(nugetPackage);
                nuget.Pack(nugetPackage);
            }
            //Console.WriteLine("2");
            Console.WriteLine("Процесс сборки пакетов завершен. Нажмите любую клавишу для продолжения.");
            Console.ReadKey();
        }