Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Nuget be used to get the source code of an open source library?

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.

like image 416
DSUK Avatar asked Jun 13 '17 07:06

DSUK


People also ask

Are NuGet packages considered open-source?

NuGet's client, nuget.exe is a free and open-source, command-line app that can both create and consume packages.

What is the use of NuGet library?

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.

What is the source for NuGet?

Note that the source URL for nuget.org is https://api.nuget.org/v3/index.json .


2 Answers

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)

like image 177
Martin Ullrich Avatar answered Oct 12 '22 10:10

Martin Ullrich


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.

like image 20
Leo Liu-MSFT Avatar answered Oct 12 '22 11:10

Leo Liu-MSFT