Sharepoint Entity Framework 6 Code First Migrations Could not load file or assembly System.Design, Version=15.0.0.0

0

I want to use Entity Framework 6 Code First with Sharepoint 2013 Farm Solutions. Everything works find when I migrate the database (using C# and Console Application).

But then I made a change to model (changed one property from int to string). I wanted to update model but then I had an exception:

Could not load file or assembly 'System.Design, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I tried and added reference to the project to System.Design. Then I got an exception: Could not load file or assembly 'System.Design, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Eventually I removed/commented all Sharepoint references from project and removed the project from GAC. Only then add-migration and update-database have worked.

My solution works but it is time consuming and I would love if there was a better one.I think it can be related to System.Design, Version=15.0.0.0 - from what I have found, there is no such version, only 2 or 4. Is there version 15 or is it a Sharepoint bug?

entity-framework
sharepoint
ef-migrations
asked on Stack Overflow Jun 24, 2019 by Pati K

1 Answer

0

Try to add the following key to the section in your web.config:

<compilation debug="true" targetFramework="4.5" >    
    <assemblies>
      <add assembly="System.Design, Version=15.0.0.0, 
          Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </assemblies>
</compilation> 
answered on Stack Overflow Jun 24, 2019 by Fox

User contributions licensed under CC BY-SA 3.0