Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting EF 6 from NuGet to install on F# projects

I can't seem to get Entity Framework 6.0.1 to install on a couple of F# projects I have. This is the error message I'm getting:

Executing script file 'C:\source\payboard\PayboardWeb\packages\EntityFramework.6.0.1\tools\install.ps1'. Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.FSharp.ProjectSystem.Automation.OAProject' in assembly 'FSharp.ProjectSystem.Base, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\source\payboard\PayboardWeb\packages\EntityFramework.6.0.1\tools\EntityFramework.psm1:633 char:5 + $domain.SetData('project', $Project) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SerializationException

System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.Entity.ConnectionFactoryConfig.InitializeEntityFrameworkCommand.Execute() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

It seems like there's an open bug for it on the EF6 forums (https://entityframework.codeplex.com/workitem/891), but it hasn't gotten any love, so far as I can tell.

EF6 installs just fine on non-F# projects.

Any suggested workarounds?

like image 414
Ken Smith Avatar asked Oct 18 '13 23:10

Ken Smith


People also ask

Does EF core support EDMX?

EF Core does not support the EDMX file format for models. The best option to port these models, is to generate a new code-based model from the database for your application.

Is EF core better than EF6?

Keep using EF6 if the data access code is stable and not likely to evolve or need new features. Port to EF Core if the data access code is evolving or if the app needs new features only available in EF Core. Porting to EF Core is also often done for performance.


1 Answers

This is getting unblocked in EF6.1. Here is the workitem.

Note that the issue here is not EF itself but how the package is being added to your project. This makes me think that until EF6.1 is released you could probably work around this issue by getting the package unzipping it and adding references to EF6 assemblies manually to your project. Then you would have to update your config accordingly. (You could also create a temp C# project add the EF6 NuGet package which will give you the EntityFramework and EntityFramework.SqlServer dlls you could copy to your F# project and also a config file you could copy from which will be much easier than coming with the right configuration on your own)

like image 126
Pawel Avatar answered Sep 20 '22 13:09

Pawel