me.at.coding
me.at.coding

Reputation: 17634

Add source code for frameworks/NuGet packages to Visual Studio

Given I am using framework via a NuGet package on my C# project inside Visual Studio and the source code for the framework/NuGet package is available e.g. on Github. How could I add the source code to Visual Studio, so I can browse it?

E.g. I write my own class deriving from a framework base class:

public MyClass : FrameworkClass

It compiles fine as all needed for that is given by the NuGet package. But in addition I now also want to be able to view the FrameworkClass implementation from inside Visual Studio.

Is that somehow possible, given the source code is available e.g. on Github? (it's ok for me to manually download the source code from Github and add it to Visual Studio in addition to the nuGet package, I just don't know if and how that can be done)

Upvotes: 3

Views: 2704

Answers (1)

LoLance
LoLance

Reputation: 28116

As I know VS doesn't have the option to support viewing source code of one nuget package directly in one project that consumes that package. At least during developing time(when code in text editor), this is not supported.

But if someone wants to navigate to and view source code of one nuget package during debugging time:

1.One way I once used is to put .pdb file into nuget package, and download the source files in one folder, add path of folder to Debug Source Files setting.

2.Another way is to use Source Link+ nuget way, it's supported in VS2017 and VS2019.

For more details please refer to this thread, and there's some other good workarounds there. Cheers!

Upvotes: 2

Related Questions