Recently I stumbled upon a NuGet using the google search for something I wanted to try, sadly the projects code was no longer available on GitHub, the project was gone, but the NuGet was up and available.
So I thought, what if I'd like to work on this certain project/NuGet how can I get the source code..
- Download the .nupkg file of the project
- Use an archive tool like WinRAR or 7-Zip to open the .nupkg
- Open the "lib" folder, now the folder lists folders like:
- net5.0
- net6.0
- net45
- net46
- net47
- netstandard1.0
- netstandard1.3
- netstandard2.0
- netstandard2.1
If you need Net-Core, you would open netX.0,
if you need Net-Framework, you open netXX
and if you need Net-Standard assemblies, then you open netstandardX.X
- When selected the needed net version open the folder, eg. net6.0 and copy the .dll file (and XML if available to be sure) to a folder of your choice.
- Download https://github.com/icsharpcode/ILSpy/releases/tag/v7.2.1, to get the source code of the .dll
- Open ILSpy, click "File", "Open" then select the .dll and wait for it to finish analyzing.
- Then you can either click through the decompiled assembly or you right-click the assembly entry and click "Save Code..."
- Finished, if the project had everything it needed inside itself you should be good now you're able to open the .csproj and work with it.
This manual can't be used for every project or NuGet, because not every project/NuGet is published the same way. This worked for a few projects I tried this on, very big or very complex projects with many dependencies may not work that easy.
This publication is provided as is without any express or implied warranties.
While every effort has been taken to ensure the accuracy of the information contained in this publication, the authors/maintainers/contributors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
The contents of the articles below might be totally inaccurate, inappropriate, or misguided.
There is no guarantee as to the suitability of said source code, executable scripts, circuits and other information, for any purpose whatsoever other than as a self-training aid.
In the event of judicial ruling to the contrary, any liability shall be limited to the sum charged on you by us for the aforementioned publication or nothing, whichever is the lower.
I will not be held responsible for any damages or costs which might occur as a result of my advice or designs.