I am building a nuget package from a new-format-csproj project. I included the EmbedAllSources property (see below) in my csproj file:
...
<PropertyGroup>
<!-- Omitted for brevity -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<EmbedAllSources>true</EmbedAllSources>
<!-- Omitted for brevity -->
</PropertyGroup>
...
Is it possible that consumers of my nuget, retrieve/reconstruct the source code of my nuget because of that property? If so, how?
Yes.
Running this with dotnet core 3.1.201 and a minimal test project, I end up with a .nupkg
and a .symbols.nupkg
in the output folder. These files are just zips, so unzip them in any way you like. The .symbols.nupkg
file contains the .pdb
file under /libs/{framework}/
. I didn't even try to do anything clever... just chucked it into notepad++ and you can see clearly that all the relevant source is in there. Extracting it into individual .cs
files will take a bit more effort, but not too much more.