更改后视图不刷新 [英] View does not refresh after change

查看:63
本文介绍了更改后视图不刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个令人沮丧的问题.我在剃刀视图(cshtml),Start without Debugging,刷新(Ctrl + F5)浏览器中更改了文本,但没有任何反应.奇怪的是,如果我修改控制器的返回值(例如return Ok("test");)或包含的静态文件(如CSS),则刷新后,更改可见.仅当我每次停止启动并停止调试时,剃刀视图才会更新.

I am having this frustrating problem. I change text in a razor view (cshtml), Start without Debugging, refresh (Ctrl+F5) the browser but nothing happens. The strange part is that if I modify a controller's return value (say return Ok("test");) or an included static file (like CSS), refresh, the change is visible. The razor view only updates if I stop start and stop debugging every time.

以下是我已经尝试过的东西:

Here are things I have already tried:

  • 确保已选中Detect when file is changed outside the environment.
  • On run, when projects are out of dateAlways build.
  • 在Edge,Chrome和Firefox上进行了尝试,无论是否进行了刷新.
  • 重新启动Visual Studio数字时间.
  • 清洁/重建解决方案.
  • 在新模板项目上执行此操作.
  • Made sure that Detect when file is changed outside the environment is checked.
  • On run, when projects are out of date is Always build.
  • Tried this on Edge, Chrome and Firefox with and without hard refreshing.
  • Restarting Visual Studio numeral times.
  • Cleaning/rebuilding solution.
  • Doing this on new template projects.

P.S.我看到有很多类似的问题,但没有答案,似乎可以解决我的问题.

P.S. I see there are many similar questions, none of the answers, however, seem to fix my problem.

更新

这似乎是一个更大范围的问题.如果我:

This appears to be a problem on a much larger scale. If I:

  1. 像这样的@RenderSection("css", required: true)在父视图中创建所需的剃须刀部分.
  2. 不在子视图中实现呈现.
  3. 我(显然)得到了InvalidOperationException: The following sections have been defined but have not been rendered by the page at 'bla\bla\bla':css.
  4. 然后我实现它.
  5. 保存,在Firefox中按Ctrl + F5.错误仍然存​​在.
  1. Create a required razor section in the parent view like this @RenderSection("css", required: true).
  2. Not implement the rendering in the child view.
  3. I (obviously) get the InvalidOperationException: The following sections have been defined but have not been rendered by the page at 'bla\bla\bla':css.
  4. Then I implement it.
  5. Save, Ctrl+F5 in Firefox. The error persists.

在这一点上,VS 2015实际上是不可用的,因为您不知道自己是否真的丢失了某些东西,或者是VS发挥了作用

At this point, VS 2015 is practically unusable because you don't know, if you're actually missing something or it's VS acting out

推荐答案

我以前遇到过此问题. 我的情况是我在Macbook Pro上运行Windows 10 VM Parallel,并且项目文件位于与Mac OS共享的文件夹中.

I had this problem before. My case was i run windows 10 VM Parallel on Macbook Pro, and the project files are in shared folder with mac OS.

如果有人和我一样,将项目移到非共享目录(例如C:\)将解决此问题.

Incase someone has the same case like me, move the project to non shared directory such as C:\ will fix the problem.

这篇关于更改后视图不刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