How to generate <Form>.Designer.cs files for old projects?

We converted our solution from Visual Studio 2003 to Visual Studio 2005. Soon we noticed that our forms do not have 2 depended files <Form>.Designer.cs and <Form>.resx.

I really want to generate the <Form>.Designer.cs files for all my projects. Do you know how I can do that At least is there a way to do it manually

Thank you for you help.

Suiram




Answer this question

How to generate <Form>.Designer.cs files for old projects?

  • bmilliron

    One of the ways is to manually shift the Windows Forms Generated Code region to Form.Designer.cs file. Once that is done, you need to open the project file in XML Editor and then manually add the dependancy using <DependentUpon> tag.

    E.g.

    <Compile Include="MainForm.cs">
    <SubType>Form</SubType>
    </Compile>
    <Compile Include="MainForm.Designer.cs">
    <DependentUpon>MainForm.cs</DependentUpon>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
    <AutoGen>True</AutoGen>
    <DesignTime>True</DesignTime>
    <DependentUpon>Resources.resx</DependentUpon>
    </Compile>

    This is a tedious option for a form with multiple forms. But to my knowledge this is the only way to address the dependancy in VS2005 you are looking for.

    Cheers,

    Hemant


  • How to generate <Form>.Designer.cs files for old projects?