Debugging into a Project instead of its DLL

Debugging into a Project instead of its DLL

I have a solution with a handful of projects, and need to set a breakpoint on one of the shared libraries. The source for that project is included in the branch, but does not appear in the Visual Studio (2017) Solution.

I thought I could simply add that project to the solution and debug into it, but it seems like Visual Studio may still be using the DLL.

Are there any configurations needed in order to debug? Do I need to remove the reference to the DLL?

newbiewebSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ares KurkluSoftware EngineerCommented:
That may be one way of doing it, If you loaded the project which the dll was created into the same project, yes you need to remove the references from the original project  and point them back to the one which the dll was created.  
But there are other ways of debugging DLLs as well.
newbiewebSr. Software EngineerAuthor Commented:
But, if I want to use the source, do I still need to point to a DLL? I guess I would compile that project and use the DLL that was created?

In the Bin folder? The Debug folder?

What other ways are there? I need to stay in Visual Studio...and I have the code, so need the comfort of breakpoints.

Also, I am having trouble finding any project which uses the one in question. Is there a trick?
Ares KurkluSoftware EngineerCommented:
So you have got the source code which generates the DLL as well ? Do i need explain how things work with DLLs?
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

newbiewebSr. Software EngineerAuthor Commented:
I have confirmed the source code does indeed build a DLL. But go ahead and explain away, since that might be what helps me get this working.

Also, in the dev environment, when I right click the type, I did get navigated to the source. So is this being read from the DLL? Can I debug into a DLL?

I see that project has a Solution, not a Project. Can a Solution be added to another Solution?
Ares KurkluSoftware EngineerCommented:
The point of DLL is to have functions that several programs can use it. Simple example if you want to create a DLL which does math calculations
you can have a function like AddNumbers which obviously adds 2 numbers you can compile and create the DLL as that project would be a client library type project.

Then if you need to use those math functions you add that DLL as reference into another source code you also include the using code like
using System.Text;
but it may be something like
using MyLibrary.Math;

Then you can use those functions.

What I am saying if you have got access to the source code of the DLL and if it is the same project  you can just point your code to use
those functions directly.
Chris StanyonWebDevCommented:
When you add a reference to your project, you have several options on how to add it. If you just have a DLL (for example from a third party), then you would browse to it, and reference it directly. As you have the source code of your assembly, you should add that project to your solution (right click the Solution and choose Add ... Existing Project. Then when you want to add a reference to your assembly in one of your solutions other projects, instead of browsing for the DLL, you will have the option to select a Project Reference and you will see your assembly in the list. You now have the source code to your assembly in your solution so you can set breakpoints directly in there. When you build and run your solution, it will automatically build the assembly as a DLL, but break on any of your break points.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
newbiewebSr. Software EngineerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.