I recently wrote a class in C# that inherits from System.Diagnostics.Process
. This class abstracts a shelling-to-disk process that I need to do. Something like this:
public class MyShellTask : Process {
// ...
}
One thing that bugged me to no end is that, in Visual Studio, when you double click the file in the Solution Explorer, it considered it "designable" even though there was no designer. So that means I got a empty page every time, telling me that it was not designable, with a link to View Code
. Well, View Code
is what I wanted, not View Designer
, when I double-clicked!
So after getting very frustrated, I did the natural thing.. I Googled looking for an answer. I had a notion that I could control this behaviour through Attribute tags on the class if only I knew the right one. Having made designable components before I was familiar with the attributes used for that. I tried fiddling about with Intellisense, Googling, all to no avail… Nothing worked! Nothing showed up in my Google searches! Good God! What to do now?
Fiddle some more… until finally I found the right attribute:
[public class MyShellTask : Process {
// ...
}
]
Note that you must call this with an empty string (don't believe the intellisense comment, an empty constructor call will NOT do the same as calling the constructor with an empty string.) This sets it to a non-category that it doesn't know how to deal with, and so doesn't offer designer support to you!
This also helps other classes (like say installers) which exhibit the same annoying VS UI problems… ie:
/// <summary>
/// Custom Installer actions for this project.
/// </summary>
[ ]
[ ]
public partial class MyInstaller : Installer {
// ...
}
Hope that helps someone! Now there will be at least ONE hit if someone googles up "disable design-time support"
or "disable designer support"
like I did!