Is it possible to tell Visual Studio not to treat a source file as a "component"?
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
{
}
As OregonGhost already mentioned in his comment this also happens if you make a partial class file from a form.
The problem is even more worse. If you take a look into your project file you can find entries for every file include like this:
<Compile Include="FormMain.cs">
<SubType>Form</SubType>
</Compile>
So the solution should be to delete the line <SubType>...</SubType>
cause it seems to be the root of all the problems. But if you delete this line, save the file, open it in Visual Studio, save it again and take a look again into, the line will reappear!
There seems to be only one hard-coded exception within Visual Studio and this is *.Designer.cs. So there is no solution to accomplish this problem.