简体   繁体   中英

Step through code in a referenced solution

Usually when I want to debug a nuget package I download the source code and add the .csproj file to my solution and add a project reference instead of using the nuget package. This lets me step through the code and see what is going on with my live project.

I have a nuget package I want to debug but it is very large. I downloaded the source code and the solution has around 20 projects in it. I tried just adding a few of them but ended up with lots of dependency issues.

Is there a way I can tell visual studio that the source code for the nuget package exists on my HD so I can step through it without having to add 20 projects to my current solution? Or perhaps some way to add a reference to the entire solution?

My goal here is to be able to set breakpoints so when the third party compiled code executes I can step through it and see what is going on. What is best way to do this?

在此输入图像描述 Assuming the application is .NET 4.7.2. You could try dnSpy which allows you to debug & edit a built executable/dll.

GitHub Page: https://github.com/0xd4d/dnSpy

Latest Release: https://github.com/0xd4d/dnSpy/releases/download/v5.0.0/dnSpy.zip

Once downloaded

  • Start up dnSpy.exe for 64-bit or dnSpy-x86.exe for 32-bit applications.
  • Use File->Open to locate your exe's and dll files.
  • Apply your breakpoints within dnSpy.
  • Hit start as you would in Visual Studio

Emcrank has very interesting solution for not having the source code but it wasn't right for me.

The answer for me was actually very simple. When going to add existing project you can change dropdown to add a .sln file. I created a folder then added the solution to it and it pulls everything in with single transaction and now I can easily debug all the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM