I am wanting to get the source code (for debugging purposes) of an open source library I am wanting to know whether:
a) this is a configuration matter for the client project and I could reconfigure the project to fetch the source instead of just the binary.
b) this is a configuration for the library matter I would need to fork and repackage or find a source code version to get the source code.
c) this is not possible within the nuget system for one reason or another.
NuGet's client, nuget.exe is a free and open-source, command-line app that can both create and consume packages.
NuGet provides the tools developers need for creating, publishing, and consuming packages. Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.
Note that the source URL for nuget.org is https://api.nuget.org/v3/index.json .
If the authors of the NuGet package publish symbol and source packages (to nuget.smbsrc.net
), these can be downloaded via "SourceLink" in VS (Enabled via Options > Debugging > General > Enable source server support). This needs to be done by the authors when publishing packages. See the documentation for details.
There are other options in Visual Studio 2017 (!) if the NuGet package uses SourceLink v2 - which embeds source information into the .pdb
file (which need to be included in the main NuGet package). This allows to either embed all the sources into the pdb
file or link to a public git repository (e.g. GitHub). See https://github.com/ctaggart/SourceLink for more details.
However, if the author of your package did not implement any of these strategies, you're out of luck. (and maybe use VS-integrated decompiler like available in ReSharper)
Can Nuget be used to get the source code of an open source library?
As far as I can tell, it depends on whether the author has uploaded the NuGet package publish symbol. But not every package owners wants to share the code with others, so NuGet only delivers the binaries and does not design a workflow for source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With