예제 #1
0
        public static void CreateNuget(this string nuspecTemplate, Action <NuSpecFile> cfgNuspec = null, Action <NugetPackConfig> cfgPacker = null)
        {
            var file = nuspecTemplate.AsNuspec();

            cfgNuspec?.Invoke(file);
            var packCfg = new NugetPackConfig();

            cfgPacker?.Invoke(packCfg);
            var spec = file.Save(packCfg.OutputDir);
            var args = new List <string>();

            args.AddRange(new[] { "pack", spec, "-BasePath", packCfg.BasePath, "-OutputDirectory", packCfg.OutputDir });
            if (packCfg.BuildSymbols)
            {
                args.Add("-Symbols");
            }
            packCfg.NugetPath.Exec(args.ToArray());

            var pgk = file.Manifest.Metadata.Id + "." + file.Manifest.Metadata.Version + ".nupkg";

            if (packCfg.Publish)
            {
                packCfg.NugetPath.Exec("Push", Path.Combine(packCfg.OutputDir, pgk));
            }
        }
예제 #2
0
        public static void CreateNuget(this string nuspecTemplate,Action<NuSpecFile> cfgNuspec=null,Action<NugetPackConfig> cfgPacker=null)
        {
            var file = nuspecTemplate.AsNuspec();
            cfgNuspec?.Invoke(file);
            var packCfg=new NugetPackConfig();
            cfgPacker?.Invoke(packCfg);
            var spec=file.Save(packCfg.OutputDir);
            var args = new List<string>();
            args.AddRange(new[] { "pack", spec, "-BasePath", packCfg.BasePath, "-OutputDirectory", packCfg.OutputDir });
            if (packCfg.BuildSymbols) args.Add("-Symbols");
            packCfg.NugetPath.Exec(args.ToArray());

            var pgk = file.Manifest.Metadata.Id + "." + file.Manifest.Metadata.Version + ".nupkg";

            if (packCfg.Publish)
            {
                packCfg.NugetPath.Exec("Push",Path.Combine(packCfg.OutputDir,pgk));
            }
        }