How to step into a Dll ?

P

Peter

I write some codes and compiled them into a DLL file,also I have a project
to reference the dll. They can work fine. Now I want to add some functions
to the DLL and debug it, but I can't step into the DLL source line.

Anyone can help me? Thanks in advance.

Peter
 
H

Herfried K. Wagner [MVP]

Peter said:
I write some codes and compiled them into a DLL file,also I have a project
to reference the dll. They can work fine. Now I want to add some functions
to the DLL and debug it, but I can't step into the DLL source line.


Add an EXE project to the solution, reference the DLL project and start
debugging for the EXE project. In addition, take a look at "Project" ->
"Properties" -> "Configuration settings" -> "Debugging".
 
M

Mythran

Herfried K. Wagner said:
Add an EXE project to the solution, reference the DLL project and start
debugging for the EXE project. In addition, take a look at "Project" ->
"Properties" -> "Configuration settings" -> "Debugging".

Another way to step into a DLL assembly would be to open up it's project
settings and change the output type to Console Application. Then add a
Public Shared Sub Main() method to it. Create an instance of the class
inside the Main method and call the methods you wish to test. This may take
a bit longer to do, but doesn't require you to add another project. Also,
you will have to reset those changes prior to releasing it...because it will
be compiling to a .exe and not a .dll :)

HTH,
Mythran
 
P

Phill. W

Peter said:
I write some codes and compiled them into a DLL file,also I have a project
to reference the dll. They can work fine. Now I want to add some functions
to the DLL and debug it, but I can't step into the DLL source line.

For a "local" DLL (one that doesn't get added to the Global
Assembly Cache), change the "Start Action" [Project] settings to run
a program that /uses/ your DLL. Add breakpoints to the DLL code
and run ...

For a DLL that /does/ go in the G.A.C. (like most of mine), the
same principle applies, but you have to remember to re-"register"
the DLL in the G.A.C. after every build.

HTH,
Phill W.
 
W

wooster11

Since you already have a project that you're running and have made
changes to your DLL, you'll just want to rebuild your DLL in Debug
mode. After that, make sure that your other project that references
this DLL, get's a reference to the Debug version. Tip: If you have
the Copy Local property set to true on this reference, simply change it
to False, then change it back to True. This will tell Visual Studio to
get a new copy of that DLL. It will now have the Debug version, and
you can step into any method of that DLL.
 
P

Peter

Now I can debug my Dll source line by seting the DLL project's "Start
Action" to use my Exe project. Thank you,I'm proud of you.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top