2010-12-22 53 views
2

如果我有以下代码...ReSharper的 - 条件编译XML注释错误

#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压制,但大多数不能。有没有办法解决?

+1

另请参见:http://youtrack.jetbrains.net/issue/RSRP-181007 – AakashM 2010-12-22 08:46:31

回答

1

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

我暂停了Resharper,如果我没有先定义它,Visual Studio就不能使用find引用(shift F12)来获取代码。

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

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

如果您可以在全局范围内定义此指令,那将会很好。

+0

有趣......它适用于#if PocketPC,但不适用于#else: - \ – Damien 2010-12-22 05:53:03