我为我的一个库创建了一个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从那里得到我的注释.
我们的代码库中有很多StringBuilder.AppendFormats,它们的字符串以换行符结尾。我制作了一个名为AppendLineFormat的扩展方法,并希望使用Resharper的“自定义模式”功能来识别和修复那些使用新扩展方法的旧调用(并在将来向其他人推荐这种新扩展方法)。
StringBuilder sb = new StringBuilder();
int i = 1;
sb.AppendFormat("i is {0}\r\n", i);
Run Code Online (Sandbox Code Playgroud)
进入
sb.AppendLineFormat("i is {0}", i);
Run Code Online (Sandbox Code Playgroud)
有没有办法使用正则表达式(替换)来识别匹配的字符串?我不想将每个AppendFormat都转换为AppendLineFormat-仅是那些以\ r \ n结尾的字符串。这是到目前为止我得到的。
搜索模式:
$sb$.AppendFormat($newLineString$,$args$)
Run Code Online (Sandbox Code Playgroud)
替换图案:
$sb$.AppendLineFormat($newLineString$,$args$)
Run Code Online (Sandbox Code Playgroud)
哪里
"(.*)\\r\\n"(完全错误,我知道)