Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...