Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace could not be found

Status
Not open for further replies.

jerjim

Programmer
Jan 4, 2001
85
0
0
PH
I created a namespace consisting of two cs files (uSqlREBrokers.cs and uSqlREProperties.cs). This namespace references another namespace. The compile command line I used to create the namespace or the dll file ( uSqlRE.dll) is

csc /target:library /out:uSqlRE.dll /R:yJCore.DLL uSqlREBrokers.cs uSqlREProperties.cs

I now have an aspx file (loginnew03.aspx) which inherits from a code behind file (loginnew03.cs).
The code behind file has this statement

using uSqlRe;

When I load loginnew03.aspx into internet explorer, i get the following compilation error

CS0246: The type or namespace name 'uSqlRE' could not be found (are you missing a using directive or an assembly reference?)

What should I do to correct this

 
In order to be able to reference another namespace, all that has to be present is the .dll file where this namespace is declared.

There's one catch. It must be in the /bin directory of the application where you plan to use it... since when you compile, that's where the compiler looks for everything.

There are two exceptions to this rule.

(1) the namespace has been compiled in the global assembly cache (check out documentation on how to do this). You can then just reference it just as you would any other built in namespace (system.data, etc...)

(2) there's a way to tell the compiler that you don't have a local copy of the .dll, even if it's not in the global assembly cache -- and I assume you'd pass it a reference to the dll at that point. Unfortunately, the only time I've done this is through VID (a simple property), so I don't know how to do it strictly with the SDK, but again, I'm sure it's in the documentation if you fish around a bit.

If it is in the /bin directory of the application where the aspx file is that you're trying to use it in, then everything should compile just fine. I'd check that first.

:)
paul
penny1.gif
penny1.gif
 
Thanks Paul. I did read about the bin folder (directory) but I suppose I got overwhelmed by all the new things in Net Framework SDK documentation that it didn't sink in or I failed to connect my problem with the role of the bin folder.

Unlike other professions like doctors, engineers or lawyers, we poor pathetic souls in IT have to periodically (like every two to three years) throw out a lot of the stuff we learn and adapt to some new technology.

How would a lawyer feel if the state suddenly decides to throw out its whole body of laws and lawyers have to spend at least six months or a year studying the new laws. And in those six months you aren't earning anything?

Well this is the profession we chose !!!



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top