Debugging a modular application

So you’re working on a modular application and you’ve got individual modules in seperate solutions. You can’t currently hit F5 to debug these modules as they’re just a class library. What do you do?

It’s nice and easy, all you need to do is setup a Post Build Event script and change the Debugger options. Follow these easy steps:

1. Open the Build Events tab in the Project properties.
2. Edit the PostBuild script so that it copies the Projects DLL and PDB files to the location of the application you’re extending. A basic Post Build Event to do this would look like so:

if $(ConfigurationName) == “Debug” xcopy “$(TargetPath)” “C:\Program\MyApp” /i /y

if $(ConfigurationName) == “Debug” xcopy “$(OutDir)MyDll.pdb” “C:\Program\MyApp” /i /y

3. Save the Post Build script
4. Open the Debug tab in the Project properties.
5. Set the Start External Program to the absolute path of the exe you’re extending, e.g. “C:\Programs\MyApp\App.exe”.
6. Set the Working Directory to the directory containing the application your extending “C:\Programs\MyApp”. Save.

Now when you hit F5 the DLLs and PDBs are copied to the directory, and the target application is run up for your debugging pleasure.

This entry was posted in Debugging, Visual Studio. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s