Enable-Migrations Exception calling "SetData" with "2" argument(s)
<p>I created a library based on .NET 4.6.2 version.<br>
To the library, I've added the EntityFramework version 6.1.3 package.<br>
I created a model as follow  </p>

<pre><code>using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Components.Models
{
  public class Session
  {
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public string Id { get; set; }

    [Key]
    [Required]
    public string Identity { get; set; }

    [Required]
    public DateTime CreatedAt { get; set; }

    [Required]
    public DateTime UpdatedAt { get; set; }
  }
} 
</code></pre>

<p>And the dbcontext</p>

<pre><code>using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using Components.Models;

namespace Components.DataContexts
{
  public class SessionContext : DbContext
  {
    public SessionContext() : base(ConfigurationManager.ConnectionStrings["sessiondb"].ConnectionString)
    {
    }

    public DbSet&lt;Session&gt; Sessions { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      modelBuilder.Conventions.Remove&lt;PluralizingEntitySetNameConvention&gt;();
    }

  }
}
</code></pre>

<p>Then I tried to enable migration and did via </p>

<pre><code>PM&gt; Enable-Migrations
</code></pre>

<p>statement, got the error message:</p>

<pre><code>Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=14.1.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable."At D:\C#\IndustryCloud\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:720 char:5
+     $domain.SetData('startUpProject', $startUpProject)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SerializationException

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebProject(Project project)
   at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
   at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
   at System.Data.Entity.Migrations.EnableMigrationsCommand.&lt;&gt;c__DisplayClass2.&lt;.ctor&gt;b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Object reference not set to an instance of an object.
</code></pre>

<p>What do I doing wrong?  </p>

<p><strong>Update</strong> 
Here the structure, how projet is build</p>

<p><a href="https://i.stack.imgur.com/EBI5N.png"><img src="https://i.stack.imgur.com/EBI5N.png" alt="enter image description here"></a></p>

<p>In the sessiontest.cs, I wrote the test for db. </p>

<pre><code>[Test]
public void InsertARow_DbInitial_ExpectDbValue()
{

  var sn = new Session()
  {
    Identity = Random.Generate(15),
    CreatedAt = DateTime.Now,
    UpdatedAt = DateTime.Now
  };

  db.Sessions.Add(sn);
  db.SaveChanges();

}
</code></pre>

<p>The ComponentsTest project, where I wrote the unit test, the app.config looks as follow:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration&gt;
  &lt;connectionStrings&gt;
    &lt;add connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Session;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" name="sessiondb" /&gt;
  &lt;/connectionStrings&gt;
&lt;/configuration&gt;
</code></pre>

<p>And in the library(Component) itself the app.config:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration&gt;

  &lt;configSections&gt;

    &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
  &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;&lt;/configSections&gt;
  &lt;entityFramework&gt;
    &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&gt;
      &lt;parameters&gt;
        &lt;parameter value="mssqllocaldb" /&gt;
      &lt;/parameters&gt;
    &lt;/defaultConnectionFactory&gt;
    &lt;providers&gt;
      &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
    &lt;/providers&gt;
  &lt;/entityFramework&gt;

  &lt;connectionStrings&gt;
    &lt;add connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Session;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" name="sessiondb" /&gt;
  &lt;/connectionStrings&gt;

&lt;/configuration&gt;
</code></pre>