This is not a valid location for a breakpoint

后端 未结 4 2251
梦毁少年i
梦毁少年i 2021-02-13 03:44

I am trying to put a breakpoint on below mentioned page in my ASP.Net MVC 2 application\'s .ascx or .aspx files in Visual Studio 2010. But it won\'t let me, it shows:

4条回答
  •  不思量自难忘°
    2021-02-13 04:09

    This problem will happen if you are using Asp.Net Mvc 5 in Visual Studio 2012, but have not installed the proper tooling. For me, this happened because I upgraded my version of Asp.Net Mvc 4 to version 5 via Nuget. However, this did not install the tooling in VS 2012 so that the IDE can properly parse and handle the .cshtml files. Thus none of the razor code showed up as valid C#, and it was impossible to set any breakpoints (with the error "this is not a valid location for a breakpoint" if you try to set it).

    The solution is to install the proper tooling. (or direct link) Once I installed the tooling and restarted VS, I was able to happily set breakpoints in .cshtml files once more.

提交回复
热议问题