Forms Designer throws error but compiles OK

I'm using VS2005 with a managed C++ project.

I have 2 user controls in the project (along with a lot of other stuff), I was previously able to manually add the first control onto the GUI of the second but now I get an error from the Forms Designer:

Could not find type 'Mcomms_Design.ControlOverlayImage'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built

I have #include'd the control's .h file and manually added references to the control, but I still get the above error.

The project compiles and runs OK with no warnings, so the code can't be too bad. I've also tried dragging the control from the Toolbox but I just get an error there too.

I have changed the project's Intermediate output directory from the default, not sure if that matters. The root namespace is also different to the solution and project names, but the same in both controls and correct in the code.

What do I need to check to get these controls to display correctly in the Forms Designer
How do I add a reference to the control

Thanks,

Grant



Answer this question

Forms Designer throws error but compiles OK

  • DaveGriffin

    Hi,
    I had a similar problem with controls that I added manually and the problem was that I was not using the full namespace. For some reason the VS designer needs the full namespace to display the user controls.


  • Lucas Loizaga

    I am also experiencing this problem, but specifying the full namespace does not resolve the issue.

    I have a test project compiled with /clr:pure that will display the control at design time. However, my "real" project must be compiled with /clr (due to the need for some unmanaged functions), and will show the above error when attempting to display the control at design time. When I change the compiler flag to /clr on the test project, I also get the error. Changing back to /clr:pure gets the error to go away.

    How can I get the control to display in my real project without using /clr:pure



  • totem_pty

    Hello,

    there is a bug inside VS2005 when output directory is not included inside internal path where loaded symbols are expected. Try to add your output directory and the directory with linked native modules (if any) into system/user variable PATH and then start your VS2005 and the project. Such solution helped me with my (similar) problem. I had a mfc ext dll with /clr and some native libs were linked.

    Love & peace

    Rasto.



  • Forms Designer throws error but compiles OK