Trouble using vbc compiler with command line options

Posted on 2006-05-26
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.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
    LVL 96

    Expert Comment

    by:Bob Learned
    Try this:

    vbc /target:library /out:test.dll /r:System.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
    Here are examples:

    Compiling and Running Code Examples

    LVL 9

    Author Comment

    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

    Your code needs imports too:

    Imports System
    Imports System.Xml


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now