Visual Studio does not show the Winforms designer for forms or user controls instead displays the .cs file as source code

When using Visual Studio you may find that forms and user controls don't display with the correct icon and instead display as a plain .cs source file.

Double clicking the file displays the source code behind for the form, but does not display the form or control designer.


To resolve the issue simply add a new form to the project and double click the control. This restores the project and you can delete the form.



If you look at the .csproj project file before and after it appears that the subtype attributes were missing from the and adding a form puts them back.

    <Compile Include="Controls\Automation Profiles\AutomationProfileCsvSettingsUI.cs">

      <SubType>UserControl</SubType>

    </Compile>

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.