public static Process StartDotNetProcess( [NotNull] string assemblyLocation, [NotNull] string assemblyArgs, bool detachIfMono )
{
if ( assemblyLocation == null )
throw new ArgumentNullException( "assemblyLocation" );
if ( assemblyArgs == null )
throw new ArgumentNullException( "assemblyArgs" );
string binaryName, args;
if ( IsMono ) {
if ( IsSGenCapable ) {
binaryName = "mono-sgen";
} else {
binaryName = "mono";
}
args = "\"" + assemblyLocation + "\"";
if ( !String.IsNullOrEmpty( assemblyArgs ) ) {
args += " " + assemblyArgs;
}
if ( detachIfMono ) {
args += " &";
}
} else {
binaryName = assemblyLocation;
args = assemblyArgs;
}
return Process.Start( binaryName, args );
}