Embedding C# sources in PDB with new csproj

旧城冷巷雨未停 提交于 2019-12-01 06:52:54

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!