【问题标题】:style cop + resharper control commentsstylecop + resharper 控件注释
【发布时间】:2010-09-29 02:30:02
【问题描述】:

这似乎是一个微不足道的问题,但是当我为 resharper 安装 stylecop 插件时,我的 cmets 被这样格式化

/// <summary>
/// Gets the gift item.
/// </summary>
/// <param name="uid">
/// The uid.
/// </param>
/// <param name="upc">
/// The upc.
/// </param>
/// <returns>
/// </returns>
Gift GetGift(long uid, string upc);

相对于

/// <summary>Gets the gift item.</summary>
/// <param name="uid">The uid.</param>
/// <param name="upc">The upc.</param>
/// <returns></returns>
Gift GetGift(long uid, string upc);

我似乎找不到任何方法来关闭这种格式。

【问题讨论】:

    标签: c# resharper stylecop


    【解决方案1】:

    如果您在 Resharper 中安装了 Microsoft Stylecop for Resharper 插件,请转到 Resharper 选项、工具,然后转到 StyleCop for Resharper。在那里,您应该会看到“使用单行声明标题”复选框。

    【讨论】:

    • 我仍然有这个描述的问题,但是 - “ReSharper 的 StyleCop 现已与 StyleCop 合并”stylecopforresharper.codeplex.com
    • 您可以从 Visual Studio 的 ReSharper 菜单中的 Extension Manager 安装 SyleCop 插件。然后,您可以从 Reharper-Options-Tools-StyleCop 管理 StyleCop 设置。
    【解决方案2】:

    试试GhostDoc。这个免费的 Visual Studio 扩展生成更好的 XML 文档 cmets。 paramreturn 标记是内联的,而 summary 标记保留在不同的行上。也许这已经适合您的需要了。

    【讨论】:

    • 我已经有了 ghost doc,但似乎 stylecop 重新格式化了 cmets
    【解决方案3】:

    如果您在“C#”类别下的默认代码清理设置中关闭“重新格式化嵌入式 XML 文档 cmets”,则可以使 GhostDoc 工作。然后在 StyleCop 部分下,关闭规则“1611:必须记录元素参数”和规则“1618:必须记录通用类型参数”。这样代码清理就不会重新破坏您的 GhostDoc cmets。请记住,代码清理选项是特定于解决方案的。

    【讨论】:

      猜你喜欢
      • 2013-03-15
      • 1970-01-01
      • 1970-01-01
      • 2011-05-29
      • 2013-03-07
      • 1970-01-01
      • 2010-10-11
      • 1970-01-01
      • 2015-03-11
      相关资源
      最近更新 更多