2

如果我有以下代码...

#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 抑制这些,但大多数情况下它们不能。有没有办法解决?

4

1 回答 1

1

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

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

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

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

如果您可以全局定义此指令,那就太好了。

于 2010-12-22T05:40:23.910 回答