VB.NET Compile Error - Namespace cannot be found

Posted on 2006-04-09
Last Modified: 2010-08-05

This is probably a simple question because i am a newbie at this.  I have created a vb class in the visual studio 2002 environment.  I can compile and test the class just fine through the IDE but when i try to compile the code using vbc.exe it generates an error.

I run:

"F:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\vbc" /nologo /t:library "F:\My Programs\Mp3 Cataloger\mp3Info.vb"

And then i get:

F:\My Programs\Mp3 Cataloger\mp3Info.vb(4) : error BC30466: Namespace or type 'RegularExpressions' for the Imports 'System.Text.RegularExpressions' cannot be found.

Imports System.Text.RegularExpressions

The weird thing is my other imports work just fine (listing of imports following):

Imports System.IO
Imports System
Imports Microsoft.VisualBasic
Imports System.Text.RegularExpressions

When i dont include the regular expressions (and i comment out the instances of regex i create in the code) it compiles just fine.

Can anyone tell me how to make this compile?
Question by:dave4dl
    LVL 6

    Expert Comment

    Do you have a path to your C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 or v1.4.3 etc etc etc...or 1.03 etc etc

    LVL 15

    Author Comment

    my user "path" environmental variable is:

    F:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;F:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;F:\Program Files\Microsoft Visual Studio\Common\Tools;F:\Program Files\Microsoft Visual Studio\VC98\bin;F:\WINDOWS\Microsoft.NET\Framework\v1.0.3705

    system "path" variable =

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;F:\Program Files\Microsoft SQL Server\80\Tools\BINN;F:\WINDOWS\Microsoft.NET\Framework\v1.0.3705
    LVL 11

    Accepted Solution

    Try this

    vbc class1.vb /reference:System.dll /target:library

    RegularExpressions is part of the system.dll namespace and not the vb name space, I'm assuming because you are compiling with vbc the compiler adds the vb dll automatically and so you don't have to add it as a reference as well.
    LVL 15

    Author Comment

    Thanks for the post Wabbit,
    I did try that reference and it didnt seem to help.

    I found an interesting page at

    that says i should reference System.Text.RegularExpressions.dll but i cannot find that file anywhere on my system.  I updated the .NET framework 1 and i still cannot find it.  How do i get this file?  Are regular expressions not available unless you buy the Visual Studio IDE?
    LVL 15

    Author Comment

    Well tried referencing System.dll in my compile command and it worked.  I could have sworn i tried that earlier and it didnt work. Maybe I updated .NET framework . . .

    Oh well, thanks for the help LordWabbit

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now