SOLUTION : indirect reference to assembly

E

Eric Barr

I saw a small number of old threads about a strange build error, but never
saw a solution. I just spent about 4 hours debugging this so i hoped i
could help out people who come across this problem by posting a solution.
Anyway, here is what i was experiencing and how i fixed it ...

The Build Error:
Project '<projectname>' makes an indirect reference to assembly
'<assemblyname>' which contains '<classname>'. Add a reference to
'<assemblyname>' to your project.
The problem:
I did have project reference. Grrrr!
No line numbers , the .NET help topic ...no use.

Setup :


Assembly_A --> contains public class (Class_A) which contains Public Enum
(Enum_A)
these enum is within the class (not sure if this matters)

Parent_B --> public property (Prop_forEnumA) get/set of type
Assembly_A.Class_A.Enum_A

Child_C --> public property (Prop_forEnumA) get/set of type
Assembly_A.Class_A.Enum_A


Steps :

Parent_B instantiates instance of Child_C
Parent_B runs a line of code something like

myChild_C.Prop_forEnumA = Me.Prop_forEnumA '<-- breaks here

Resolution:
myChild_C.Prop_forEnumA = System.Convert.Int32(Me.Prop_forEnumA) '<-- not
broken


===================================================
The closest i could find was a 2002-12-29 thread in
microsoft.public.dotnet.languages.vb by Shahin Kohan.

http://groups.google.com/groups?hl=...rect+reference+to+assembly&btnG=Google+Search

- - - - - - - - - - - - - - - - - - - - - - - - - -
- When I try to build a project I get the following Error.

C:\Projects\MembershipManager\MMSystemWinUI\frmPaymentTypes.vb Project
'MMSystemWinUI' makes an indirect reference to assembly 'MMCommon', which
contains 'Valleris.MMCommon.IMemberClass'. Add a reference to 'MMCommon' to
your project.

I already have a refernace to MMCommon in the referance section. Can anyone
tell me why I get this.

Shahin- - - - - - - - - - - - - - - - - - - - - - - -
- - - Hi,

The problem has been reported before. However, it cannot be reproduced. The
problem was resolved by creating a new project and adding all the files
into it.

Please try it to see whether it helps.

--
Parker Zhang
Microsoft Developer
upport- - - - - - - - - - - - - - - - - - - - - - - -
- - -

I was able to solve it by doing the following:

1. Delete all dll and exe's that are created from all the projects in the
solution
2. Delete all the referances from all projects to each other in the same
solution
3. Add all the referances again back to all the projects
4. Recomplile the projects


Also I have noticed this to be a problem when you have strong names. If it
happens again I will be more then happy to help you reproduce it.

I hope this problem is resolved in the next version.

Shahin===================================================


Anyway, hope that helps.
-eric
 

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