.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Type or namespace error.

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

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

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


View Complete Post

More Related Resource Links

Error Build: Type or namespace could not be found, when referencing a web service

Hello, I'm new in writing C# application in Visual Studio 2008. I'm currently writing a web application for CRM 4.0 Reporting Service rendering. I reference my web application to our Reporting Service web service http://reportservername /ReportServer/ReportExecution2005.asmx and name it 'RSWebReference'. Then I want to reference it in my code: Using RSWebReference; Not sure why, but I cannot build my solution, saying "The type or namespace name 'RSWebReference' could not be found (are you missing a using directive or an assembly reference?)". I read this thread in http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74f70e30-83e8-4817-b5e0-7729450730a1 that the website probably is using .net 1.1, and I should change it to .net 2.0. However, I think the website is already using 2.0. Is it probably because I'm using VS 2008? How can I tell and change if the website is using 1.1 or 2.0? Or could I be doing something wrong? Thanks in advanced for your help! -Elizabeth K.

DotNetZip Library Error - The type or namespace name 'Ionic' could not be found


I try to add some Zip functionality of my website. I use DotNetZip from Codeplex. It works without any problem in my Development Machine (Windows XP). So I upload the files to the WebServer. Now I am getting the following error.


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

How can I debug it. Please help me.

Error 2 Type or namespace definition, or end-of-file expected


Hi frnds,

I am new to this programming.. I am trying to download files from a specific folder in ftp server. after downloading those files i want to store in my computer. . I got the code on internet but wen i am trying i am getting this error Error 2 Type or namespace definition, or end-of-file expected. .  please help me very urgent. here is my complete code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Text;
using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
        string[] files = GetFileList();
        foreach (string file in files)

        public string[] GetFileList()
            string[] downloadFiles;
            StringBuilder result = new StringBuilder();
            WebResponse response = null;
            StreamReader reader = null;
                FtpWebRequest reqFTP;
                reqFTP = (FtpWebReq

VS 2010 and The type or namespace name 'AjaxControlToolkit' could not be found error?



I've installed VS2010 and I'm trying to compile my .NET 2.0 app. It went through a conversion process when I opened it, I made a backup, but I'm still targeting .NET 2.0 for now.  I have a project reference and the "ajaxcontroltoolkit.dll" in the \bin and it ran fine in VS 2008.  Do I need a different version of the toolkit I currently have (1.0.10301.0 which targets runtime v2.0.50727) to run .NET 2.0 in VS2010 now?

The error "The type or namespace name 'AjaxControlToolkit' could not be found (are you missing a using directive or an assembly reference?)"

The warning gives more info

"Warning 27 The primary reference "AjaxControlToolkit, Version=1.0.10301.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "AjaxControlToolkit, Version=1.0.10301.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" or retarget your application to a f

Error trying to extend a class, The type or namespace name 'ErrorData' does not exist in the names


I would like to create a class that extends my ErrorData class, i have not done this in a while and when i try    class ErrorDataASPX : ExceptionHandler.ErrorData and build i get msg:

Error 1 The type or namespace name 'ErrorData' does not exist in the namespace 'ExceptionHandler' (are you missing an assembly reference?) C:\ExceptionHandling\ExceptionHandler\ErrorDataASPX.cs 9 44 ExceptionHandler

namespace ExceptionHandler
    class ErrorDataASPX : ExceptionHandler.ErrorData

namespace ExceptionHandling
    using System;
    using System.Globalization;
    using System.Text;
    using System.Web;

    /// <summary>
    /// Contains information about an error.
    /// </summary>
    public class ErrorData

Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

"Type ASP.x is not defined" error for dynamic user control when publishing updateable


I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error "error BC30002: Type 'ASP.SimpleCtrl' is not defined." (If I publish without the "updateable" option there's no error, but I need the site to be updateable.)

I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for "updateable" publishing?

VS 2008 / .NET 3.5 sp1

The code follows (web.config is the default from Visual Studio).

Many thanks, Dave


<%@ Control Language="VB" ClassName="SimpleCtrl" CodeFile="SimpleCtrl.ascx.vb" Inherits="_SimpleCtrl" %>

    Simple control


Partial Class _SimpleCtrl
    Inherits UserControl

    'Nothing to see here.

End Class


<%@ Control Language="VB" CodeFile="ContainerCtrl.ascx.vb" Inherits="_ContainerCtrl"

Parser Error Message: Could not load type MasterPage File



Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'wamsilverlight.Web.Wam'.

Source Error:

Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Wam.master.cs" Inherits="wamsilverlight.Web.Wam" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Source File: /Wam.Master    Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927


All of the following have been tried over and over again:

1.) Delete all existing .dlls

2.) Delete MasterPage File and recreate it.

