Visual Studio 2010 Designer Error on Run

后端 未结 17 712
借酒劲吻你
借酒劲吻你 2021-02-03 21:42

I am using using VS2010 and if I have a form open in designer mode and run my application the designer tab will no longer show the form designer but instead an error will be di

17条回答
  •  逝去的感伤
    2021-02-03 22:43

    I'm able to avoid restarting VS by doing the following

    1. Add a new user control
    2. Drag and drop some of your custom user controls on to it (If it gives you an error, build the solution again).
    3. Reopen your control.

    In my case, I have a winforms project with several custom controls that are used by other custom controls. Whenever I open some of those custom controls, I get a the "The base class ..." error. Adding a new custom control, building the project and then adding some custom controls from my project to the new custom control allowed me to open the custom controls that were giving me the "The base class ..." error.

    UPDATE: I think I found the problem. My controls were not 'added' properly to the csproj file. In the csproj file, the files for partial classes of UI controls/components need the 'DependentUpon' attribute.

    E.x.: before:

    
        Component
    
    
    

    after:

    
        Component
    
    
        DataGridView.cs
    
    

提交回复
热议问题