468,504 Members | 1,968 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

"Reference required to assembly 'RootLevel' containing the type 'RootLevel.Root'. Add one to your project."

While building on a class library for an object model, I get the above error
message.

The steps to recreate the problem are as follows:

1. Build a RootLevel.dll containing only this code:

Public Class Root
End Class

2. Build a SecondLevel.dll containing a reference to RootLevel.dll and only
this code:

Public Class Child
Private _root As RootLevel.Root

Public Property Root() As RootLevel.Root
Get
Return _root
End Get
Set(ByVal value As RootLevel.Root)
_root = value
End Set
End Property
End Class
3. Edit the Root class, add a reference to SecondLevel.dll and Re-build the
RootLevel.dll. The edited code looks like this:

Public Class Root
Private _child1 As SecondLevel.Child 'there will be other children

Public ReadOnly Property Child1() As SecondLevel.Child
Get
If _child1 Is Nothing Then
_child1 = New SecondLevel.Child()
_child1.Root = Me
End If
Return _child1
End Get
End Property
End Class

The reference to 'Me' is marked with the following error by the Visual
Studio.NET IDE:
"Reference required to assembly 'RootLevel' containing the type
'RootLevel.Root'. Add one to your project."
Obviously, this a simplified example, where children are plugged into the
root as needed. The children can be pretty complex and considerably
different from each other. Children need to reference the root, and children
often need to reference each other.

How do I work around this circular compilation reference situation or
whatever is going on here?

Thanks,
Kelly
Nov 20 '05 #1
7 3053
"Good Enchiladas" <go************@hotmail.com> schrieb
3. Edit the Root class, add a reference to SecondLevel.dll and
Re-build the RootLevel.dll.


This is the problem. You're trying to create circurlar references between
DLLs. This is not recommended.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Okay, I'll buy that. What is the workaround? What design change do I need to
make?

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Good Enchiladas" <go************@hotmail.com> schrieb
3. Edit the Root class, add a reference to SecondLevel.dll and
Re-build the RootLevel.dll.


This is the problem. You're trying to create circurlar references between
DLLs. This is not recommended.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
For Armin,

See my answer above first I did not see there was a reposting.

Cor
Nov 20 '05 #4
"Good Enchiladas" <go************@hotmail.com> schrieb
Okay, I'll buy that. What is the workaround? What design change do I
need to make?


http://groups.google.com/groups?thre...TNGP11.phx.gbl
especially 4th msg in the thread

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* "Cor Ligthert" <no**********@planet.nl> scripsit:
See my answer above first I did not see there was a reposting.


I don't see any answer written by you?!

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
I answered an almost the same question about a wrong class name.

There was used root root child, and had to be in my opinion something as
root child rootlevel

Cor
Nov 20 '05 #7
* "Cor Ligthert" <no**********@planet.nl> scripsit:
I answered an almost the same question about a wrong class name.


OK, I didn't know that. I only wanted to make sure that my newsreader
doesn't hide part of the thread.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael Steidl | last post: by
5 posts views Thread by Lionel | last post: by
5 posts views Thread by TomislaW | last post: by
14 posts views Thread by Geoff Jones | last post: by
2 posts views Thread by Kevin Frey | last post: by
2 posts views Thread by Steve | last post: by
3 posts views Thread by Lord0 | last post: by
2 posts views Thread by =?Utf-8?B?UGF1bCBMaW52aWxsZQ==?= | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.