Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have this class:

using System;
using System.Web.Mvc;
using System.Data;
using BLL;

namespace LicenseManager.Controllers
{
    public class ValidationController : BaseController
    {
        public ActionResult Default()
        {
            return View("Default");
        }

        [HttpPost]
        public JsonResult ClearInstallation(FormCollection form)
        {
            var jr = new JsonResult();
            try
            {
                var licMgr = new BLL.LicManager();
                licMgr.ClearInstall(form["regKey"], form["checkKey"]);

            }
            catch (Exception exc)
            {
                jr = Json(new { success = "false", error = exc.Message });
            }

            return jr;
        }
    }
}

When I try to rebuild or debug I receive the error: The type of namespace name 'BLL' could not be found (are you missing a using directive or an assembly reference?)

I can see that it is referenced:

enter image description here

The intellisense works, and I don't have any errors, until I try to rebuild or compile. I know it exists, and it finds it for intellisense purposes, so why won't it allow me to rebuild or compile?

I have tried:

  • cleaning the solution
  • rebuilding
  • clearing the reference and re-adding it

What else can I try?

UPDATE If you get this error, make sure you read the output. It contained the solution for me.

like image 731
davids Avatar asked Oct 11 '25 14:10

davids


1 Answers

I had a similar problem when the referenced project was using a different .net framework. Make sure the project you are building and the project you have referenced are using the same framework.

You can verify/change the framework in properties/application/target framework

like image 115
user2639740 Avatar answered Oct 14 '25 04:10

user2639740