Search code examples
.net.net-corecakebuild

Using Cake, start a process in a new window


I am trying to use Cake to build my application and start it. I can get it to start one process, but I want to start multiple processes in separate windows. For example, I would like to start my API server and web server in separate powershell windows.

Here is an example of what I have tried

Task("run-api")
.Does(() => 
{
    var path = root + File("api\\src\api.fsproj");
    DotNetCoreRun(path);
});

OR

Task("run-api")
.Does(() => 
{
    var settings = new PowershellSettings 
    {
        WorkingDirectory = root + Directory("api\\src\\")
    };

    StartPowershellScript("dotnet run api.fsproj", settings);
});

Both of these just start the process in the current window. I don't see anything in the documentation to specify a new window.


Solution

  • This works, but its just normal .NET base class libraries. Is there any Cake addin that does this?

    Task("run-api")
    .Does(() => 
    {
        var info = new ProcessStartInfo
        {
            FileName = "dotnet",
            Arguments = "run api.fsproj",
            WorkingDirectory = (root + File("api\\src\\")).ToString()
        };
    
        Process.Start(info);
    });