Compilation queries using vbc with regards to namespaces

S

Samuel Hon

Hi

I'm using the vbc compiler and I'm trying to reorganise my Namespaces
according to the bit in here:

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=336

Basically, it suggests that you create a new directory for each
Namespace and nest them as necessary with each class in a diff file in
the directory.

For example (I'm not actually compiling this MS code):

/System/
/System/MyClass.vb
/System/Data/
/System/Data/SQLClient/
/System/Data/SQLClient/SqlCommand.vb
/System/Data/SQLClient/SqlParameter.vb
/System/Web/
/System/Web/Mail/
/System/Web/Mail/MailMessage.vb

I'm compiling using a command line similar to
vbc /recurse:*.vb /out:MyDLL.dll

However, when compiling MyClass.vb which imports from SqlCommand.vb,
it says:
BC30466: Namespace or type "SQLClient" for the Imports
"System.Data.SQLClient" cannot be found.

I am aware that you normally add resource files in the command line
similar to:
/r:system.Data.dll

Does this mean that I have to compile each class or directory before
building a larger dll?

Thanks in advance

Sam
 
B

Bharat Patel [MSFT]

Hi Sam,

You need to provide all the references to the compiler with /r switch before
you can compile the assembly.
For more details review the following site

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaco
nInvokingCommandLineCompiler.asp

Look for sample compilation command lines at the above link.


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
S

Samuel Hon

Hi Sam,

You need to provide all the references to the compiler with /r switch before
you can compile the assembly.
For more details review the following site

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaco
nInvokingCommandLineCompiler.asp

Look for sample compilation command lines at the above link.


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.

Hi Bharat

Thanks for the post. I'm more interested in using the /recurse option
and it looks like i have to specify a sub directory to get it to work,
so

vbc /out:MyDLL.dll /recurse:sourcefiles\*.vb

with the .vb files in sourcefiles and use it multiple times rather
than it actually going into all the subdirectories for me

Cheers

Sam
 

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