System.MissingMethodException after upgrading from EF 6.0 beta to RC

what does it mean?

System.MissingMethodException is not handled by user code
HResult = -2146233069 Message = Method not found: "System.Data.Entity.ModelConfiguration.Configuration.PrimitivePropertyConfiguration System.Data.Entity.ModelConfiguration.Configuration.StructuralTypeConfiguration 1.Property(System.Linq.Expressions.Expression 12!! ! 0 →) ". Source = Att.Uds.DataLayerMappings StackTrace: in Att.Uds.DataLayerMappings.ItemTypeItemConfiguration..ctor () in Att.Uds.DataLayerMappings.UdsContext.OnModelCreating (DbModelBuilder modelBuilder) in C: \ TFS \ UDS-ADS-UDS Code \ Att.Uds.DataLayerMappings \ UdsContext.cs: line 163 in System.Data.Entity.DbContext.CallOnModelCreating (DbModelBuilder MODELBUILDER) in System.Data.Entity.Internal.LazyInternalContext.CreateModelBuder.Intalal.Ulate.Ulate.Duate .LazyInternalContext.CreateModel (LazyInternalContext internalContext) in System.Data.Entity.Internal.RetryLazy2.GetValue (TInput input) InnerException:

The error in this class is:

 namespace Contoso.Fabrikam.DataLayerMappings { public abstract class NamedEntityConfiguration<TEntity> : EntityBaseConfiguration<TEntity> where TEntity : NamedEntity { public ConfigurationColumn NameColumn; protected new int LastOrdinalPosition { get { return (NameColumn.Ordinal); } } public NamedEntityConfiguration() <=== EXCEPTION HERE { NameColumn = new ConfigurationColumn() { Ordinal = base.LastOrdinalPosition+1, Name = "Name", IsRequired = true, Length = 128 }; this.Property(t => t.Name) .HasColumnName(NameColumn.Name) .HasColumnOrder(NameColumn.Ordinal) .HasMaxLength(NameColumn.Length); if(NameColumn.IsRequired) { this.Property(t => t.Name).IsRequired(); } } } } 

thanks

+4
source share
3 answers

The reason @Saber works is because when you upgrade a project to a higher version of .NET, the project file does not update automatically. For example, if you are upgrading from .NET 4.0 to .NET 4.5 and editing a project file, you can see the following:

 <Reference Include="EntityFramework"> <HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</HintPath> </Reference> <Reference Include="EntityFramework.SqlServer"> <HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.SqlServer.dll</HintPath> </Reference> 

You will need to change the link to net45 instead of net40 . When removing packages, this will lead to the same behavior.

+7
source

I encountered the same error. This worked for me:

  • Uninstall-Package EntityFramework in Package Manager Console
  • Delete EntityFramework folder from 'packages' folder
  • Install-Package EntityFramework in Package Manager Console
+6
source

In my case, I had to remove EntityFramework.dll from this folder:

C: \ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ EntityFramework

0
source

Source: https://habr.com/ru/post/1502905/


All Articles