修改发布测试环境

Test.EIImageViewer
hang 2023-05-04 15:34:34 +08:00
parent 19bd2467f0
commit 6d62206791
3 changed files with 421 additions and 254 deletions

View File

@ -37,38 +37,42 @@
logTBox = new RichTextBox();
tabControl1 = new TabControl();
tabPage1 = new TabPage();
groupBox4 = new GroupBox();
serviceNameTBox = new TextBox();
label10 = new Label();
deleteService_Btn = new Button();
label11 = new Label();
createService_Btn = new Button();
serviceDisplayNameTBox = new TextBox();
en_TBox = new TextBox();
label9 = new Label();
label1 = new Label();
exePathTbox = new TextBox();
selectPathBtn = new Button();
groupBox2 = new GroupBox();
stopServiceBtn = new Button();
startServiceBtn = new Button();
label2 = new Label();
startOrStopServiceTbox = new TextBox();
deleteService_Btn = new Button();
createService_Btn = new Button();
en_TBox = new TextBox();
label1 = new Label();
selectPathBtn = new Button();
exePathTbox = new TextBox();
label9 = new Label();
serviceDisplayNameTBox = new TextBox();
serviceNameTBox = new TextBox();
label11 = new Label();
label10 = new Label();
tabPage2 = new TabPage();
label3 = new Label();
bakPathTBox = new TextBox();
label4 = new Label();
bakDbName = new TextBox();
label5 = new Label();
bakPublishPath = new TextBox();
startBakBtn = new Button();
groupBox4 = new GroupBox();
bakPublishPath = new TextBox();
label5 = new Label();
bakDbName = new TextBox();
label4 = new Label();
bakPathTBox = new TextBox();
label3 = new Label();
groupBox5 = new GroupBox();
netCorePublishBtn = new Button();
vuePublishBtn = new Button();
groupBox1.SuspendLayout();
groupBox3.SuspendLayout();
tabControl1.SuspendLayout();
tabPage1.SuspendLayout();
groupBox4.SuspendLayout();
groupBox2.SuspendLayout();
tabPage2.SuspendLayout();
groupBox4.SuspendLayout();
groupBox5.SuspendLayout();
SuspendLayout();
//
// groupBox1
@ -77,9 +81,9 @@
groupBox1.Controls.Add(rb_Verify);
groupBox1.Controls.Add(rb_test);
groupBox1.Controls.Add(rb_local);
groupBox1.Location = new Point(12, 12);
groupBox1.Location = new Point(12, 175);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(605, 116);
groupBox1.Size = new Size(628, 116);
groupBox1.TabIndex = 1;
groupBox1.TabStop = false;
groupBox1.Text = "环境";
@ -148,10 +152,10 @@
//
tabControl1.Controls.Add(tabPage1);
tabControl1.Controls.Add(tabPage2);
tabControl1.Location = new Point(12, 148);
tabControl1.Location = new Point(12, 318);
tabControl1.Name = "tabControl1";
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(609, 914);
tabControl1.Size = new Size(628, 687);
tabControl1.TabIndex = 4;
//
// tabPage1
@ -161,238 +165,11 @@
tabPage1.Location = new Point(4, 26);
tabPage1.Name = "tabPage1";
tabPage1.Padding = new Padding(3);
tabPage1.Size = new Size(601, 884);
tabPage1.Size = new Size(620, 657);
tabPage1.TabIndex = 0;
tabPage1.Text = "服务";
tabPage1.UseVisualStyleBackColor = true;
//
// groupBox2
//
groupBox2.Controls.Add(stopServiceBtn);
groupBox2.Controls.Add(startServiceBtn);
groupBox2.Controls.Add(label2);
groupBox2.Controls.Add(startOrStopServiceTbox);
groupBox2.Location = new Point(20, 341);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(538, 187);
groupBox2.TabIndex = 39;
groupBox2.TabStop = false;
groupBox2.Text = "服务停止与启动";
//
// stopServiceBtn
//
stopServiceBtn.Enabled = false;
stopServiceBtn.Location = new Point(261, 101);
stopServiceBtn.Name = "stopServiceBtn";
stopServiceBtn.Size = new Size(128, 40);
stopServiceBtn.TabIndex = 39;
stopServiceBtn.Text = "停止服务";
stopServiceBtn.UseVisualStyleBackColor = true;
//
// startServiceBtn
//
startServiceBtn.Enabled = false;
startServiceBtn.Location = new Point(94, 101);
startServiceBtn.Name = "startServiceBtn";
startServiceBtn.Size = new Size(128, 40);
startServiceBtn.TabIndex = 38;
startServiceBtn.Text = "启动服务";
startServiceBtn.UseVisualStyleBackColor = true;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(20, 52);
label2.Name = "label2";
label2.Size = new Size(56, 17);
label2.TabIndex = 32;
label2.Text = "服务名称";
//
// startOrStopServiceTbox
//
startOrStopServiceTbox.Location = new Point(99, 49);
startOrStopServiceTbox.Name = "startOrStopServiceTbox";
startOrStopServiceTbox.Size = new Size(259, 23);
startOrStopServiceTbox.TabIndex = 31;
startOrStopServiceTbox.Text = "EI_Image_Viewer";
//
// deleteService_Btn
//
deleteService_Btn.Enabled = false;
deleteService_Btn.Location = new Point(417, 33);
deleteService_Btn.Name = "deleteService_Btn";
deleteService_Btn.Size = new Size(95, 27);
deleteService_Btn.TabIndex = 38;
deleteService_Btn.Text = "删除服务";
deleteService_Btn.UseVisualStyleBackColor = true;
//
// createService_Btn
//
createService_Btn.Enabled = false;
createService_Btn.Location = new Point(167, 232);
createService_Btn.Name = "createService_Btn";
createService_Btn.Size = new Size(128, 40);
createService_Btn.TabIndex = 37;
createService_Btn.Text = "创建服务";
createService_Btn.UseVisualStyleBackColor = true;
createService_Btn.Click += createService_Btn_Click;
//
// en_TBox
//
en_TBox.Location = new Point(140, 176);
en_TBox.Name = "en_TBox";
en_TBox.Size = new Size(259, 23);
en_TBox.TabIndex = 36;
en_TBox.Text = "Development";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(71, 176);
label1.Name = "label1";
label1.Size = new Size(44, 17);
label1.TabIndex = 35;
label1.Text = "环境名";
//
// selectPathBtn
//
selectPathBtn.Enabled = false;
selectPathBtn.Location = new Point(417, 125);
selectPathBtn.Name = "selectPathBtn";
selectPathBtn.Size = new Size(95, 27);
selectPathBtn.TabIndex = 34;
selectPathBtn.Text = "选择";
selectPathBtn.UseVisualStyleBackColor = true;
//
// exePathTbox
//
exePathTbox.Enabled = false;
exePathTbox.Location = new Point(140, 126);
exePathTbox.Name = "exePathTbox";
exePathTbox.Size = new Size(259, 23);
exePathTbox.TabIndex = 33;
//
// label9
//
label9.AutoSize = true;
label9.Location = new Point(71, 130);
label9.Name = "label9";
label9.Size = new Size(32, 17);
label9.TabIndex = 32;
label9.Text = "程序";
//
// serviceDisplayNameTBox
//
serviceDisplayNameTBox.Location = new Point(140, 79);
serviceDisplayNameTBox.Name = "serviceDisplayNameTBox";
serviceDisplayNameTBox.Size = new Size(259, 23);
serviceDisplayNameTBox.TabIndex = 31;
serviceDisplayNameTBox.Text = "EI_Image_Viewer_DisplayName";
//
// serviceNameTBox
//
serviceNameTBox.Location = new Point(140, 33);
serviceNameTBox.Name = "serviceNameTBox";
serviceNameTBox.Size = new Size(259, 23);
serviceNameTBox.TabIndex = 30;
serviceNameTBox.Text = "EI_Image_Viewer";
//
// label11
//
label11.AutoSize = true;
label11.Location = new Point(-1, 82);
label11.Name = "label11";
label11.Size = new Size(128, 17);
label11.TabIndex = 29;
label11.Text = "网站后端服务显示名称";
//
// label10
//
label10.AutoSize = true;
label10.Location = new Point(23, 36);
label10.Name = "label10";
label10.Size = new Size(104, 17);
label10.TabIndex = 28;
label10.Text = "网站后端服务名称";
//
// tabPage2
//
tabPage2.Controls.Add(startBakBtn);
tabPage2.Controls.Add(bakPublishPath);
tabPage2.Controls.Add(label5);
tabPage2.Controls.Add(bakDbName);
tabPage2.Controls.Add(label4);
tabPage2.Controls.Add(bakPathTBox);
tabPage2.Controls.Add(label3);
tabPage2.Location = new Point(4, 26);
tabPage2.Name = "tabPage2";
tabPage2.Padding = new Padding(3);
tabPage2.Size = new Size(601, 884);
tabPage2.TabIndex = 1;
tabPage2.Text = "备份与发布";
tabPage2.UseVisualStyleBackColor = true;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(6, 79);
label3.Name = "label3";
label3.Size = new Size(92, 17);
label3.TabIndex = 0;
label3.Text = "数据库备份路径";
//
// bakPathTBox
//
bakPathTBox.Enabled = false;
bakPathTBox.Location = new Point(115, 75);
bakPathTBox.Name = "bakPathTBox";
bakPathTBox.Size = new Size(474, 23);
bakPathTBox.TabIndex = 1;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(20, 31);
label4.Name = "label4";
label4.Size = new Size(68, 17);
label4.TabIndex = 2;
label4.Text = "备份数据库";
//
// bakDbName
//
bakDbName.Enabled = false;
bakDbName.Location = new Point(114, 28);
bakDbName.Name = "bakDbName";
bakDbName.Size = new Size(474, 23);
bakDbName.TabIndex = 3;
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(6, 128);
label5.Name = "label5";
label5.Size = new Size(104, 17);
label5.TabIndex = 4;
label5.Text = "发布程序备份路径";
//
// bakPublishPath
//
bakPublishPath.Enabled = false;
bakPublishPath.Location = new Point(117, 125);
bakPublishPath.Name = "bakPublishPath";
bakPublishPath.Size = new Size(474, 23);
bakPublishPath.TabIndex = 5;
//
// startBakBtn
//
startBakBtn.Location = new Point(160, 204);
startBakBtn.Name = "startBakBtn";
startBakBtn.Size = new Size(213, 53);
startBakBtn.TabIndex = 6;
startBakBtn.Text = "开始备份";
startBakBtn.UseVisualStyleBackColor = true;
startBakBtn.Click += startBakBtn_Click;
//
// groupBox4
//
groupBox4.Controls.Add(serviceNameTBox);
@ -408,16 +185,281 @@
groupBox4.Controls.Add(selectPathBtn);
groupBox4.Location = new Point(20, 28);
groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(538, 289);
groupBox4.Size = new Size(538, 311);
groupBox4.TabIndex = 40;
groupBox4.TabStop = false;
groupBox4.Text = "服务创建与删除";
//
// serviceNameTBox
//
serviceNameTBox.Location = new Point(140, 33);
serviceNameTBox.Name = "serviceNameTBox";
serviceNameTBox.Size = new Size(259, 23);
serviceNameTBox.TabIndex = 30;
serviceNameTBox.Text = "EI_Image_Viewer";
//
// label10
//
label10.AutoSize = true;
label10.Location = new Point(23, 36);
label10.Name = "label10";
label10.Size = new Size(104, 17);
label10.TabIndex = 28;
label10.Text = "网站后端服务名称";
//
// deleteService_Btn
//
deleteService_Btn.Enabled = false;
deleteService_Btn.Location = new Point(417, 33);
deleteService_Btn.Name = "deleteService_Btn";
deleteService_Btn.Size = new Size(95, 27);
deleteService_Btn.TabIndex = 38;
deleteService_Btn.Text = "删除服务";
deleteService_Btn.UseVisualStyleBackColor = true;
deleteService_Btn.Click += deleteService_Btn_Click;
//
// label11
//
label11.AutoSize = true;
label11.Location = new Point(-1, 82);
label11.Name = "label11";
label11.Size = new Size(128, 17);
label11.TabIndex = 29;
label11.Text = "网站后端服务显示名称";
//
// createService_Btn
//
createService_Btn.Enabled = false;
createService_Btn.Location = new Point(167, 232);
createService_Btn.Name = "createService_Btn";
createService_Btn.Size = new Size(128, 40);
createService_Btn.TabIndex = 37;
createService_Btn.Text = "创建服务";
createService_Btn.UseVisualStyleBackColor = true;
createService_Btn.Click += createService_Btn_Click;
//
// serviceDisplayNameTBox
//
serviceDisplayNameTBox.Location = new Point(140, 79);
serviceDisplayNameTBox.Name = "serviceDisplayNameTBox";
serviceDisplayNameTBox.Size = new Size(259, 23);
serviceDisplayNameTBox.TabIndex = 31;
serviceDisplayNameTBox.Text = "EI_Image_Viewer_DisplayName";
//
// en_TBox
//
en_TBox.Location = new Point(140, 176);
en_TBox.Name = "en_TBox";
en_TBox.Size = new Size(259, 23);
en_TBox.TabIndex = 36;
en_TBox.Text = "Development";
//
// label9
//
label9.AutoSize = true;
label9.Location = new Point(71, 130);
label9.Name = "label9";
label9.Size = new Size(32, 17);
label9.TabIndex = 32;
label9.Text = "程序";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(71, 176);
label1.Name = "label1";
label1.Size = new Size(44, 17);
label1.TabIndex = 35;
label1.Text = "环境名";
//
// exePathTbox
//
exePathTbox.Enabled = false;
exePathTbox.Location = new Point(140, 126);
exePathTbox.Name = "exePathTbox";
exePathTbox.Size = new Size(259, 23);
exePathTbox.TabIndex = 33;
//
// selectPathBtn
//
selectPathBtn.Enabled = false;
selectPathBtn.Location = new Point(417, 125);
selectPathBtn.Name = "selectPathBtn";
selectPathBtn.Size = new Size(95, 27);
selectPathBtn.TabIndex = 34;
selectPathBtn.Text = "选择";
selectPathBtn.UseVisualStyleBackColor = true;
selectPathBtn.Click += selectPathBtn_Click;
//
// groupBox2
//
groupBox2.Controls.Add(stopServiceBtn);
groupBox2.Controls.Add(startServiceBtn);
groupBox2.Controls.Add(label2);
groupBox2.Controls.Add(startOrStopServiceTbox);
groupBox2.Location = new Point(20, 391);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(538, 187);
groupBox2.TabIndex = 39;
groupBox2.TabStop = false;
groupBox2.Text = "服务停止与启动";
//
// stopServiceBtn
//
stopServiceBtn.Enabled = false;
stopServiceBtn.Location = new Point(261, 101);
stopServiceBtn.Name = "stopServiceBtn";
stopServiceBtn.Size = new Size(128, 40);
stopServiceBtn.TabIndex = 39;
stopServiceBtn.Text = "停止服务";
stopServiceBtn.UseVisualStyleBackColor = true;
stopServiceBtn.Click += stopServiceBtn_Click;
//
// startServiceBtn
//
startServiceBtn.Enabled = false;
startServiceBtn.Location = new Point(94, 101);
startServiceBtn.Name = "startServiceBtn";
startServiceBtn.Size = new Size(128, 40);
startServiceBtn.TabIndex = 38;
startServiceBtn.Text = "启动服务";
startServiceBtn.UseVisualStyleBackColor = true;
startServiceBtn.Click += startServiceBtn_Click;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(71, 52);
label2.Name = "label2";
label2.Size = new Size(56, 17);
label2.TabIndex = 32;
label2.Text = "服务名称";
//
// startOrStopServiceTbox
//
startOrStopServiceTbox.Location = new Point(140, 49);
startOrStopServiceTbox.Name = "startOrStopServiceTbox";
startOrStopServiceTbox.Size = new Size(259, 23);
startOrStopServiceTbox.TabIndex = 31;
startOrStopServiceTbox.Text = "EI_Image_Viewer";
//
// tabPage2
//
tabPage2.Controls.Add(startBakBtn);
tabPage2.Controls.Add(bakPublishPath);
tabPage2.Controls.Add(label5);
tabPage2.Controls.Add(bakDbName);
tabPage2.Controls.Add(label4);
tabPage2.Controls.Add(bakPathTBox);
tabPage2.Controls.Add(label3);
tabPage2.Location = new Point(4, 26);
tabPage2.Name = "tabPage2";
tabPage2.Padding = new Padding(3);
tabPage2.Size = new Size(620, 657);
tabPage2.TabIndex = 1;
tabPage2.Text = "备份与发布";
tabPage2.UseVisualStyleBackColor = true;
//
// startBakBtn
//
startBakBtn.Location = new Point(160, 204);
startBakBtn.Name = "startBakBtn";
startBakBtn.Size = new Size(213, 53);
startBakBtn.TabIndex = 6;
startBakBtn.Text = "开始备份";
startBakBtn.UseVisualStyleBackColor = true;
startBakBtn.Click += startBakBtn_Click;
//
// bakPublishPath
//
bakPublishPath.Enabled = false;
bakPublishPath.Location = new Point(117, 125);
bakPublishPath.Name = "bakPublishPath";
bakPublishPath.Size = new Size(474, 23);
bakPublishPath.TabIndex = 5;
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(6, 128);
label5.Name = "label5";
label5.Size = new Size(104, 17);
label5.TabIndex = 4;
label5.Text = "发布程序备份路径";
//
// bakDbName
//
bakDbName.Enabled = false;
bakDbName.Location = new Point(114, 28);
bakDbName.Name = "bakDbName";
bakDbName.Size = new Size(474, 23);
bakDbName.TabIndex = 3;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(20, 31);
label4.Name = "label4";
label4.Size = new Size(68, 17);
label4.TabIndex = 2;
label4.Text = "备份数据库";
//
// bakPathTBox
//
bakPathTBox.Enabled = false;
bakPathTBox.Location = new Point(115, 75);
bakPathTBox.Name = "bakPathTBox";
bakPathTBox.Size = new Size(474, 23);
bakPathTBox.TabIndex = 1;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(6, 79);
label3.Name = "label3";
label3.Size = new Size(92, 17);
label3.TabIndex = 0;
label3.Text = "数据库备份路径";
//
// groupBox5
//
groupBox5.Controls.Add(netCorePublishBtn);
groupBox5.Controls.Add(vuePublishBtn);
groupBox5.Location = new Point(10, 24);
groupBox5.Name = "groupBox5";
groupBox5.Size = new Size(630, 129);
groupBox5.TabIndex = 41;
groupBox5.TabStop = false;
groupBox5.Text = "测试环境重新发布";
//
// netCorePublishBtn
//
netCorePublishBtn.Enabled = false;
netCorePublishBtn.Location = new Point(351, 50);
netCorePublishBtn.Name = "netCorePublishBtn";
netCorePublishBtn.Size = new Size(128, 40);
netCorePublishBtn.TabIndex = 40;
netCorePublishBtn.Text = "后端发布";
netCorePublishBtn.UseVisualStyleBackColor = true;
netCorePublishBtn.Click += netCorePublishBtn_Click;
//
// vuePublishBtn
//
vuePublishBtn.Enabled = false;
vuePublishBtn.Location = new Point(91, 50);
vuePublishBtn.Name = "vuePublishBtn";
vuePublishBtn.Size = new Size(128, 40);
vuePublishBtn.TabIndex = 39;
vuePublishBtn.Text = "前端发布";
vuePublishBtn.UseVisualStyleBackColor = true;
vuePublishBtn.Click += vuePublishBtn_Click;
//
// PublishForm
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1131, 1074);
Controls.Add(groupBox5);
Controls.Add(tabControl1);
Controls.Add(groupBox3);
Controls.Add(groupBox1);
@ -429,12 +471,13 @@
groupBox3.ResumeLayout(false);
tabControl1.ResumeLayout(false);
tabPage1.ResumeLayout(false);
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
tabPage2.ResumeLayout(false);
tabPage2.PerformLayout();
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
groupBox5.ResumeLayout(false);
ResumeLayout(false);
}
@ -473,5 +516,8 @@
private Label label5;
private GroupBox groupBox4;
private Button startBakBtn;
private GroupBox groupBox5;
private Button netCorePublishBtn;
private Button vuePublishBtn;
}
}

