all groups > dotnet windows forms designtime > january 2006 >
You're in the

dotnet windows forms designtime

group:

vs.net 2k3 dll reference issue


vs.net 2k3 dll reference issue SharpCoderMP
1/25/2006 9:43:00 PM
dotnet windows forms designtime:
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
Re: vs.net 2k3 dll reference issue SharpCoderMP
1/27/2006 4:01:06 PM
hi,
thaks for your help. two more questions:

the fullAssembyName is the name of the dll that my control needs nad
that is not added by default to the project references when i drop my
control on the new form?

can you tell me where should i put this code? in the constructor of the
control? inside some method override?

[quoted text, click to view]
Re: vs.net 2k3 dll reference issue InK_
1/27/2006 4:37:48 PM
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_

[quoted text, click to view]


Re: vs.net 2k3 dll reference issue jokiz
1/29/2006 11:03:49 AM
i would try to reconsider the design of the assemblies. would you mind
if i ask what the two assemblies contain?
Re: vs.net 2k3 dll reference issue SharpCoderMP
1/29/2006 10:59:21 PM
[quoted text, click to view]
it's rather complicated but i'll try :)

the main assembly contains control itself that is used more or less like
a canvas to draw and manipulate document object which is defined in
another assembly (this is logical because the canvas can be used for
various types of document objects that derive from certain abstract
clases). the third assembly provides definitions of typographic based
measurment structures (like point, size, rectangle) along with methods
that allow unit conversions (like point to milimeter or pixel to point
and so on). all the sizes and locations of objects in these documents
are defined by these special measurment structures. this assembly is
separate because it is universal for few of my other projects.

phew, i hope this is not too complicated :)
i can't see how could i put all this stuff into one assembly. so the
question remains - what can i do to prevent this reference issues during
Re: vs.net 2k3 dll reference issue InK_
1/30/2006 2:31:16 PM
Hi

Sorry for delay.
You can add this code into constructor in design time.

Thus you should check if it's design mode in the contructor of the control
and add this code, otherwise if you're not in design mode no addition to the
reference should be done.

Regards,
Inna Stetsyak aka InK_



[quoted text, click to view]


Re: vs.net 2k3 dll reference issue SharpCoderMP
2/3/2006 2:12:44 PM
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.


[quoted text, click to view]
Re: vs.net 2k3 dll reference issue SharpCoderMP
2/3/2006 2:32:10 PM
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]
Re: vs.net 2k3 dll reference issue SharpCoderMP
2/3/2006 2:47:24 PM
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]
AddThis Social Bookmark Button