_From @josh-endries on May 13, 2018 0:57_
I've been trying to embed source and/or PDBs into a NuGet package but can't figure it out with the new csproj files. I have a project that targets a few frameworks. I'm using VSTS, which is a whole other mess, but it doesn't work locally in VS2017 either. I used to just use <files/> in the nuspec file, but that doesn't work with the new projects, apparently, or multi-targeting at least.
Based on this page I tried to add <IncludeSource>true</IncludeSource> to my PropertyGroup but that didn't work. It did build a symbols package but that's not what I'm looking for. I also tried adding <IncludeSourceFilesProjectOutputGroup></IncludeSourceFilesProjectOutputGroup> but that didn't work either. There's no real or useful documentation on that though and I don't know what it is, it just sounded related. This whole thing is so confusing it's insane.
I just tried msbuild /t:pack /p:IncludeSource=true but that didn't do it either. The page linked above doesn't really make clear what sort of keyword they all are.
_Copied from original issue: Microsoft/msbuild#3302_
@rohit21agrawal is this supported in csproj format?
@josh-endries IncludeSource property. by design, is supposed to create a symbols nupkg that will contain all the source files within the src folder of the nupkg.
However, if that's not what you want, there are enough extension points in Pack targets to achieve what you are trying to do. Take a look at: https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#targetsfortfmspecificcontentinpackage
You can use SourceFilesProjectOutputGroup to get a list of all source files and pack it at the desired path within the package.
@mishra14 you can close this as by design , and as a question. @josh-endries can continue to engage here if he has more questions.
@rohit21agrawal Can you explain more? I'm unzipping both my nupkg and snupkg, and there is no folder named "src". I'm using the dotnet core cli version 2.2.401 inside a docker container from image "mcr.microsoft.com/dotnet/core/sdk:2.2". I run dotnet build followed by dotnet pack --include-source. I also tried dotnet msbuild /t:pack /p:IncludeSource=true /p:IncludeSymbols=true. The target framework is netcoreapp2.2.
I expect at least one of the nupkg or snupkg to contain a folder named src. I expect that folder to contain the c# source code of the classlib I'm building. Are my expectations correct? What _ought_ to be happening?
If it helps, I'm coming from a java background where packaging the source lets most IDEs navigate through dependent libs without decompiling, making it easier to read, set breakpoints, etc. I suspect I have a fundamental misunderstanding of what IncludeSource means, despite having read some of the dotnet cli and msbuild docs.
I am also having this issue adding 
Most helpful comment
@rohit21agrawal Can you explain more? I'm unzipping both my nupkg and snupkg, and there is no folder named "src". I'm using the dotnet core cli version 2.2.401 inside a docker container from image "mcr.microsoft.com/dotnet/core/sdk:2.2". I run
dotnet buildfollowed bydotnet pack --include-source. I also trieddotnet msbuild /t:pack /p:IncludeSource=true /p:IncludeSymbols=true. The target framework is netcoreapp2.2.I expect at least one of the nupkg or snupkg to contain a folder named src. I expect that folder to contain the c# source code of the classlib I'm building. Are my expectations correct? What _ought_ to be happening?
If it helps, I'm coming from a java background where packaging the source lets most IDEs navigate through dependent libs without decompiling, making it easier to read, set breakpoints, etc. I suspect I have a fundamental misunderstanding of what IncludeSource means, despite having read some of the dotnet cli and msbuild docs.