I’m trying to write a sample build server in .net just for learning purpose and sharpening my skills.
Question:
Are there options apart from launching external process?
Does the application just launch dotnet build command as a process?
If you want it to do a build of a .NET Core / .NET 6 application, sure. Generally this is configurable and it's not uncommon for them to install the dependency as part of the build now so whoever installs the application doesn't have to rely on installing the tools manually.
Should I just launch git command as a process to download source code? Given, code resides in got only.
It's either that or embed a Git library into your application and figure out how to call it. Info here.
Are there options apart from launching external process?
An application that acts as a build server just calls other tools in another process usually. You can embed some libraries and try to code some features yourself, but I would rely on calling those tools from your application. The point of a build server is for the steps to be replicable.
You want a series of steps that can be reproduced on another machine and produce the same results. Different versions of your application (for the most part) shouldn't end up with different results and they won't assuming you're relying on the external tools themselves. Doing this allows you to have feature parity with what a developer would do on their local machine running the commands.