Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use a custom control in the designer and avoid the GAC?

Tags:

c#

winforms

There is a great library I found here. It's AeroWizard done in Windows Forms, and it handles Aero Basic elegantly. What is awesome is it's supposed to have designer support. When I attempt to open any of the WizardPages in the sample in the Form Designer, I get this error:

Could not find type 'Aero.Controls.MainInstructionsLabel'. 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 using settings for your current platform or Any CPU.

The library is referenced in my project under Aero.Controls and Aero.Wizard, so I'm not really sure what's going wrong.

Do I need to GAC register an assembly to have designer support?

Edit: I just checked with reflector, here are the references

Aero.Controls
mscorlib
System
System.Drawing
System.Windows.Forms
user32.dll

Aero.Wizard
mscorlib
System
System.Drawing
System.Windows.Forms
dwmapi.dll
gdi32.dll
user32.dll
uxtheme.dll

Nothing besides the native Dlls concerns me, but I don't see how those would prevent the Form from rendering in the Designer.

Here is a screen-shot from the designer: alt text http://www.ceasetopanic.com/wp-content/uploads/2010/02/compile-error.jpg

like image 454
Chris Avatar asked Feb 15 '10 04:02

Chris


People also ask

In which of the following typical scenarios the GAC is best avoided?

In more typical scenarios, however, the GAC is best avoided because it adds the following complications: § XCOPY or ClickOnce deployment is no longer possible; an administrative setup is required to install your application. § Updating assemblies in the GAC also requires administrative privileges.


2 Answers

Visual Studio should have no problem finding the control and loading it as long as the project that is using it has referenced the DLL. You might want to try building the project then closing and re-opening Visual Studio. There is no need for the assembly to be in the GAC.

You might also try opening the assembly in Reflector to see if it references other assemblies that you don't have. If Aero.Controls references another assembly that you haven't referenced and Visual Studio can't find it when probing for it, you will see that kind of error and GAC'ing the assemblies mentioned above would not fix that.

like image 92
Josh Avatar answered Oct 01 '22 15:10

Josh


Visual studio needs to be able to find them. Usually this means the GAC, however you can use the trick I use here on my blog to fool an application to looking elsewhere. I've used it to fool outlook to find our dlls when writing addins. Personally I think the GAC may be less of a headache in terms of maintenance.

like image 27
Preet Sangha Avatar answered Oct 01 '22 16:10

Preet Sangha