c# - .NET / Visual Studio 从代码发布 WebApp(自动化)
问题描述
我有一个控制台应用程序设置,您可以在其中传递项目目录以及您想要从 git 获得的分支,它将检查出来。签出后,我希望我的代码自动从该应用程序目录中的发布配置文件发布应用程序。
这背后的原因是有时我需要将某个票证/分支推送到我们的测试站点,它是一个皮塔饼,以停止我正在做的检查分支的操作,在 Visual Studio 中打开它并完成发布过程。
我很困惑从哪里开始,因为我在谷歌上没有找到任何有用的东西。在 C# 代码中自动化发布过程的任何帮助都会很有用。
伪代码
static void Main(string[] args)
{
string directory = args[0];
string branch = args[1];
using (PowerShell powershell = PowerShell.Create())
{
powershell.AddScript($"cd {directory}");
powershell.AddScript(@"git checkout " + branch);
Collection<PSObject> results = powershell.Invoke();
}
// Go to the directory and publish the webapp from publish profile
}
解决方案
推荐阅读
- javascript - JavaScript 中的 setTimeout() 是同步的还是异步的?
- python - 在 seaborn 中的特定位置画一条线/注释 Facetgrid
- wordpress - 使用 web.config 文件从 example.com/index 简单重定向到 example.com
- php - Laravel:插入 tarificationtache 的代码(语法错误或访问冲突)
- java - 使用纯 Java 将文件上传到 Nexus
- android - 创建 CardView,将其cornerRadius 应用于其中的 ImageView
- mongodb - mongo db 一直在等待端口 27017 上的连接
- c# - 控件的声明方法有哪些区别
- mamp-pro - Mamp Pro 5 上的遥控器
- spring - Spring Framework 4 EOL 何时结束?