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

廉价感情. 提交于 2019-12-07 00:10:44

问题


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

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"


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/6576285/r6-suggests-use-directory-in-razor-views-how-to-disable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!