referencing an assembly and a project which references the same assembly

  • Thread starter Christopher C. Bernholt
  • Start date
C

Christopher C. Bernholt

We have a solution which contains 2 projects. The first project is a
windows control and it references an assembly. The second project is a
test windows application used to test the windows control from the
first project. As such, it references the windows control using a
project reference. In addition, it also references the same assembly
that the first project references.

The assembly which is referenced by both projects contains some UDT's
that are needed in both projects. However, when referenced as
mentioned above, we get errors such as:

Value of type 'RLC.Image.Collections.ImageInfoCollection' cannot be
converted to 'RLC.Image.Collections.ImageInfoCollection'.

where RLC.Image.Collections.ImageInfoCollection is one of the UDT's in
the referenced assembly. Also we get a number of the following errors
where the signature of an overloaded method with a primitive argument
can be used, but the other overloaded methods with UDT as the argument
cannot:

Overload resolution failed because no accessible 'LoadImages' can be
called with these arguments:
'Public Sub LoadImages(documentInfoCollection As
RLC.Image.Collections.ImageInfoCollection)': Value of type
'RLC.Image.Collections.ImageInfoCollection' cannot be converted to
'RLC.Image.Collections.ImageInfoCollection'.
'Public Sub LoadImages(imagePathCollection As
RLC.Image.Collections.ImagePathInfoCollection)': Value of type
'RLC.Image.Collections.ImageInfoCollection' cannot be converted to
'RLC.Image.Collections.ImagePathInfoCollection'.
'Public Sub LoadImages(documentInfo As RLC.Image.DocumentInfo)':
Value of type 'RLC.Image.Collections.ImageInfoCollection' cannot be
converted to 'RLC.Image.DocumentInfo'.
'Public Sub LoadImages(imagePath As String)': Value of type
'RLC.Image.Collections.ImageInfoCollection' cannot be converted to
'String'.

Anyone ever experienced this? I'm assuming it has to do with the way
the references are being read.

Thanks!
 
C

Chris

It sounds as if you have two different copies of the same code in your
UDT .dll. Are all the projects in the same solution? How is the UDT
assembly referenced in both projects? Do they just have a copy of the
..vb file or do they directly reference a compiled .dll?

Is the UDT code, that both projects reference, a compiled .dll or does
each project have a copy of the .vb file?
 
C

Christopher C. Bernholt

It sounds as if you have two different copies of the same code in your
UDT .dll. Are all the projects in the same solution?

There is 1 solution with 2 projects, the project for the control
itself, and the test project.

How is the UDT assembly referenced in both projects? Do they just have a copy
of the .vb file or do they directly reference a compiled .dll?

They directly reference a compiled .dll although not the same physical
..dll. Each project has a ref folder in which the dll is stored and
each project references the .dll from its own ref folder. So for
instance if project 1 was in MyProjects\Project1 and project 2 was in
MyProjects\Project2, the dll reference would be
MyProjects\Project1\ref\assembly.dll for project 1 and
MyProjects\Project2\ref\assembly.dll for project 2. The dll's are
identical copies of each other.

Is the UDT code, that both projects reference, a compiled .dll or does
each project have a copy of the .vb file?

I'm not sure I understand the difference between this question and the
question above. All UDT functionality is accessed via a reference to a
compiled .dll as above. If I'm missing something in your question,
please let me now.

-- Chris
 
C

Chris

I'm not sure I understand the difference between this question and
the
question above. All UDT functionality is accessed via a reference to a
compiled .dll as above. If I'm missing something in your question,
please let me now.

Sorry about the duplicate question. In your original post you state
this:

<quote>
Value of type 'RLC.Image.Collections.ImageInfoCollection' cannot be
converted to 'RLC.Image.Collections.ImageInfoCollection'.
</quote>

Even though the two variables seem to have the same namespace and type
name, the compiler thinks they are different.

This suggests to me that there are two different versions of the
collection floating around. As if the same source code was used in two
separate projects. And even though they both resulted in the same
assembly name, they are seen as being different. Perhaps the
AssemblyVersion or AssemblyFileVersion for the two .dlls are different.
Have you inspected the two copies of the .dll and confirmed that the
file version number and assembly version numbers are the same? Perhaps
you can load them up in ILDASM and inspect each one and see if you can
see any differences in them.

Just some thoughts, good luck.

Chris
 
A

Atara

Thanks, This thread helped me solve my problem:
One solution that includes some projects, some of the projects has
reference to dll files.

When updating the dll reference only in one project, I got 'compiling'
error messages as
* 'fName Declaration' is declared in project 'xxx.dll', which is not
referenced by project 'myUpdatedProj.exe'.
(I do have a reference to this dll!)
* Value of type 'lib1.objectType1' cannot be converted to
'lib1.objectType1' .

so I removed the not-yet-updated-projects from the solution, and I have
no 'compiling' error, I can now build my project !

I only have to re-Add the other projects...

Atara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top