Error accessing metadata through context model FileNotFoundException in System.ComponentModel.Annotations, Version=4.2.0.0,
My project is in Windows Forms, using 4.7.1. When I try to access the model through the context, my program returns the following exception:
System.IO.FileNotFoundException: No se puede cargar el archivo o ensamblado 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ni una de sus dependencias. The system cannot find the file specified. Nombre de archivo: 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' en Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.CoreConventionSetBuilder.CreateConventionSet() en Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateConventionSet(IConventionSetBuilder conventionSetBuilder) en Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) en System.Lazy`1.CreateValue()
Steps to reproduce
using (MaldivasBaseContext mbc = new MaldivasBaseContext(connectionString))
{
mbc.Model .... throw the exception
}
Further technical details
EF Core version: EF Core 2.1.0 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 Pro IDE: (e.g. Visual Studio 2017 15.7.2)
@JuanIrigoyen Can you post your csproj so we can see which dependencies you have?
Yes, thank you @ajcvickers Maldivas.Data.zip
I found the problem in the packages, I need to reinstall and consolidate all.