Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic regenerate designer files

Recently I've been making some improvements to a lot of the controls we use, for example give properties default values and making buttons private instead of protected. By making this kind of adjustments you need to regenerate the designer files of the forms which have this control on it or controls which inherit from the control.

In the past this wasn't really a problem because we only had 20-30 forms. At the moment we've got more than 300 forms which would mean opening the same amount of designers in VS2010.

So my question: do you know a way of automating this process so all of the forms get regenerated?

I've been thinking about a macro which looks for designer files and opens the file (with a max of 25-50 files open to make sure VS won't crash), but I've not been able to get this working.

I hope someone has a suggestion!

like image 963
Sander Avatar asked May 31 '11 14:05

Sander


People also ask

What is ASPX designer CS file?

aspx. designer. cs file contains all the definition of the controls that are being used by the page. It's just segregation of the code using partial class feature.

How do I create designer CS settings?

designer. cs file and then right-click on the settings. settings file and select "Run custom tool". That will regenerate the settings.


1 Answers

The only way I found to do what you want, is to open the form designer, add a control, then save. This will regenerate the designer code. Next delete the newly added control, save again, and close.

I usually add a button by double-clicking on the button in the toolbox. This puts the button at location 0,0.

I did this a couple months ago with a project with about 100 form and user-controls. Instead of a macro that recursed over the project files, I recorded a temporary macro then ran the macro for each form/user-control and inspected the results.

Do not confuse refactoring with reformatting. I often optimize and/or modify the designer code in large forms. For example, I will change the order controls are added to panels, and how panels are added to other panels. I would not blindly regenerate the designer code.

like image 83
AMissico Avatar answered Oct 24 '22 09:10

AMissico