Visual Studio: Make view code default

Visual Studio

Visual Studio Problem Overview


Is there any way to make Visual Studio show the code of a control / form by default instead of the designer? I tend not to be a fan of the designers as they add bloat.

Visual Studio Solutions


Solution 1 - Visual Studio

Right-click on a file and select "Open With..."

Select "CSharp Editor" and then click "Set as Default".

Solution 2 - Visual Studio

Decorate your class with [System.ComponentModel.DesignerCategory("")], e.g.:

[System.ComponentModel.DesignerCategory("")]
public class MySpecialButton : System.Windows.Forms.Button
{
}

Solution 3 - Visual Studio

I like having my forms open up in Design View, but I made a partial class file which had only code and Visual Studio wanted to open it in Design View all the time. To prevent Visual Studio from realizing that a specific source file can be loaded by Designer, look at the csproj file for the Compile Include tag of the appropriate source file and remove the SubType tag underneath it.

Solution 4 - Visual Studio

I came across this issue myself recently and the above solutions did not solve my issue. I needed to go into Tools | Options and change the settings for HTML Designer to Enable HTML designer and select Start pages in: Source View.

Settings screenshot

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionsmack0007View Question on Stackoverflow
Solution 1 - Visual StudioJon SkeetView Answer on Stackoverflow
Solution 2 - Visual StudiogmbView Answer on Stackoverflow
Solution 3 - Visual Studioajs410View Answer on Stackoverflow
Solution 4 - Visual StudioAaron PalmerView Answer on Stackoverflow