oops, sorry. ingore my previous post - i had wrong assembly reference
path in the source project.
anyway, your advice does not help :( or probably i'm doing something
wrong. it looks like there is no difference whether your code exists or
not. no aditional references are added to the final project when i drop
this problematic control on the form.
maybe i did something wrong? could you tell me what did you ment by this
two fragments?
1. [...] control.Site.GetService [...] - what is _control_? is it my
control that references other assemblies?
2. assN.Name = fullAssemblyName; - i assume that _fullAssemblyName_ is
the name of the referenced assembly that should be added to the references?
sorry for this, but i admit that when comes to this part of .net
programing i'm still a noob :/ i just never needed this.
[quoted text, click to view] SharpCoderMP wrote:
> hi,
>
> i've used your code, but now i have a different problem:
> when i drop my control on the form i get message saying "The .NET
> assembly 'myAsseblyName' could not be found." after that the control is
> not placed on the form.
> so it looks like the control chcecks for the referenced assemblies but
> cannot find them. what can i do to make it find them? when i manually
> add the missing asemblies to the project and then drop the control -
> everything is fine. but i would like to have this references added
> automatically.
>
>
> InK_ wrote:
>
>>hi
>>
>>You should write something like this:
>>
>>ITypeResolutionService resources = (ITypeResolutionService)
>>control.Site.GetService(typeof (ITypeResolutionService));
>>
>>IReferenceService irs = (IReferenceService) control.Site.GetService(typeof
>>(IReferenceService));
>>
>>AssemblyName assN = new AssemblyName() ;
>>
>>assN.Name = fullAssemblyName;
>>
>>
>>if (irs != null && irs.GetReference(fullAssemblyName) == null)
>>
>>{
>>
>>resources.ReferenceAssembly(assN);
>>
>>}
>>
>>It will add fullAssemblyName into the references of the project.
>>
>>Regards,
>>
>>Inna Stetsyak aka InK_
>>
>>"SharpCoderMP" <csharp_mp@interia.pl.NFSPM> wrote in message
>>news:uXl2t$eIGHA.216@TK2MSFTNGP15.phx.gbl...
>>
>>
>>>hi,
>>>
>>>i've created very complicated custom control that sits inside the dll.
>>>the problem is that this custom control needs two other dlls from
>>>different namespaces. now when i drop my control on the form in the
>>>final project (using vs.net 2k3) only the reference to the dll with
>>>custom controll is added to the project references. what can i do to
>>>have vs.net automatically add two other references to dlls that this
>>>control needs? if i try to compile the project without these two
>>>referenced dlls i got errors related to the properties of this controll
>>>that reference these missing dlls. when i add the references manually
>>>then everythig works fine, but i would like to have it done automatically.
>>
>>
>>
InK_,
sorry again... :/
i've just run this code through the debugger (debuged another instance
of vs.net). it looks like it was never called, because somehow the
control has the property DesignMode set to false even if it is being
"designd" in vs.net - i have no idea why. so now i need to know to what
the _control_ is referencig in your code example because when i change
it to "this" it obviously throws an exception, because the control
itself is not yet created. when i change it to "Control" i obviously get
compiler error because Control is non static.
any clues?
[quoted text, click to view] SharpCoderMP wrote:
> oops, sorry. ingore my previous post - i had wrong assembly reference
> path in the source project.
>
> anyway, your advice does not help :( or probably i'm doing something
> wrong. it looks like there is no difference whether your code exists or
> not. no aditional references are added to the final project when i drop
> this problematic control on the form.
>
> maybe i did something wrong? could you tell me what did you ment by this
> two fragments?
> 1. [...] control.Site.GetService [...] - what is _control_? is it my
> control that references other assemblies?
> 2. assN.Name = fullAssemblyName; - i assume that _fullAssemblyName_ is
> the name of the referenced assembly that should be added to the references?
>
> sorry for this, but i admit that when comes to this part of .net
> programing i'm still a noob :/ i just never needed this.
>
> SharpCoderMP wrote:
>
>>hi,
>>
>>i've used your code, but now i have a different problem:
>>when i drop my control on the form i get message saying "The .NET
>>assembly 'myAsseblyName' could not be found." after that the control is
>>not placed on the form.
>>so it looks like the control chcecks for the referenced assemblies but
>>cannot find them. what can i do to make it find them? when i manually
>>add the missing asemblies to the project and then drop the control -
>>everything is fine. but i would like to have this references added
>>automatically.
>>
>>
>>InK_ wrote:
>>
>>
>>>hi
>>>
>>>You should write something like this:
>>>
>>>ITypeResolutionService resources = (ITypeResolutionService)
>>>control.Site.GetService(typeof (ITypeResolutionService));
>>>
>>>IReferenceService irs = (IReferenceService) control.Site.GetService(typeof
>>>(IReferenceService));
>>>
>>>AssemblyName assN = new AssemblyName() ;
>>>
>>>assN.Name = fullAssemblyName;
>>>
>>>
>>>if (irs != null && irs.GetReference(fullAssemblyName) == null)
>>>
>>>{
>>>
>>>resources.ReferenceAssembly(assN);
>>>
>>>}
>>>
>>>It will add fullAssemblyName into the references of the project.
>>>
>>>Regards,
>>>
>>>Inna Stetsyak aka InK_
>>>
>>>"SharpCoderMP" <csharp_mp@interia.pl.NFSPM> wrote in message
>>>news:uXl2t$eIGHA.216@TK2MSFTNGP15.phx.gbl...
>>>
>>>
>>>
>>>>hi,
>>>>
>>>>i've created very complicated custom control that sits inside the dll.
>>>>the problem is that this custom control needs two other dlls from
>>>>different namespaces. now when i drop my control on the form in the
>>>>final project (using vs.net 2k3) only the reference to the dll with
>>>>custom controll is added to the project references. what can i do to
>>>>have vs.net automatically add two other references to dlls that this
>>>>control needs? if i try to compile the project without these two
>>>>referenced dlls i got errors related to the properties of this controll
>>>>that reference these missing dlls. when i add the references manually
>>>>then everythig works fine, but i would like to have it done automatically.
>>>
>>>
>>>
Don't see what you're looking for? Try a search.