Is it possible to tell Visual Studio not to treat a source file as a "component"?

c#, components, visual-studio

Solution

Can't you use the `DesignerCategory` attribute to decorate your class ?

When decorating your class with this attribute like displayed below, the file should open in 'code view' when you double click it:

[System.ComponentModel.DesignerCategory("Code")]
public class MyComponent
{
}

Problem

Possible Duplicate: Is there an attribute I can add to a class so it will be edited as code, not in the designer? Class with `System.ComponentModel.Component` on their inheritance path are automatically treated as "components" within Visual Studio (2008), triggering a different icon for the source file: While the icon does not really matter, the changed double click behavior is really annoying: instead of opening the source code in the text editor, Visual Studio now shows a screen encouraging me to add components to my class by dragging them "from the Toolbox". I do not want to do that! I am aware that I can right click the source file and choose "View Code", but whenever I forget to do this, I am stuck waiting for a dialog which is absolutely useless. Is there any way to disable the component behavior (preferably in the source code)?

Original source

Related problems