Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

c# - View does not refresh after change

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:

  • 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. I see there are many similar questions, none of the answers, however, seem to fix my problem.

Update

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

  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 'blalala':css.
  4. Then I implement it.
  5. Save, Ctrl+F5 in Firefox. The error persists.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...