Attualmente sto provando ASP.NET Core 1.0 RC2. Ho creato come un progetto .NET Framework (in contrapposizione a un progetto .NET Core) e riferimenti aggiunto alla nostra biblioteca Models
, utilizzando .NET Framework 4.5, tramite un riferimento al progetto:"Impossibile trovare il nome di tipo o spazio dei nomi" in ASP.NET Core 1.0 RC2
"frameworks": {
"net46": {
"dependencies": {
"Project.Core": {
"target": "project"
},
"Project.DataAccess": {
"target": "project"
},
"Project.Encryption": {
"target": "project"
},
"Project.Models": {
"target": "project"
},
"Project.Resources": {
"target": "project"
}
}
}
},
Ora, quando l'aggiunta di una direttiva modello per mio punto di vista, il seguente errore si è verificato:
@model System.Collections.Generic.List<Project.Models.User>
The type or namespace name 'Project' could not be found (are you missing a using directive or an assembly reference?)
public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.Generic.List<Project.Models.User>>
The type or namespace name 'Project' could not be found (are you missing a using directive or an assembly reference?)
public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<System.Collections.Generic.List<Project.Models.User>> Html { get; private set; }
Esso mostra anche in intelliSense: non può risolvere tag 'Project.Models.User' 'modello' e Impossibile risolvere il simbolo
Ho aggiunto un riferimento al progetto, aggiunto un'istruzione using ... Ancora questo errore si verifica. Perché?
Questo bug è ancora presente in ASP.NET Core 1.1 in Visual Studio 2017. –
Dai commenti su https://github.com/aspnet/Mvc/issues/4686 e https://github.com/aspnet/Razor/issues/755 sembra che le persone abbiano risolto il problema con successo. Cosa succede se provi i metodi descritti qui? @MichaelMortensen – bzlm
L'ho risolto usando la tua risposta e ho presentato un errore a Microsoft. Sto usando VS2017. –