locked
Designer error 'Could not find type XYZ' in VS 2010 Windows7. Works fine in XP. RRS feed

  • Question

  • I'm stuck on a problem in VS 2010. I've had a project on Windows XP that includes forms, classes and a handful of my own custom components. These components are simple extensions of built-in MS components (e.g. DataGridViewEx as an extension of DataGridView). Everything has worked fine in XP. I'm trying to port this project over to VS 2010 on Windows 7 / x64. I've got the solution to compile OK on Windows 7, however in design mode, when I open a form that contains one of the custom controls, I get an error 'Could not find type XYZ.DataGridViewEx. Please make sure that the assembly that contains this type is referenced.' XYZ is the namespace I use for these controls and it is the same namespace as the forms that are using the controls. All are part of the same VS project.

    When I open a form in the same project that does not contain one of these custom controls, that form opens OK in the designer, and I see the custom controls along the left side in the toolbox. However if I then try to drag one of these controls into that form, it pops up an error message box 'Failed to load toolbox item 'DataGridViewEx'. It will be removed from the toolbox.' And then it gets removed from the toolbox.

    Everything was always working fine in VS solution in XP. This problem only occurs in the VS solution in Windows 7 / x64.

    I don't understand why it complains about not being able to find the component, since the component is part of the same project. That's a valid thing to do, isn't it?

    I've search the web/forums and found cases of the 'Could not find type' error, but it seemed to be caused by a different issue, and I haven't yet found a way to get rid of the error.

    Any help/tips are much appreciated!

    Sunday, October 14, 2012 12:00 AM

Answers

  • I got it working by creating a new Class Library within the solution, and moving all the components from the original project over to the new class library, and changing the designer references to point to the new class library namespace. It was a pain, but it works.
    Sunday, October 14, 2012 1:36 AM

All replies

  • I got it working by creating a new Class Library within the solution, and moving all the components from the original project over to the new class library, and changing the designer references to point to the new class library namespace. It was a pain, but it works.
    Sunday, October 14, 2012 1:36 AM
  • Glad to hear you solved your problem. Thanks for sharing!

    Best regards,


    Shanks Zen
    MSDN Community Support | Feedback to us

    Monday, October 15, 2012 11:00 AM
    Moderator