How to view cshtml page in visual studio? - asp.net

I am using Visual Studio 2010 SP 1. On opening/creating any .cshtml page (view), I am unable to find the option to see the rendered page in VS as soon as I make any change (similar to "design" tab in web-forms).
Is this not supported in VS 2010 or am I missing something?

The design view doesn't exist in MVC projects.
Take a look at this answer for more information: Is there any graphical designer for ASP.NET MVC?

If you need the visual assistance when designing, you can run your application without debugging ( Ctrl - F5 ), and then once updates are made, you can refresh the web browser to view updates. It isn't real-time, but at least it is something.

In visual studio 2019 you can use the option "Show in browser" or click CTRL + SHIFT + W

Related

Visual Studio 2022 - ASP.net - Error Creating Control ajax Toolkit ... Page Design

I have a Visual Studio 2022 ASP.net application that now displays "Error Creating Control ajax Toolkit" when viewing the Page Design:-
The application references the AjaxControlToolKit:-
And the path is pointing to the Ajax install path:-
The application builds and runs but when viewing the design page I get the "Error Creating Control" messages.
This seems to have started very recently.
Any ideas why?
tia
Just to add to my original question It appears that the "Web Live Preview" was the issue.
I set the option back to "Legacy Web Forms Designer" and it seems ok.
I found this similar post here

Visual Studio 2022 Enable Web Live Preview

I wanted to try developing a website in VS but I'd really like a visual (WYSIWYG) editor. Apparently, this is available in VS. In that video, and lots of other videos and websites, it shows 'Design' and 'Split' buttons on the window, which should show a live view of the web page that's open. It seems this is supposed to work with both .aspx and .cshtml files.
However, nowhere can I find how to enable this, and I've done a lot of searching. I've even uninstalled and reinstalled VS. There are no options, settings or menu options to enable it. I'm using VS 2022 Community, fully up to date, in an ASP.NET Core Web App project using .NET 7.0.
Does anyone know what's wrong? I wondered if it was only available in VS Professional/Enterprise, but seemed silly to me.
that feature in the brand new vs2022 is for ONLY .net framework, and ONLY for web forms.
So, if you using MVC, then you don't have a forms designer.
And if you using .net core, then you can't use this feature either.
So, when you create a project, it MUST be .net framework (not .net core), and it MUST be a webforms project, and NOT MVC projects.
So, that would be say this (for c#).
And (best choice) would of course be this template:
And if using vb.net, then again, same thing:
So, web projects, and .net framework - NOT .net core projects.
thus:
So, out of those templates, then again, of course a asp.net web application would be the preferred choice.
so, for example, here is a gridview in "live" preview, and yes you can edit or drag + drop controls into that live preview.
it looks like this (split screen for example).
but, if I run the page, same in a chrome based browser (Edge, or chrome).
Then I see this:
Since the new designer is based on the chrome engine then as above shows, yes, it is rather cool.
Here is that web page, not split view in the designer:
(so I have NOT yet hit f5 to run, but only am in design mode)
so, in old legacy designer, I would see/get this:
So, note how do you DO NOT see say for example the bootstrap menu bar.
But, if I turn on live preview, and now I see/get this:
Note how we now even see the bootstrap menu bar in the preview - I have not yet hit f5 to run in browser. And on the bottom, you see a "bread-crumb hierarchy" as to what element you clicked on (very much like f12 debug tools in a browser, and then using "elements" selection).
You can find it by creating an asp.net web (.Net Framework) and selecting Web Form in it.
I use vs2022 17.4.2 community version
You can also view its settings in the tool.

Visual Studio 2015 Asp.net 5.0 Dynamic development does not work in debug mode

So I installed VS2015 CTP6. In the blog of Scott it advertises:
Dynamic Development.
In Visual Studio 2015, we take advantage of dynamic compilation to provide a streamlined developer experience. You no longer have to compile your application every time you want to see a change. Instead, just (1) edit the code, (2) save your changes, (3) refresh the browser, and then (4) see your change automatically appear.
Well, if I do that visual studio kills the browser on the save action.
What am I doing wrong?
Created a new project, asp.net 5 and switched runtime to coreclr. Tried IIS express & "web"..
The new edit & continue functionality for Roslyn currently does not work with the debugger attached. This will be fixed in a future release. You can start without debugging (ctrl + F5) if you want edit & continue support.

ASP.NET Web Application template missing in Visual Studio 2012

has anyone else dealt with this? My ultimate goal is to create a new empty web api project. I've been following tutorials and I've encountered the following issue:
My issue is that when I try to create a ASP.NET Web Application project in Visual Studio Pro 2012 I do not see that template as an option. I go to Installed --> Templates --> Visual C# --> Web
All I see is ASP.NET Empty Web Application. So I selected that and then expected the ASP.Net project window to pop up so that I could select "Web Api". However, that dialog never opened.
Does anyone know how/where I can get the ASP.NET Web Application template?
I came across your question as I had the same problem. When I first installed Visual Studio I didn't tick the box to install the Web Components. Here is how I solved the issue:
Close all your instances of Visual Studio.
Run the Visual Studio Installer (I found mine in the Downloads folder still and was named "vs_professional.exe").
For VS 2013 a grey window appears similar to when first installing VS.
When prompted select "Modify" from the list of options.
Tick the list item which I think was named "Web Development" or something similar.
Click update.
Once the installer has finished running launch Visual Studio.
When selecting New Project in Visual Studio I can now see the required templates.
Try to select Framework 4.5.
The Framework 4.0 don't have :)
Jorge Rocha
If you have ASP.NET MVC 4 Web Application as an option under Web when you select it as a new project the project window pops up and you will be able to select Web API.
kale909's solution worked for me. I just added pics here to make it more clear:
then here:

Is there a setting in Visual Studio 2010 to stop the 'Add New Item' wizard from using server-side code for web forms?

I hate hate HATE that Visual Studio creates .aspx.cs and aspx.designer.cs files every time I add a new .aspx page to my project.
I've searched high and low. How do I turn this off?
There used to be a little checkbox right on the wizard that allowed you to say whether you wanted server-side code pages or not. VS 2010 appears to have removed it.

Resources