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

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.

Related

Visual Studio 2015 designer.cs file gets all custom components removed

I am using Visual Studio 2015 on an ASP.net WebForms project. When I save a .aspx page the .designer file gets regenerated but it removes all references to any custom component on the page (ex: ) and leaves intact the references to any default built-in .net components (ex: ).
The problem is only happening on my machine. The other team members do not have this issue so I know there is not something wrong with the project itself.
One thing I have found is that any time I add or remove an extension in visual studio, it shows the Restart button. When I click that button to restart VS, then the problem with the designer files goes away. But as soon as I manually close VS using the X at the top right, and restart it, that is when the problem comes back.
I've tried with and without using Run as Administrator with no luck either way.

Visual Studio 2013 Single-File Mode?

I am fairly new to using VS 2013, but I had quite a bit of time in on 2010 version. In VS 2010, working with ASP.NET, I could choose to use a "single file" method instead of the "code-behind" option. This is where the VB code could reside at the top of a page, then the scripting below.
I detest having separate files for code and content, but I cannot find the option in VS 2013 to disable code-behind mode. Did they do away wit this feature?
TIA
This option is only available for websites not web applications, go to File->New->Website and create a new website, then you can choose to have the code behind on the same page or separate page when you are adding new pages.
Keep in mind there are differences between a website and a web application, please investigate further before choosing which project type is suitable for you.

Visual Studio 2013 saving and building before publishing

I recently formatted my computer and then reinstalled visual studio 2013 (I previously had VS 2012). I used to be able to right click on a specific aspx page and then publish that individual page with ought having to publish the entire site. Now, I need to publish the entire site just to reflect the change on one page and it's also not saving on publish. So, I believe what I'm asking is how to automatically build and save when I try to publish an individual page? Thanks, Chris.

How to view cshtml page in visual studio?

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

ASP.NET Add Razor page in Web Application not Web Site, NO MVC

I just found a strange thing in Visual Studio 2010.
I can add a Razor page into a Web Site project, but I cannot do it in a Web Application project.
I do know I can create a ASP.NET MVC(1-4) project which allows me to add a Razor page into it.
After I checked the differences between Web Site(WS) project and Web Application(WA) project, it seems to me that WA is to trend to be in most cases and has more features than WS.
So my question is:
Visual Studio 2010 allows us to add a Razor page into a WS project(you can find it when adding a new page in the list of templates), but why it does not provide the Razor page in the template in the WA project?
I'm curious about it. Waiting for your answers :)
Cheers
I had the same problem when creating a new, Empty web application. I wanted to use MVC. Despite adding the references required, it still won't let me create files by right clicking on a folder.
However, if you have SP1 installed on Visual Studio 2010, you can:
Right Click > Add > New from Template> Razor MVC View
Hope this helps.

Resources