View File

@ -12,6 +12,7 @@ using System.Management.Automation.Runspaces;
using System.Security;
using System.Diagnostics;
using System.Net;
using Renci.SshNet;
namespace PublishSite
{
@ -22,6 +23,18 @@ namespace PublishSite
InitializeComponent();
}
public string CurrentEnv = "Local";
public string Host = "";
public string UserName = "";
public string Password = "";
private void PublishForm_Load(object sender, EventArgs e)
{
string remoteComputerName = "123.56.94.154"; // 远程计算机名称
@ -41,9 +54,116 @@ namespace PublishSite
}
#region 服务的创建与删除
private void createService_Btn_Click(object sender, EventArgs e)
{
}
private void deleteService_Btn_Click(object sender, EventArgs e)
{
}
private void selectPathBtn_Click(object sender, EventArgs e)
{
}
#endregion
#region 测试环境发布
private void vuePublishBtn_Click(object sender, EventArgs e)
{
using (var client = new SshClient("123.56.94.154", "Administrator", "WHxckj2019"))
{
// 连接到远程服务器
client.Connect();
//&& ./IRaCIS_Vue_Web.bat
string command = $@"cd C:\Users\Administrator\VueSourceCode && npm i && npm run build";
using (var cmd = client.CreateCommand(command))
{
Console.WriteLine("开始执行");
Console.WriteLine(command);
var output = cmd.Execute();
Console.WriteLine(output);
var output3 = cmd.Execute($@"xcopy /Y /Q ""C:\Users\Administrator\VueSourceCode\dist\index.html"" ""D:\Develop\PublishSite\IRaCIS.Vue.Web\dist\""");
Console.WriteLine(output);
Console.WriteLine("发布成功");
}
// 断开SSH连接
client.Disconnect();
}
}
private void netCorePublishBtn_Click(object sender, EventArgs e)
{
using (var client = new SshClient("123.56.94.154", "Administrator", "WHxckj2019"))
{
// 连接到远程服务器
client.Connect();
//&& ./IRaCIS_Vue_Web.bat
string command = $@"cd C:\Users\Administrator\bat\ && ./IRaCIS_Core_API.bat";
using (var cmd = client.CreateCommand(command))
{
Console.WriteLine("开始执行");
Console.WriteLine(command);
var output = cmd.Execute();
Console.WriteLine(output);
Console.WriteLine("发布成功");
}
// 断开SSH连接
client.Disconnect();
}
}
#endregion
#region 服务的启动与停止
private void startServiceBtn_Click(object sender, EventArgs e)
{
}
private void stopServiceBtn_Click(object sender, EventArgs e)
{
}
#endregion
}
}

View File

@ -45,6 +45,7 @@
<PackageReference Include="Microsoft.PowerShell.Commands.Utility" Version="7.2.10" />
<PackageReference Include="Microsoft.PowerShell.ConsoleHost" Version="7.2.10" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.2.10" />
<PackageReference Include="SSH.NET" Version="2020.0.2" />
<PackageReference Include="System.Management.Automation" Version="7.2.10" />
</ItemGroup>