Error CS0012 The type 'Client' is defined in an assembly that is not referenced

0

Class manipulation with EF:

ContextEF Contexto = new ContextEF();

public List<Cliente> Listar()
    {
        //var query = from c in Contexto.Cliente
            //          select c;
        return Contexto.Cliente.ToList() ;
    }

Onclick from the query page

protected void btnPesquisar_Click(object sender, EventArgs e)
    {
        ClientService service = new ClientService();
        var lista = service.Listar();

        gvListacEF.DataSource = lista;
        gvListacEF.DataBind();
    }

Error presented:

  

Error CS0012 The type 'Client' is defined in an assembly that is not referenced. You must add a reference to assembly 'DAO, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null'

    
asked by anonymous 25.09.2017 / 23:52

1 answer

1

I'm commenting on the response that was made in the comment to remove it from "No Answer"

The problem is that you are trying to use a namespace ( using DAO ) of an assembly not yet referenced in your current application:

To do this, go to Reference > Add Reference ... > Projects > Solution and select the desired assembly (in your case DAO).

The next time you build it, the error will disappear.

For more details, I recommend MSDN: link

    
26.09.2017 / 16:33