How to set a breakpoint in a ASP.NET MVC 2 view? - asp.net-mvc

I am trying to put a breakpoint in the code of a View in a ASP.NET MVC 2 project but Visual Studio complains that:
"This is not a valid location for a breakpoint"
I have tried multiple ways to it (the "mouse way, F9, using the menu option). I am using Win2008 and running the site in IIS7.
Slandau's answer shows how to turn on compilation - a great start. Now, if only debugging would work!

If you use the Razor view engine, you can be easy to set the break point and it works.

Related

ASP.NET MVC errors in View

I am using ASP.NET MVC / C# but my views are full of errors.
At runtime, I don't get any error but my screen is full of red underlines. In the error panel, I get the attached error. Can you help me to install what is missing in my Visual Studio?
if using vs this happens a lot. Close and reopen always worked to me

How can add controller in ASP.NET MVC6 beta5 project?

i'm install Visual Studio 2015 final release and create mvc6 beta5 project (by default template).
Trying add controller as in mvc 5.2 (also in vs2015 final release):
but, in mvc6 beta5 project this menu missing:
1. How solve the problem?
UPD
2. Is it possible add mvc6 controller with generate views?
Prior to MVC 6.0 the notion of an MVC Controller and a Web API Controller were somewhat different. To the untrained eye, they looked similar but they did behave differently and were using different classes.
Hence why when you clicked the Controller… option, you had the ability to choose between an MVC Controller and/or a Web API Controller.
As of MVC 6.0, both MVC and Web API controllers have now been unified. They are now exactly the same thing and are using the same classes.
So you don’t really have the need to choose between an MVC Controller and a Web API Controller.
Simply click the Add New Item which in turn will open the Add New Item dialog.
From the Add New Item dialog in the top right search textbox, enter Controller.
You’ll be able to select the MVC Controller Class template.
Who knows...maybe by the time they ship the final product, they’ll bring it back but at least for now, this shouldn’t be a show stopper.
EDIT:
For the scaffolding stuff, perhaps this link might help.
to solve this go to project.json
then add the following dependency:
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final"
then you should be able to right click controllers folder and see the new controller button appear
I am facing the same issue for visual studio 2015 community edition, followed following steps and restarted visual studio. It resolved my issue
1)Open VS2015=>TOOLS=>Customize.
2)Select Commands.
3)Select Context menu.
4)Select Project and Solution ContextMenus|Folder|Add.
5)Check that 'Controller' appears.
6)IMPORTANT -Move up Controller item to the top.
7)Restart visual studio

Breakpoints in Views in Portable Areas are not hit while debugging

We are using Portable Areas in our ASP.NET MVC web application, and I notice that breakpoints are not hit in Views that are contained in the Portable Area.
So I can not debug Views in a portable area, which is sometimes needed.
What could be solutions to this problem?
Things I already tried:
Debug in VS2012 and VS2013
Clear temporary asp.net files
restart IIS
restart PC
Delete /bin/ and /obj/
Breakpoints in the controller ARE hit. Just not in the views so I suspect it has something to do with using portable areas.
I am having the same issue. Here is what Visual Studio explains about the breakpoint:
After disabling the option as suggested on the last line of the message I get this:

change webforms to mvc in visualstudio 2010

i created a blank webforms project instead of an MVC 3 project in visual studio, everything runs fine but i dont have my menues
for example when i right click on the Controllers folder i dont get "Add a controller" option.
does anyone know without starting a new project how to change the type of project into an MVC one so that i get the correct menus.
thanks
It's not that you don't have the menu options, it's that it's a completely different type of [web] application and works in different ways. e.g. Webforms has no concept of controllers so even if you did have a menu option it wouldn't get included in the project as you're expecting.
Because webForms and MVC are so different there could never be a 100% reliable conversion utility.
Just create a new project and copy the files already created. I can't imagine you've written that much code before realising that you're in WebForms, not MVC.
If you have got lots of WebForms code you could always just include this in the MVC project until you can convert it (if necessary) at a later time.
Edit:
If you just want to change the project type you can edit the csproj file of the webforms project and add the following ProjectTypeGuid {F85E285D-A4E0-4152-9332-AB1D724D3325};.
You'll need to update references, files, etc. for this to work but it may be quicker than creating a new project and copying content over. (Especially if you already have the project in source control.)
Note that I've only tested this going from WebForms 4 to MVC2.
Try updating a MVC to ASP.NET Fall Update Release Candidate. There is a link .

R# "cannot resolve view" when changing the default location for views + custom ViewEngine for ASP.net MVC2

We have a project in ASP.net MVC2 were we have our own ViewEngine that overrides were views locations are. Problem is that Resharper 5.1 is not picking up this, of course. Is there anyone who knows of a way to extend R# to pick this up?
I don't want to disable R# to not try to resolve view globally or local with the R# comment. I want to full tooling support.
R# and Visual Studio don't have support for custom view locations. Imagine views stored in a database for example. You could still write to the R# team and ask to implement this feature in the next version.

Resources