I have a web page using Entity Framework that stopped working. I'm rebuilding it in VS2017. I have no errors when compiling, but when accessing the webpage I get:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'ausoftus_dbEntities1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 16: Line 17: Line 18: ausoftus_dbEntities1 db = new ausoftus_dbEntities1();
My EF is called 'Patriots'. If I encapsulate the function in a namespace in Patriots.Context.cs, my code also compiles fine referencing that namespace. But the web page returns the error that it can't find the namespace.
I checked that my project uses the same .Net version as the EF. The project properties shows Target Framework: .NET Framework 4.6.1. I'm using EF 6.2.
In Patriots.Context.cs (within App_Code folder):
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class ausoftus_dbEntities1 : DbContext
{
public ausoftus_dbEntities1()
: base("name=ausoftus_dbEntities1")
{
}
How do I make sure that System.Data.Entity is the right version?