Visual Studio: Design view missing for Form

1 comment

Recently I had a problem opening my form in Design View within Visual Studio. (C# / 2005).

Seems the problem was a corrupt project file .csproj

My form was defined in the project file as follows:

    <Compile Include="frmOppgaver.cs">

    </Compile>

    <Compile Include="frmOppgaver.Designer.cs">

      <DependentUpon>frmOppgaver.cs</DependentUpon>

    </Compile>

…..

    <EmbeddedResource Include="frmOppgaver.resx">

      <SubType>Designer</SubType>

      <DependentUpon>frmOppgaver.cs</DependentUpon>

    </EmbeddedResource>

Somehow VS has removed a line telling it that this is a form.

To correct this I had to check out the .csproj file and open it in a text-editor.

The correct values with my addition in bold:

<Compile Include="frmOppgaver.cs">

      <SubType>Form</SubType>

    </Compile>

    <Compile Include="frmOppgaver.Designer.cs">

      <DependentUpon>frmOppgaver.cs</DependentUpon>

    </Compile>

    <EmbeddedResource Include="frmOppgaver.resx">

      <SubType>Designer</SubType>

      <DependentUpon>frmOppgaver.cs</DependentUpon>

    </EmbeddedResource>

This has happened a couple of times. I suspect it is when I move my project to a different place,

or use a copy of an existing project for start of another which sums up to the same :)

Brgds Henri

Posted via email from Henris blogg

1 comment :

  1. Have you tried selecting the form in the Solutions Explorer, and then using the Main Menu to view (not talking about the popup menu)

    ReplyDelete