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)); } }
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)); } }