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

萝らか妹 提交于 2019-12-05 04:42:57

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.

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.

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.

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