【问题标题】:ReSharper - Conditional Compilation XML comment errorsReSharper - 条件编译 XML 注释错误
【发布时间】:2011-05-29 05:22:13
【问题描述】:

如果我有以下代码...

#if PocketPC
        /// <summary>Indicates whether usage of the Windows Mobile 5.0+ GPS intermediate driver is allowed.</summary>
        private static bool allowGpsIntermediateDriver = true;

        /// <summary>Indicates whether the device detection thread is currently active.</summary>
        private static bool isDetectionThreadAlive;
#endif

...ReSharper 给了我“xml 注释没有放在有效的语言元素上”错误。有时可以使用#pragma 抑制这些,但大多数情况下它们不能。有没有办法解决这个问题?

【问题讨论】:

标签: c# documentation comments resharper resharper-5.0


【解决方案1】:

在您的任何 c# 代码似乎可以工作之前,将“#define PocketPC”放在 C# 文件的顶部。

我暂停了 Resharper,如果我不先定义它,Visual Studio 无法使用查找引用 (shift F12) 获取代码。

我认为这是因为 Visual Studio 无法分析定义的预处理器指令“PocketPC”,并且可能不是 Resharper 问题。

有趣的是,如果尝试使用#if DEBUG,则只有在将 Visual Studio 构建配置设置为调试时才有效。如果将构建配置更改为 Release,您将遇到 Visual Studio 无法理解 #if DEBUG 的相同问题。

如果你能全局定义这个指令就好了。

【讨论】:

  • 有趣...它适用于#if PocketPC 但不适用于#else :-\
猜你喜欢
  • 1970-01-01
  • 2021-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多