Thanks for Brock's inputs.
Hi Praveen,
From the description of your problem, it is a VS.NET's design-time issue
which I've met in some former issues. And is the following issue the one
you found on the web search ?
#Adding namespaces to code behind automatically (C#)
http://groups.google.com.sg/groups?h...2752%40cpmsftn
gxa06.phx.gbl&r num=2
I think that's exactly the same problem as yours. When we developing a
custom control and use VS.NET's ToolBox to drag it onto our page or
winform. The VS.NET ide will automatcally add assembly reference of the
control's Main Assembly(dll). However, if the control still have other
assembly dependecy, VS.NET won't add them into references automatically.
Then, if we didn't manually add them (in our project) or in our control's
design-time code, there will occur assembly not found exception at runtime.
That's just what you 've encountered, yes?
Also, have you tried the sample code in the above thread?
=============== =====
protected override IComponent[] CreateComponent sCore(IDesigner Host host)
{
ITypeResolution Service service1;
Assembly assembly1,assem bly2;
IComponent component1;
IComponent[] componentArray1 ;
IContainer container1 = host.Container;
service1 = ((ITypeResoluti onService)
host.GetService (typeof(ITypeRe solutionService )));
assembly1 = typeof(ClassLib .UserName).Modu le.Assembly;
assembly2 = typeof(Componen tLib.SimpleComp onent).Module.A ssembly;
service1.Refere nceAssembly(ass embly1.GetName( ));
service1.Refere nceAssembly(ass embly2.GetName( ));
component1 = new ComponentLib.Si mpleComponent() ;
container1.Add( component1);
componentArray1 = new IComponent[]{component1};
return componentArray1 ;
}
=============== ===
We can override the CreateComponent s method of the ToolboxItem and manually
add the necessary assembly dependecy in it. The following two statements
are just the adding reference code:
service1.Refere nceAssembly(ass embly1.GetName( ));
service1.Refere nceAssembly(ass embly2.GetName( ));
Please have a look to see whether it helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)