c# - Debug.Assert 出现在 Release模式

标签 c# visual-studio-2008

我们都知道Debug.Assert在release模式下编译时不会被编译成dll。但出于某种原因,Debug.Assert did 出现在我编写的组件的发布版本中。我怀疑我可能弄乱了我的 csproject 设置。

知道为什么 Debug.Assert 出现在 Release模式中吗?

P/S:在问这个问题之前,我已经仔细检查以确保我确实是在 Release模式下编译的。

注意 2:我仔细检查了我的 csproject,发现在 Release 配置中,Define DEBUG constant 没有被勾选,这表明对于这部分我的设置是正确的。

最佳答案

检查 DefineConstants项目文件中的属性,它应该是:

  • <DefineConstants>DEBUG;TRACE</DefineConstants>用于调试配置
  • <DefineConstants>TRACE</DefineConstants>用于发布配置

检查您是否没有任何 #define DEBUG在您的代码中。

关于c# - Debug.Assert 出现在 Release模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3021538/

相关文章:

c# - 如何在 Unity3D 项目上启用 C# 7 功能

c# - 使用 Entity Framework Core 访问 MySql

c++ - 在 Vista x64 上使用 PrintDlg 不起作用,在 32 位和 XP 上工作正常

c++ - vc90 上的 jsoncpp?

c# - 连载问题

c# - Entity Framework 代码优先 : How can I create a One-to-Many AND a One-to-One relationship between two tables?

visual-studio-2008 - Visual Studio 无法将报告部署到 MSRS

c++ - 如何重播 quickfix 日志

c# - 如何在 C# System.Net.Mail.MailMessage 中创建多行正文

c# - MSBUILD 与 VS2008 构建之间的差异