如何从 Teamcity 构建步骤在 Windows 服务器的后台运行 Dotnet

Mec*_*h0z 5 powershell teamcity asp.net-core

在 Teamcity 上运行的集成测试中,我试图

  • 使用 dotnet run 启动 ASPNET Core 应用程序
  • 运行集成测试
  • 停止网络服务器

使用powershell,然后我尝试使用

start-job -name someName -scriptblock {dotnet run}
Run Code Online (Sandbox Code Playgroud)

但这只是给了我

16 someName BackgroundJob Completed True localhost dotnet run

但是网络服务器没有运行并且没有错误输出

是否有另一种使用 dotnet 命令在后台启动 kestrel 服务器的方法?

Mec*_*h0z 3

找到了解决方案

但改用网络服务器的编译版本而不是 dotnet run

这样做是为了启动我的网络服务器构建步骤

Start-Process .\someName.exe -NoNewWindow -PassThru
Run Code Online (Sandbox Code Playgroud)

运行测试

并以此结束它

Stop-Process -name YourServiceName
Run Code Online (Sandbox Code Playgroud)

作品