c# - #if 调试 --> #if myOwnConfig?

标签 c# visual-studio debugging buildconfiguration buildconfig

有没有办法在 Visual Studio 中使用像“#if DEBUG”这样的自定义配置

我需要一个“#if OFFLINE”,因为我的 Build-Config 的名称是“Offline”(也仅用于进一步的调试目的)...

谢谢!

最佳答案

是的,这是可能的。

说明:

  1. Build -> Configuration manager -> Active solution configuration -> New...
  2. 创建一个名为:Offline 的新配置。
  3. 项目 -> 属性 -> 构建 -> 配置 -> 离线.
  4. 条件编译符号,类型:OFFLINE
  5. 保存项目。
  6. 重新启动 Visual Studio(重新加载项目是不够的)。

关于c# - #if 调试 --> #if myOwnConfig?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18441299/

相关文章:

android - 应用程序个人文件夹路径在哪里

c# - 使用异步和 UWP 进行异常调试

c# - 在 MVC 中日期时间?不工作

c# - 如何在不等待的情况下等待异步操作的结果?

c# - 单击 "OK"按钮时 Modalpopupextender 关闭

c++ - : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [40]'

c# - 装饰通用注册的子集

c# - 来自 Visual Studio 2017 的 Azure 函数调试连接出现 'N/A' 监听器连接错误

javascript - 在 VS Code 中调试 Node 时出现 "Error: Set breakpoints request timed out"

debugging - !dumpstack 和 k 的原生框架之间的差异