Esempio n. 1
0
 private void Push_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(cb_projects.Text))
     {
         var project = ProjectsConfigEntity.Projects.FirstOrDefault(c => c.Name == cb_projects.Text);
         if (project != null)
         {
             //Push
             NugetManager manager   = new NugetManager(project.RootPath, project.Name);
             var          filePaths = manager.GetNugetPackageFileFullPaths();
             if (filePaths.Count() == 0)
             {
                 WriteText("该项目未创建Nuget包");
                 return;
             }
             if (filePaths.Count() > 1)
             {
                 WriteText("该项目存在多个包");
                 return;
             }
             StringBuilder sb = manager.ExecuteCmdCommand("nuget push " + filePaths.First() + " -s " + ProjectsConfigEntity.NugetServer + " " + ProjectsConfigEntity.APIKey);
             WriteText(sb.ToString());
         }
         else
         {
             WriteText("该项目未创建");
         }
     }
     else
     {
         WriteText("请选择有效的项目项");
     }
 }
Esempio n. 2
0
 private void Generate_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tb_Version.Text))
     {
         tb_Version.Text = "1.0.*";
     }
     SaveAll();
     if (!string.IsNullOrEmpty(cb_projects.Text))
     {
         var project = ProjectsConfigEntity.Projects.FirstOrDefault(c => c.Name == cb_projects.Text);
         if (project != null)
         {
             NugetManager manager = new NugetManager(project.RootPath, project.Name);
             //Remove Previous Package
             var filePaths = manager.GetNugetPackageFileFullPaths();
             foreach (var filePath in filePaths)
             {
                 File.Delete(filePath);
             }
             //Spec
             string tempVersion = GetTempVersion();
             AssemlyConfigEntity.Version     = tempVersion;
             AssemlyConfigEntity.Description = tb_Description.Text + Environment.NewLine + tb_DescriptionEx.Text;
             manager.GenerateNugetSpec(project, AssemlyConfigEntity);
             AssemlyConfigEntity.Version     = tb_Version.Text;
             AssemlyConfigEntity.Description = tb_Description.Text;
             //Pack
             var projectFileFullPath = manager.GetProjectFileFullPath(project.RootPath);
             if (string.IsNullOrEmpty(projectFileFullPath))
             {
                 WriteText("未获取到该项目的.csproj项目文件");
                 return;
             }
             StringBuilder sb = manager.ExecuteCmdCommand("nuget pack " + projectFileFullPath + " -OutputDirectory " + manager.OutputDirectoryPath);
             WriteText(sb.ToString());
         }
         else
         {
             WriteText("该项目未创建");
         }
     }
     else
     {
         WriteText("请选择有效的项目项");
     }
 }