I have this configuration
internal sealed class Configuration :DbMigrationsConfiguration<IAS.Models.ApplicationDbContext> {
public Configuration() {
AutomaticMigrationsEnabled = false;
ContextKey = "IAS.Models.ApplicationDbContext";
}
protected override void Seed( IAS.Models.ApplicationDbContext context ) {
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
context.Database.ExecuteSqlCommand(File.ReadAllText(baseDir + "\\MyInsertScriptsql"));
}
}
when running upate-dataabase i get the following exception
Excepción al llamar a "SetData" con los argumentos "2": "El tipo 'Microsoft.VisualStudio.Data.Tools.Package.Internal.OAProject' del ensamblado 'Microsoft.VisualStudio.Data.Tools.Pa ckage, Version=11.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' no está marcado como serializable." En D:\Dev\Insuranse Advanced Services\IAS\packages\EntityFramework.6.0.0\tools\EntityFramework.psm1: 611 Carácter: 20 + $domain.SetData <<<< ('startUpProject', $startUpProject) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto. en System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion) en System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebProject(Project project) en System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory) en System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c_DisplayClass2.<.ctor>b_0() en System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Referencia a objeto no establecida como instancia de un objeto.
Problem solved, i opened the file ..\packages\EntityFramework.6.0.0\tools\EntityFramework.psm and the line 611 states:
$domain.SetData('startUpProject', $startUpProject)
I them after review my solution I found that the startup project was changed to the Database project, corrected this and the problem was gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With