R#6 - Suggests “Use directory” in razor views. How

2019-04-25 09:27发布

I am using R#6 and when I edit some razor views, R#6 suggests that I "use directory".

(Whine :)) I dont want to! How do I turn off this annoyance? I have searched through R#6 options. It is definitely R# since the annoyance goes away when i suspend R#.

In the printscreen, R# wants to change /SignUp to ../Signup.

It is incorrect because the view is the layout and could be in any directory structure. So i want it to be /Signup

enter image description here

Solution: As derigel states. Wait for the warning to show. Hit escape. Then CTRL+Enter. A mini menu appears where you can suppress or change the warning severity. I changed the warning severity to "do not show"

3条回答
太酷不给撩
2楼-- · 2019-04-25 09:51

I solved it by properly entering the path.

Original

    <Image Source="Images\Q_hor_pos_full_rgb.gif" Height="76" Margin="6,-3,0,7" HorizontalAlignment="Left"/>

It turns out that I had placed this xaml file in a subfolder, and that the Images folder was actually one level higher:

  • Main\Images\Q_hor_pos_full_rgb.gif
  • Main\UserControls\File.xaml

Fixed

    <Image Source="..\Images\Q_hor_pos_full_rgb.gif" Height="76" Margin="6,-3,0,7" HorizontalAlignment="Left"/>

As soon as I did that, the application found the file with no problem.

查看更多
一纸荒年 Trace。
3楼-- · 2019-04-25 10:01

Valamas, OffBySome gave you really good advice, but you still able to disable this warning locally by comment or generally, at all. It's some UI problem here - first, press escape to disable popup, and then, press alt+enter and you will bring few options how to disable this warning.

查看更多
Evening l夕情丶
4楼-- · 2019-04-25 10:13

For your url's, try using relative urls by using @Url.Content("~/images/image.jpg") and @Url.Action("Action", "Controller") instead of hard-coding the absolute / urls. I think this will resolve the Resharper issue, and also make your url's relative in case you are hosting this as a subsite on an IIS instance.

查看更多
登录 后发表回答