473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Build error for VB.NET but not C#

While building on a class library for an VB.NET object model, I get
something similar to the above error message, but not with C#.

The steps to recreate the problem are as follows:

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

using System;
namespace RootLevel {
public class Root {
}
}

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

using System;
namespace SecondLevel {
public class Child {
private RootLevel.Root _root;
public RootLevel.Root Root {
get {
return _root;
}
set {
_root = value;
}
}
}
}

3. Edit the Root class, add a reference to SecondLevel.dll and Re-build the
RootLevel.dll. The edited code looks like this:

using System;
namespace RootLevel {
public class Root {
private SecondLevel.Child _child1; //there will be other children
public SecondLevel.Child Child1 {
get {
if (_child1 == null) {
_child1 = new SecondLevel.Child();
_child1.Root = this;
}
return _child1;
}
}
}
}

And it builds without an error. Unfortunately, using VB.NET, it doesn't.

1.

Public Class Root
End Class

2.

Public Class Child
Private _root As RootLevelVB.Root
Public Property Root() As RootLevelVB.Root
Get
Return _root
End Get
Set(ByVal value As RootLevelVB.Root)
_root = value
End Set
End Property
End Class

3.

Public Class Root
Private _child1 As SecondLevelVB.Child 'there will be other children
Public ReadOnly Property Child1() As SecondLevelVB.Child
Get
If _child1 Is Nothing Then
_child1 = New SecondLevelVB.Child
_child1.Root = Me
End If
Return _child1
End Get
End Property
End Class

I believe my conversion from VB.NET to C# is 100% equivalent.

The reference to 'Me' in VB.NET step 3 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 can I fix the VB.NET situation. Is this a VB.NET compiler bug or a
default C# setting that differs? How do I work around this circular
compilation reference situation or whatever is going on here?

Thanks,
Kelly
Nov 22 '05 #1
2 1336
Hi Kelly,

You have 2 answers in the language group.
Please do not multipost (sending different messages to more dotnet
newsgroups. that is anoying to answer).

Crossposting (sending one message to more newsgroup is no problem in dotnet
newsgroups)

Cor
Nov 22 '05 #2
Hi Kelly,

You have 2 answers in the language group.
Please do not multipost (sending different messages to more dotnet
newsgroups. that is anoying to answer).

Crossposting (sending one message to more newsgroup is no problem in dotnet
newsgroups)

Cor
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
5
by: David++ | last post by:
Hi there, I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for the debug version of the DLL (and this DLL works fine), however, I seem unable to build a Release version of...
0
by: ktelep | last post by:
I'm trying to build python 2.4.2 on AIX 5.3 with the IBM xlC compiler as per the notes in the AIX Readme file. Basically my make fails with the errors listed below. I'm calling configure with:...
1
by: | last post by:
I'm having a problem finding the cause for this problem. I have a solution in Visual Studio 2005 that contains two projects -- a Web Site and a Class Library. The web site references the class...
1
by: Ted Zeng | last post by:
Hi, I am new to Python. I am trying to build MySQLdb for my PowerPC PowerMac. I just downloaded the source last week and tried to build it. But I got the error messages as follow. I checked and...
6
by: Soren | last post by:
Hi! I'm trying to extend my python program with some C++ code. Right now I've spent hours just trying to get boost to work! I'm trying to get the example hello.cpp to work. Using Windows XP...
0
by: Darrin Thompson | last post by:
I've been trying to build pyOpenSSL on Windows with Visual Studio 2003. I've hit the message below: building 'OpenSSL.SSL' extension creating build\temp.win32-2.5\Release\src\ssl C:\Program...
5
by: eranshuman | last post by:
Hi, I m very new to perl I m running an API which have the Buil.pl When Im compiling using perl Build.pl I was getting error : Can't locate Module/Build.pm in @INC (@INC contains:...
1
by: Owen Zhang | last post by:
I am trying to build lxml package in SunOS 5.10. I got the following errors. Does anybody know why? $ python setup.py build Building lxml version 2.1. NOTE: Trying to build without Cython,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.