You must Sign In to post a response.
  • Category: ASP.NET

    The type or namespace name 'Class1' could not be found (are you missing a using directive or an asse

    hi frnds
    i did one project..and i upload this project files to online server.all forms k .i used dbconnection in class file inside the App_code folder.but i got a error in onlie server..

    error is

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

    how can i solve this prblm .but this project running in local machine.. i want to run in online server ..any queries pls...urgent..
  • #766023
    This error occurs when any reference of the dll/class is not found or not exist, it looks you have not referred class1 in your code ? have you make it public ? have that class dll is present in BIN folder ?
    Please paste your code so that we can help you better in order to resolve your issue

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766024
    Hi,

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

    Means..

    1)either you forgot to make that class public
    2)or that dll is not present in bin

    Provide your code for better suggestions

  • #766035
    Hi,

    The root cause of this problem is you are missing to add assembly reference to the specified file, please add the assembly reference to that project which is mentioned in your error stack trace.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766038
    hi

    if you have class1 file ? yeas means where you using this take instance like



    Class1 cls1=new Class1()
    cls1.call your method

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766040
    Hi,
    Have you deployed your application in wwwroot?
    Don't copying entire application to wwwroot, instead copying just the contents and subdirectories directly to wwwroot.
    Also please go through this URL, you will find detailed description:
    https://social.msdn.microsoft.com/Forums/en-US/4b337807-6372-48cd-9d2c-38e05b3dbb98/how-to-access-class-defined-in-appcode-folder?forum=csharpide

  • #766041
    hi frnds
    s u r all correct.but nw i used only class file connection not class library concept.thats y i got error.if it possible how to access the class file conection in online hosting server. i accessed the connection string frm this class file.that time i got this error.
    The type or namespace name 'Class1' could not be found (are you missing a using directive or an assembly reference?)

    i used object from class and called the methods in all form .til nw i am getting this error.pls how to solve this one?..

  • #766042
    For ASP.net we have two type of deployments.
    1. Web site
    2. Web application

    <b>Web site deployment </b>
    This kind of deployment you have to put all the class files inside the "App_Code" folder.

    <b>Web application</b>
    This kind of deployment you do not need to put code files(.CS). You have to put the .dll file in the "bin" folder.

    I think in your case you are creating web application and trying to put the class files in the "App_code". Check according to your application type you can deploy.

    By Nathan
    Direction is important than speed

  • #766043
    Hai Saravana,
    There could be various ways to access the class file which is under the App_Code folder. As this folder is accessible to your code files directly but when you put your code as compiled in server, you will have the dll's for other code and in that case, this file will not be accessible.
    So to access this file still, you need to make some changes in the code wherever you are trying to access this.
    You can access this code file using:
    ApplicationName.App_Code.ClassFile1
    So wherever you are using this file, try accessing using the above script and then you can build your application and put in the sever.
    The other way could be adding the namespace toy your file where you are trying to access the App_Code folder's files. So t do this, add
    using ApplicationName.App_Code;
    Now you can access your file.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments