Reputation: 11827
In certain cases (like when writing URIs in XAML), ReSharper magically figures out I am writing out a relative path to a file in the current project and offers very useful smart-completion for it, and a warning if I misspell something and get it wrong, and even goes to the file if I ctrl+click it.
Can I somehow tell ReSharper to do the same when I'm typing in the parameter to MSTest's DeploymentItem attribute?
Upvotes: 3
Views: 283
Reputation: 23757
This should work through an external annotation. Open the following file:
C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\ExternalAnnotations\Visual Studio\Microsoft.VisualStudio.QualityTools.UnitTestFramework.xml
(Or whatever version of Resharper you're using.)
Add these lines inside the assembly
tag:
<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>
That tells Resharper to throw the PathReference
attribute on the path
parameter of both constructors of DeploymentItem
.
However, after testing for some time now I cannot see this attribute working on anything that I try within the C# text editor. It could be that it doesn't work for my version (7.1), but I'm a bit stumped. Perhaps someone can add to this?
Upvotes: 1