【问题标题】:Resharper External Attributes with MSTest's [DeploymentItem]使用 MSTest 的 [DeploymentItem] Resharper 外部属性
【发布时间】:2014-10-02 21:09:03
【问题描述】:

在某些情况下(例如在 XAML 中编写 URI 时),ReSharper 神奇地发现我正在写出当前项目中文件的相对路径,并为其提供非常有用的智能补全功能,并在我拼错某些内容时发出警告并且弄错了,如果我 ctrl+单击它,甚至会转到文件。

当我在 MSTest 的 DeploymentItem 属性中输入参数时,我能以某种方式告诉 ReSharper 做同样的事情吗?

【问题讨论】:

标签: c# resharper mstest


【解决方案1】:

应该通过external annotation 工作。打开以下文件:

C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\ExternalAnnotations\Visual Studio\Microsoft.VisualStudio.QualityTools.UnitTestFramework.xml

(或您使用的任何 Resharper 版本。)

assembly 标签内添加这些行:

<member name="M:Microsoft.VisualStudio.TestTools.UnitTesting.DeploymentItemAttribute.#ctor(System.String)">
    <parameter name="path">
        <attribute ctor="M:JetBrains.Annotations.PathReferenceAttribute.#ctor" />
    </parameter>
</member>
<member name="M:Microsoft.VisualStudio.TestTools.UnitTesting.DeploymentItemAttribute.#ctor(System.String,System.String)">
    <parameter name="path">
        <attribute ctor="M:JetBrains.Annotations.PathReferenceAttribute.#ctor" />
    </parameter>
</member>

这告诉 Resharper 在DeploymentItem 的两个构造函数的path 参数上抛出PathReference 属性。

然而,经过一段时间的测试,我看不到这个属性对我在 C# 文本编辑器中尝试的任何东西都有效。可能是它不适用于我的版本(7.1),但我有点难过。也许有人可以添加这个?

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多