The recently-released .NET tooling seem to have support for embedding C# in PDBs, which should improve the experience of stepping into third-party, etc. Running csc /?
Looks like the roslyn task should support them via the EmbeddedFiles Item Group, by adding this to your .csproj:
<Target Name="EmbedSources" BeforeTargets="CoreCompile">
<ItemGroup>
<EmbeddedFiles Include="@(Compile) " />
</ItemGroup>
</Target>
... which is basically what the /embed option does.
You probably need to also provide a SourceLink json file, to wire up the sources in the PDB, not sure that happens automatically.
There's now a proper MSBuild EmbedAllSources property:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<EmbedAllSources>true</EmbedAllSources>
[...]
From what I observed locally, it behaves the same as the mentioned EmbedFiles
target.