Does ASP.NET automatically disable aspx.designer.cs?

When I work on the asp.net/c# project, I come across foobar.aspx.designer.cs, which automatically creates it. for example, when I change the code / constructor, designer.cs automatically updates its contents.

Since I'm a little dude controller, I would like to save the code myself. I am not happy with the excessive amount of comments that I do not need. How:

/// <summary> /// Form1 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlForm Form1; 

While I would like to see the following:

  protected global::System.Web.UI.HtmlControls.HtmlForm Form1; protected global::System.Web.UI.WebControls.Button Button3; etc, etc 

(not against naming, of course, I would give him some distinctive name)

How to fix it? I checked google on this but couldn't find the answer so fast ...

+7
c # designer auto-generate
source share
2 answers

You can read the comments, they will tell you what to do.

Move the declarations to the code and delete the constructor file.

But I have to make an observation:

Expressing this kind of anxiety and especially spending efforts to reverse the kindness that VS shows you is contrary to the degree of naivety and inexperience.

Perhaps your time would be better spent on coding? ;-)

+1
source share

I'm not sure if you can turn off the automatic creation of this file. And if that would be nice to do ... If you really want (need?) To intervene in this, I would rather find a way to change my behavior / format. Unfortunately, I cannot provide a solution / hint for this. You may need to look in the "custom tools" area (for code generation).

Why are you so unhappy with the file format? I almost never look at it :) And, according to Scott Guthrie, the designer file was introduced in VS 2005 as "the place where Visual Studio is allowed to write" ugly "code: Tutorial 2: Working with code with VS 2005 web application projects .

Edit: Perhaps this article by Scott Hanselman can help? T4 (Text Template Conversion Tool) Code generation is the best hidden section of Visual Studio .

+1
source share

All Articles