My use case is that with one piece of code run as .exe.
, say A
project, I need to execute another C# executable, say B
project, which is being developed simultaneously. The B
project execution is handled with the Process
.NET type.
This is how the B
project is executed
public override string Run(string executablePath)
{
Process environmentProcess = new Process();
string inputPath = GetInputPath();
string inputFormat = GetInputFormat();
string outputPath = GetOutputPath();
GenerateOptions(inputPath, inputFormat);
string args = string.Format("-i \"{0}\" -f {1} -o \"{2}\"", inputPath, inputFormat, outputPath);
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = executablePath,
Arguments = args
};
environmentProcess.StartInfo = startInfo;
environmentProcess.Start();
environmentProcess.WaitForExit();
return GetOutput(outputPath);
}
To run the solution, I simply hit F5 and that runs A
with the debugger attached and the A
process in turn executes B
What I want to achieve is to automate the process of attaching the debugger to the B
process. I know of System.Diagnostics.Debugger.Launch();
, yet this creates a whole new VS instance to attach debugger to. I want it almost exactly this way, except that I want to be able make B
attach to the existing instance of Visual Studio and its debugger.
Is it even possible?