使用新的csproj将C#源代码嵌入PDB中 [英] Embedding C# sources in PDB with new csproj

查看:69
本文介绍了使用新的csproj将C#源代码嵌入PDB中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近发布的.NET工具似乎支持在PDB中嵌入C# ,这应该可以改善进入第三方等的体验.运行csc /?,我可以清楚地看到/embed选项:将所有源文件嵌入PDB中."

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 /?, I can clearly see the /embed option: "Embed all source files in the PDB."

但是,似乎没有任何方法可以在csproj中进行指定.而且,似乎没有任何规定可以将任意开关传递给编译器,而我将使用它们手动传递/embed.

However, there doesn't seem to be any way to specify this in csproj. What's more, there doesn't seem to be any provisions for passing arbitrary switches to the compiler, which I would use to manually pass /embed.

谁能确认我没有错过任何东西,并且目前缺少对/embed的构建支持?是否有问题(如果没有的话)?任何建议的解决方法也将不胜感激.

Can anyone confirm that I haven't missed anything and that build support for /embed is currently lacking? Is there an issue for this (and if not where would it go)? Any suggested workaround would be appreciated too.

推荐答案

现在有了适当的MSBuild c1>属性:

There's now a proper MSBuild EmbedAllSources property:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <EmbedAllSources>true</EmbedAllSources>
    [...]

从我在本地观察到的结果来看,它的行为与提到的EmbedFiles目标相同.

From what I observed locally, it behaves the same as the mentioned EmbedFiles target.

这篇关于使用新的csproj将C#源代码嵌入PDB中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