何处复制Visual Studio可以找到的Resharper外部注释XML文件

Jua*_*uan 10 resharper visual-studio-2015 resharper-9.1

我为我的一个库创建了一个XML注释文件,并希望它可用于我的所有项目,而无需在每个项目二进制文件夹中复制它.

对于我所读到的,可以通过将其复制到Resharper安装文件夹来完成,但我尝试了一些地方但没有成功.

我已将其复制到以下文件夹中:

C:\Users\myuser\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\ExternalAnnotations\MyCompany

C:\Users\myuser\AppData\Local\JetBrains\ReSharper\vAny\vs14.0\Bin\ExternalAnnotations
Run Code Online (Sandbox Code Playgroud)

xml文件与注释的dll完全相同,但是xml扩展名.内容如下:

<assembly name="Company.Tools.Libs.Logging">
  <member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteDebug(System.String,System.Object[])">
    <attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)" />
    <argument>"format"</argument>
  </member>
  <member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteInfo(System.String,System.Object[])">
    <attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)" />
    <argument>"format"</argument>
  </member>
  <member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteWarning(System.String,System.Object[])">
    <attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)" />
    <argument>"format"</argument>
  </member>
  <member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteError(System.String,System.Object[])">
    <attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)" />
    <argument>"format"</argument>
  </member>
  <member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteFatal(System.String,System.Object[])">
    <attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)" />
    <argument>"format"</argument>
  </member>
</assembly>
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?

更新:

由于@citizenmatt说我的xml是错误的,并且参数节点需要嵌套在属性元素中.使用我用于复制问题的简单项目执行此操作使其工作,但这是通过在与dll相同的文件夹中创建外部注释并使用.ExternalAnnotation前缀.

我仍然试图找到在我的机器上复制它的位置,因此它被Resharper选中而不是沿着dll分发它.

更新2:

在与@citizenmatt讨论后,我决定沿着dll发送我的注释.他有一个很好的观点,将它添加到Resharper的安装目录上将使它们在每个新装置中消失,而且它不是一个非常直观的地方.另外,我还没能让VS从那里得到我的注释.

cit*_*att 3

如果我没记错的话,我认为它需要位于ExternalAnnotations. 您还需要关闭并重新打开您的解决方案,然后才能选择它。

您还可以将文件放在 .dll 旁边,只要它以 结尾.ExternalAnnotations.xml,例如foo.dllwould need foo.ExternalAnnotations.dll

或者,您可以在扩展中发送注释。它被打包为具有自定义文件布局的 nuget 包。您可以查看社区扩展项目以获取nuspec 文件的示例(如果您的程序集是公共程序集,您甚至可能需要添加拉取请求!)

但是,您在此处显示的示例 XML 是不正确的 - 该argument元素必须是该元素的子元素attribute。它告诉 ReSharper 如何构建应该应用的参数 - 该ctor属性为 ReSharper 提供构造函数(和类),然后我们需要将参数传递给该构造函数 - 因此每个argument元素都需要是该元素的子元素attribute。换句话说:

<member name="M:Company.Tools.Libs.Logging.Interfaces.IBasicLogger.WriteDebug(System.String,System.Object[])">
<attribute ctor="M:JetBrains.Annotations.StringFormatMethodAttribute.#ctor(System.String)">
  <argument>format</argument>
</attribute>
Run Code Online (Sandbox Code Playgroud)