In my project when I create a webusercontrol or a webform it creates the code behind, but it also creates a .ascx.designer.cs file.
What is this file for? Can I prevent it from being added when I create a new webform/webusercontrol?
In .NET 1.x, the code that allowed the Visual Studio designer to create a visual representation of the page was included within the code behind file itself. It was usually encapsulated within a region called "Designer generated code". (IIRC!)
New developers often inadvertently made changes to those code sections causing problem when working in design view or compilation errors.
In .NET 2+, with the advent of partial classes, M$ was able to extract that portion of code into a separate partial class that would not interfere with the code written by the developer. This file is usually named as Designer.vb/cs. You should not delete it for the same reasons mentioned above.
This is normally the IDE-generated code that sets up the form (which you configure by drag-n-drop or inserting values into property windows). Probably not such a good idea to get rid of it since your application would need it (unless you plan to handcode everything).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With