0

I have a project that calls the exe of the other but, I want to be able to step through both projects calling from the parent project to the child project.

I'm running VS 2012 with C#. I can open my parent project and add my 2nd solution. I can set either one as the start up project. The 1st project calls the exe of the child currently. So, somehow, I need it to call the project so I can debug it.

How do I do that?

Console.WriteLine("Setting up the StartInfo object for the ReportRunner.exe process run"); 
ProcessStartInfo startInfo = new ProcessStartInfo(); 
startInfo.FileName = @"C:\Documents\Dev\C#\ReportRunnerXLSX\ReportRunner\bin\Release\PortalReportRunner.exe"; 
startInfo.UseShellExecute = true; 
startInfo.Arguments = argies.ToString(); 
using (Process proc = Process.Start(startInfo)) 
{ 
      proc.WaitForExit(); 
}
Crono
  • 10,211
  • 6
  • 43
  • 75
  • I added it to the original post – user3434209 Mar 18 '14 at 18:00
  • 1
    Sorry, I have to ask: why do you even have to invoke the second project like this? Can't you just have a hard reference to it? – Crono Mar 18 '14 at 18:05
  • I don't know...I didn't write the original code and I'm not an expert C# developer. What other way is there to call the exe? Hard Reference? – user3434209 Mar 18 '14 at 18:07
  • You should have both projects in the same solution and add the second project as a project reference to the first one. This way you will be able to access any public types of the latter via code, *and* you will be able to debug easily. – Crono Mar 18 '14 at 18:08
  • Do I need to compile the 2nd project differently? I can add another project to the solution but when I 'Add Reference' under Solution/Projects, it doesn't see the project file. – user3434209 Mar 18 '14 at 19:55
  • Do you still need that second project as an independant executable? If not make your project a class library. – Crono Mar 18 '14 at 19:57
  • I'll try that. Not really. It was just originally developed that way.Thanks for the advice – user3434209 Mar 18 '14 at 21:36

1 Answers1

0

If possible, turn that second project into a class library and add it as a project reference to the first project. This will allow you to debug and won't require a second process running. Don't forget to expose the required functionality as public types and members.

If you still need a second, independant executable, then just create a new executable library that will also refer to the newly converted class library. This will be much cleaner this way.

Crono
  • 10,211
  • 6
  • 43
  • 75