简体   繁体   English

Visual Studio 2010 认为它处于调试模式(但它设置为发布模式)

[英]Visual Studio 2010 Thinks it's in Debug Mode (but it's set to Release mode)

I have verified in the project properties and solution properties, configuration manager, that my solution and project are set to x64 Release.我已在项目属性和解决方案属性、配置管理器中验证,我的解决方案和项目已设置为 x64 版本。 The output path is "bin\\x64\\Release\\".输出路径是“bin\\x64\\Release\\”。

I have the following in app.xaml.cs (it's a C# WPF application), which was working shortly ago:我在 app.xaml.cs(它是一个 C# WPF 应用程序)中有以下内容,它不久前正在工作:

#if (!DEBUG)
        Mouse.OverrideCursor = Cursors.None;
#endif

Currently, in Release mode, the middle line is grayed out.目前,在Release 模式下,中间线是灰色的。 Removing the "!"删除“!” restores it.恢复它。

When running, in Release mode, the mouse cursor is not hidden, and this section is seeminly skipped over.运行时,在Release模式下,鼠标光标没有隐藏,这部分似乎被跳过了。

Visual Studio, in another project, works well and fine with Debug vs. Release modes.在另一个项目中,Visual Studio 在调试与发布模式下运行良好。 Has anyone seen this behaviour, and does anyone have any ideas on how to fix it?有没有人见过这种行为,有没有人对如何解决它有任何想法?

Check your constant definitions, DEBUG can be turned on even for release configuration检查您的常量定义,即使是发布配置也可以打开 DEBUG

Right click on the project, select properties, on the Build sheet in the general section make sure the "Define DEBUG constant" box is not checked.右键单击项目,选择属性,在常规部分的构建表上确保未选中“定义调试常量”框。

"Debug" and "Release" mode are just two different configurations that are created by default by Visual Studio. “调试”和“发布”模式只是 Visual Studio 默认创建的两种不同配置。 There are a number of settings for each configuration set when they are created, but all of them can be changed manually.每个配置集在创建时都有许多设置,但所有这些都可以手动更改。 You can change whether or not the compiler will compile the project with debugging information, whether optimizations are enabled, and whether or not the DEBUG precompiler directive is defined .您可以更改编译器是否使用调试信息编译项目、是否启用优化以及是否定义了 DEBUG 预编译器指令 It would seem that the debug derictive was defined on your Release build.似乎调试派生词是在您的发布版本中定义的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM