473,811 Members | 2,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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 27036
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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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***********@y ahoo.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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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(pa ram1, 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.goo glegroups.com.. .

an***********@y ahoo.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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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(pa ram1, 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.goo glegroups.com.. .

an***********@y ahoo.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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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***********@y ahoo.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(pa ram1, 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.goo glegroups.com.. .

an***********@y ahoo.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.goo glegroups.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
"MyTestClas s" 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.W ebControls.WebP arts;
Line 10: using System.Web.UI.H tmlControls;
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
9231
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); DataSet ds = new DataSet(); myCmd.FillDataSet(ds, "test");
3
13297
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 directive or an assembly reference Platform SDK 1.1 is successfuly installed (under Win2000+SP4) So how can cope with this problem? Joe
8
3659
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 framework. Project 1. Main winforms exe a. Has a reference to project 2
1
2525
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 declares a namespace of FarmLand and a class of WebForm1. Does one have to restrict which namespace one uses in Codebehind forms? Maybe match the namespace the aspx file has? When one adds a namespace then does one have to move the file to a...
7
4749
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 project. The same class lib is included in the ASP.NET Web Application that calls the web-method I can successfully call the web-method with
1
18214
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 is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
2
20848
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. Security Exception Description: The application attempted to perform an operation not
2
30026
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 directive or an assembly reference?) PropertyCollectionAll.cs 17 39 I looked to .NET 2 help and found that Collection class is included in mscorlib so it doen't need assembly reference. How to fix this error ?
5
5216
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> <VendorName>Specialized Americas</VendorName>
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10124
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.