The editor uses the MSBuildPanel and calls 'BuildSolution' when the button is pressed; I can't see from a cursory glance how it does this from elsewhere but, it might just be simpler to launch a process/cli that calls msbuild (in GodotSharp), feeding it the solution file (for example, when you initialise the test).