473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

The type or namespace name could not be found

Hi, guys,

I am using Visual Web Developer Express 2005 for my web application.

I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.

I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.

Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?

But, when I test my web application, I still get this error message:

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

Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:

If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?

Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?

Thanks.

Nov 14 '06 #1
6 26994
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,

I am using Visual Web Developer Express 2005 for my web application.

I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.

I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.

Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?

But, when I test my web application, I still get this error message:

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

Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:

If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?

Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?

Thanks.

Nov 14 '06 #2

Juan T. Llibre wrote:
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,

I am using Visual Web Developer Express 2005 for my web application.

I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.

I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.

Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?

But, when I test my web application, I still get this error message:

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

Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:

If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?

Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?

Thanks.
Aha, thanks a lot, Juan!

AL

Nov 14 '06 #3

an***********@yahoo.com wrote:
Juan T. Llibre wrote:
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,
>
I am using Visual Web Developer Express 2005 for my web application.
>
I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.
>
I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.
>
Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?
>
But, when I test my web application, I still get this error message:
>
Compiler Error Message: CS0246: The type or namespace name
'MyTestClass' could not be found (are you missing a using directive or
an assembly reference?)
>
Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:
>
If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?
>
Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?
>
Thanks.
>

Aha, thanks a lot, Juan!

AL
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.

Nov 14 '06 #4
re:
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.
The using directive at the beginning of a code-behind file enables you to use
unqualified class names to reference the DLL methods at compile time:

Class.Method(param1, param2);

Otherwise, you have to use the fully qualified name:

Namespace.Class.Method(param1, param2);

If your class doesn't have a namespace...add one to it.
Then, you can import the namespace with the "using" directive.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...

an***********@yahoo.com wrote:
Juan T. Llibre wrote:
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,
>
I am using Visual Web Developer Express 2005 for my web application.
>
I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.
>
I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.
>
Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?
>
But, when I test my web application, I still get this error message:
>
Compiler Error Message: CS0246: The type or namespace name
'MyTestClass' could not be found (are you missing a using directive or
an assembly reference?)
>
Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:
>
If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?
>
Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?
>
Thanks.
>

Aha, thanks a lot, Juan!

AL
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.

Nov 14 '06 #5
Juan T. Llibre wrote:
re:
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.

The using directive at the beginning of a code-behind file enables you touse
unqualified class names to reference the DLL methods at compile time:

Class.Method(param1, param2);

Otherwise, you have to use the fully qualified name:

Namespace.Class.Method(param1, param2);

If your class doesn't have a namespace...add one to it.
Then, you can import the namespace with the "using" directive.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...

an***********@yahoo.com wrote:
Juan T. Llibre wrote:
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,

I am using Visual Web Developer Express 2005 for my web application.

I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.

I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.

Now, in the code-behind file Default.aspx.cs for Default.aspx, whenI
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?

But, when I test my web application, I still get this error message:

Compiler Error Message: CS0246: The type or namespace name
'MyTestClass' could not be found (are you missing a using directiveor
an assembly reference?)

Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:

If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?

Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?

Thanks.
Aha, thanks a lot, Juan!

AL

BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.
It was hectic the last 2 days, and I did not have a chance to test it
out.

Now, I just tried giving it a namespace called MyTestNamespace, then
compiled using csc at the DOS console and put the dll to the bin
folder, removed the .cs source code.

The IDE can still recognize this newly-defined namespace, but the
compiler makes the same complaint.

I did the same thing before, and it worked right in the App_Code
folder. In other words, I did not have to create a bin folder and put
the dll in it.

Hmm, muy extraño.

Nov 16 '06 #6
an***********@yahoo.com wrote:
Juan T. Llibre wrote:
re:
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.
The using directive at the beginning of a code-behind file enables you to use
unqualified class names to reference the DLL methods at compile time:

Class.Method(param1, param2);

Otherwise, you have to use the fully qualified name:

Namespace.Class.Method(param1, param2);

If your class doesn't have a namespace...add one to it.
Then, you can import the namespace with the "using" directive.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...

an***********@yahoo.com wrote:
Juan T. Llibre wrote:
If you compile MyTestClass.cs manually from the command-line,
place MyTestClass.dll in the /bin directory and remove MyTestClass.cs
from the App_Code folder.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<an***********@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi, guys,
>
I am using Visual Web Developer Express 2005 for my web application.
>
I wrote a simple class called MyTestClass.cs and put it in the App_Code
folder.
>
I compiled it to library from the DOS console using the command line
compiler csc and got a new file called MyTestClass.dll in App_Code.
>
Now, in the code-behind file Default.aspx.cs for Default.aspx, when I
try to define an object of MyTestClass, the IDE even shows
"MyTestClass" as an option in the live code-completion drop-down list.
This suggests that MyTestClass.dll has been properly recognized,
doesn't it?
>
But, when I test my web application, I still get this error message:
>
Compiler Error Message: CS0246: The type or namespace name
'MyTestClass' could not be found (are you missing a using directive or
an assembly reference?)
>
Line 9: using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using MyTestClass;
Line 12:
Line 13:
>
If I comment out Line 11, I will get the same error message at line
where I define the MyTestClass object. It looks like that just because
the IDE recognizes a type or namespace doesn't mean the compiler knows
about it, right?
>
Mind I asking what is wrong? I know nothing about assembly yet. Will
assembly come to the rescue?
>
Thanks.
>
>
Aha, thanks a lot, Juan!
>
AL
BUT, the compiler still makes the same complaint. I've removed
MyTestClass.cs and have put MyTestClass.dll into bin.

It was hectic the last 2 days, and I did not have a chance to test it
out.

Now, I just tried giving it a namespace called MyTestNamespace, then
compiled using csc at the DOS console and put the dll to the bin
folder, removed the .cs source code.

The IDE can still recognize this newly-defined namespace, but the
compiler makes the same complaint.

I did the same thing before, and it worked right in the App_Code
folder. In other words, I did not have to create a bin folder and put
the dll in it.

Hmm, muy extraño.
I got it, I have to make the folder of my web application a virtual
directory. And then it is works.

Nov 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthew Louden | last post by:
using System.Data; using System.Data.SqlClient; //etc... SqlConnection conn = new SqlConnection(connString); SQLDataSetCommand myCmd = new SQLDataSetCommand("select * from Test;", conn);...
3
by: Joe DeAngelo | last post by:
When I try to compile a source code which should normally run I got this error message error CS0246: The type or namespace name 'XmlSchemaSet' could not be found (are you missing a using...
8
by: Chris Smith | last post by:
Experience posters, I am an experienced vb/vb.net developer but having a bit of trouble converting a bit of code to C#. I have 3 projects in one solution. Trying to create a plug-in type...
1
by: Randall Parker | last post by:
Using VS 2003 and Cassini web server. I'm new to ASP.Net and so this may be a dumb question. I'm getting an error where the type 'FarmLand.WebForm1' is not found. The Codebehind C# source file...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
2
by: AnalogKid17 | last post by:
Keywords: ASP.NET app with VS2005 running on Win2003 with IIS6, and SQL2000 on a WinXP Box I've betting the following for days... it's driving me insane: Server Error in '/' Application. ...
2
by: Andrus | last post by:
I'm trying to compile myGeneration PropertyCollectionAll.cs file with VCS Express 2005 bot got error Error 1 The type or namespace name 'Collection' could not be found (are you missing a using...
5
by: mknoll217 | last post by:
I am a newbie at XML. I have been given an xml document that I need to write the schema for, for a class assignment. The xml given to me is <?xml version="1.0"?> <Vendors> <Vendor> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.