Trouble using vbc compiler with command line options

Posted on 2006-05-26
Medium Priority
Last Modified: 2010-08-05
Error BC30451: Name 'Environment' is not declared.
        pk.value = Environment.GetEnvironmentVariable("SystemDrive")

error BC30466: Namespace or type 'XPath' for the Imports 'System.Xml.XPath' cannot be found.

Imports System.Xml.XPath
error BC30002: Type 'ComClass' is not defined.

<ComClass(Configuration.ClassId, Configuration.InterfaceId, Configuration.EventsId)> _

The command I used was:

vbc /target:library /out:test.dll /reference:System.dll,System.data.dll,System.Drawing.dll,System.Management.dll,System.Windows.Forms.dll,Microsoft.VisualBasic.dll,mscorlib.dll, System.XML.dll *.vb

Can anyone help?Looks like I need to refer to all System.* libraries..How do I do that??
Question by:ankuratvb
  • 3
LVL 96

Expert Comment

by:Bob Learned
ID: 16772380
Try this:

vbc /target:library /out:test.dll /r:System.dll /r:System.data.dll /r:System.Drawing.dll /r:System.Management.dll /r:System.Windows.Forms.dll /r:Microsoft.VisualBasic.dll,mscorlib.dll /r:System.XML.dll *.vb

LVL 96

Expert Comment

by:Bob Learned
ID: 16772386
Here are examples:

Compiling and Running Code Examples


Author Comment

ID: 16781928
Hi Bob,

Tried that & the link. Nothing helped...Same error.

Is there a specific option using which I have to compile when i use a <ComClass ??

Also, the compiler's giving me errors for functions like Asc, Environment, Replace etc which are present in Microsoft.VisualBasic.dll
which i have referred.

Also, if i am referrring System.dll, I can use syntaxez like IO.File.Exists("filename")??Rite?Even that is giving me an error
saying the name IO is not declared...

LVL 96

Accepted Solution

Bob Learned earned 1400 total points
ID: 16783853
Your code needs imports too:

Imports System
Imports System.Xml


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question