3.) Delete MasterPage perform a c

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Fix: The type or namespace name 'EntityDataSource' does not exist

Today's stupid mistake had me going in circles in my Web application project. The error message was: The type or namespace name 'EntityDataSource' does not exist. As the rest of the error message suggests, I must be missing an assembly reference. Nope, I'd already added in the references to Entity : System.Data.Entity System.Data.Entity.Design After much frustration until after 1 a.m., I gave up and went to bed. This morning I realized that what it wanted was the WEB Entity! System. Web .Entity System...(read more)

Object expected error


<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected


timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance

Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

How can I solve this problem?::Compiler Error Message: CS0433: The type 'CrystalDecisions.Web.Cryst


I upgraded my web application from visual studio 2003 to 2008. When I want to create a report in visual studio 2008 and receiving this error at runtime. I am able to compile but when runnning thats when I am getting this error.

How can I solve this problem? please help.

Compilation Error

Server Error in '/IRPSDEV' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Web\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Web.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\irpsdev\9e97e0a9\94a2ecd\assembly\dl3\151eb571\00df56e1_6064c201\CrystalDecisions.Web.DLL'

Source Error:

Line 161:        
Line 162:        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 163:        private global::CrystalDecisions.Web.CrystalR

Data Source View Gives incorrect Error--Different Data Type

Hi, I'm creating a report model (2008 R2).  I am trying to create a relationship between two tables.  One FKs to another--same name and type (tinyint) columns.  But the Data Source View editor doesn't allow this, giving the message "...source and destination column have different data types".  But the columns are the same types.  I ahd this once before  acouple of years ago and don't remember how I got around it. Does anyong have ideas?  

Strange: Parser Error: Could not load type '_Default'.

i donot have any intentions till now of uploading my web project and just started working on MS VS9.0I made a simple Linq based project (CODE BEHIND used)AS i compiled it i got Parser Error: Could not load type '_Default'.I figured out 2 solutions for this(WHICH I CUDNT FIND IN MANY FORUMS). But nt sure...why doing them solves the problem.SOL 1)The easy way out is to uncheck "place the code in the seperate file" while adding an item.and then adding the statement <%@ Import Namespace="System.Linq" %> on top of ur aspx as in:<%@ Page Language="C#" %><%@ Import Namespace="System.Linq" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">---FURTHER CODE----Sol2)If  we deal whith the CODE behind technique....and have already used "USING System.Linq; in the definition,I found a funny solution to the problem.In ur default page...the top line is<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="<namespace>.<class>" %>Now if i change the keyword from CodeBehind to CodeFile as in:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="<namespace>.<class>

COM Interop Error loading type library/DLL TYPE_E_CANTLOADLIBRARY error in Vista but not XP

I have created a .NET executable that is using a COM assembly that is located on a servers shared drive but am  having problems getting it to work on a number of machines. I have made sure to register the COM assembly using regsvr32 and doing that it works on the computer that I developed it on. From there I brought it over to a Windows XP computer where it didn't work. I received an error message saying "Error loading type library/DLL ... (TYPE_E_CANTLOADLIBRARY)", which was in reference to the COM assembly. After some trouble shooting I found that if I granted the executable FullTrust in the .NET security model the .NET executable was able to load the assembly and everything worked properly. From there I brought the executable to a Windows Vista computer, registered the COM assembly using regsvr32 and granted the .NET executable FullTrust in .NET but it doesn't work. I get the same error saying "Error loading type library/DLL ... (TYPE_E_CANTLOADLIBRARY)". Any idea why the same steps would work in XP but not in Vista? Am I missing something obvious? Any suggestions would be greatly appreciated.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend