问题
I was trying repository pattern with ASP.Net 5 project and service project. I referenced my ".Service" class library project into my ".Web" project but something went wrong with the reference. I removed all referenced to other libraries, even removed my ".Service" and ".Web" projects and added new empty ones but the newly created ".Web" project still referencing the old version of deleted ".Service" project.
".Web" > ASP.Net 5 project. ".Service" > .Net Framework 4.5.1 class library project.
[URL for project on github] https://github.com/ahmedhelmy204/Publess/tree/master/Publess
Screenshot of the current issue state
回答1:
Your repository don't Publess.Data, which you reference and includes Publess.Core on the wrong place (see here and compare with github.com/ahmedhelmy204/Publess/tree/master/Publess/artifacts/...). Moreover the wrap folder contains EntityFramework.SqlServer and EntityFramework, which should be removed.
The directory wrap/EntityFramework.SqlServer for example contains project.json with wrong version number 1.0.0 for EntityFramework and it informs to get EntityFramework.SqlServer.dll from .../Publess.Data/bin/Debug folder
{
"version": "1.0.0-*",
"frameworks": {
"net451": {
"bin": {
"assembly": "../../Publess.Data/bin/Debug/EntityFramework.SqlServer.dll"
},
"dependencies": {
"EntityFramework": "1.0.0-*"
}
}
}
}
The wrap folder will be created when you add old project or old assembly to new ASP.NET 5 project. The entries wrappedProject and bin with assembly and pdb will be created. One can use Visual Studio or dnu wrap to do this (see dnu wrap -h). See the answer, the documentation or the post.
Some additional advices can gives you the source code of dnu wrap. See here and here and here
来源:https://stackoverflow.com/questions/34838838/asp-net-5-project-referencing-old-class-library