How to Stop VS Designer from messing up my already present code
Everytime I move to Designer View my whole designer.cs code is messed up : VS Designer reorganizes code blocks and puts an irritant verbose prefixes like "this.whatever" and fully qualifies objects using "System.Windows.Forms.whatever" I Know that "Designer.cs" is not intended to be edited but I need to do some GUI code customization from time to time and would like these to stay as I changed them.
How to avoid that ? (Guess this is too funky for VS to handle)
(Actually I am just avoiding the use of the designer and do it all by hand, the good old way)
Update : I am surprised to see the herd-like reaction towards this question. Sorry if it is disturbing, but it is interesting to see that, before hitting me on the hand saying "DON'T DO that, it's Bad", NO ONE asked WHY I wanted to do it. IMHO the question is relevant and that's why : Many of the "auto-generated" code is rubbish and of absolutely no use, it does need some enhancement. One example (among soooo many others) : Why generate a Size/Location property when the control's Dock Mode is set to Fill ? I wanted to take advantage of the benefits whithout the drawdowns. Anyway, I'll keep the short answer : You take it ALL (with the rubbish) or leave it ALL.
It's simple: don't edit the designer code. Those warnings are there for a reason, and for Visual Studio to work correctly it needs to own that file.
This is a partial class: everything you need to do, you can do in the matching non-designer file for that class; this includes all your control declarations and other things. Since you're trying to avoid the designer entirely, let visual studio have that file and just put everything in your normal .cs file.
Update: Based on the comment, I want to add the following — Either use the designer or don't use the designer. Don't be wishy-washy about it. If you're using and relying on the designer for some things, you MUST leave the designer's file alone.
If you're avoiding the designer, then really avoid the designer. Everything it does you can do in your own code (except of course for the visual queues, but even that can be done better via prototyping). You can even create your own additional file for the partial class to keep designer-like code in.
If you're only using the designer as an occasional code generator to help reduce some boring typing, do that in a separate project or on a throw-away form in your existing project and just copy/paste the code over.