EF Core Driver cannot load netstandard or one of its dependencies in LinqPad 5 - entity-framework

I created a .NET Full Framework class library using EF Core v 2.2.1 and downloaded the EF Core driver v 2.x for Linqpad 5 (5.36.03), and when I try to create a new connection to the class library DLL, I get the following error message:
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependenceis. The system cannot find the file specified.
I have clicked the 'Restore nuGet Dependencies' and it gives me the message 'No NuGet dependencies detected'.
Any thoughts?

Did exactly what #magicandre1981 suggested and targted 4.7.2 for my class library. That fixed it!

Related

Unable to resolve "Could not load file or assembly" exception in .net framework application

After upgrading the FluentValidation NuGet package in my WPF application from version 11.0.2 to 11.4.0, I began to receive the following error when attempting to execute my test suite:
System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=FluentValidation
My NuGet packages folder contains the system.threading.tasks.extensions package for versions 4.4.2 and 4.5.4, but not 4.2.0.0.
I am not sure why I am getting this error, or how to resolve it.
I have reviewed the answers to questions by others having similar problems, but without finding a solution.

Changed Entity Framework v6 to Entity Framework v4.4 - getting error

I have created an ASP.NET MVC application and my Entity Framework version is 6.0.0, but I want Entity Framework version 4.4.0.
I have referenced version $.4.0 dll and also changed the version in package.config.
I am getting this error:
"Severity Code Description Project File Line Error CS1705 Assembly
'Microsoft.AspNet.Identity.EntityFramework' with identity
'Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses
'EntityFramework, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' which has a higher version than
referenced assembly 'EntityFramework' with identity 'EntityFramework,
Version=4.4.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' Final c:\users\navya\documents\visual
studio 2015\Projects\Final\Final\Models\IdentityModels.cs
Please let me know where I have to make changes when I change my Entity Framework versions in my reference.
Simply put - you can't do that. Identity library was compiled against EF6 and it won't work with lesser version. Upgrade path from 4 to 6 lists breaking changes that will not let you use v4 in any scenario.
You can get the source code, change EF version there, adjust source code to work with v4, build binaries, reference the binaries in your project directly without NuGet package => profit (or rather a step back and a maintenance nightmare)
Or you can build your own implementation of IUserStore that relies on EF4 and make Identity use your implementation.
Other than that you are out of luck. You shouldn't really use EF4, but I suspect this is not your decision to make.

Entity Framework Add-Migration fails with "Could not find assembly"

Using Package Manage Console in Visual Studio, when I run "Add-Migration MyMigrationName" on Company.Project1 (.NET Core 1.1) I get an error
Could not find assembly 'C:\path\to\my\solution\Company.Project2\.\bin\Debug\netcoreapp1.1\Company.Project1.dll'.
The project you are running migrations on must be the startup project.

Entity Framework - can't enable code first migration

I am having some trouble enabling code first migration following the Microsoft Data Developer procedure at http://msdn.microsoft.com/en-us/data/jj591621.aspx
I am using Visual Studio 2010 and targeting .NET Framework 4.0
I can run the following steps without error:
Create a new MigrationsDemo Console application
Add the latest version of the EntityFramework NuGet package to the project.
Tools –> Library Package Manager –> Package Manager Console
Run the Install-Package EntityFramework command (This installs Entity Framework 5)
However I receive an error when attempting to run the "Enable-Migrations" command in Package Manager Console:
Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetContextTypeRunner,EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
I would greatly appreciate any suggestions on what I can do to resolve this issue.
FYI I hit this problem as well with VS 2012 and .NET framework 4.0 what helped me was this answer https://stackoverflow.com/a/13572319/2259509 , its ridiculous but the ampersand does seem to cause this error
<Private>True</Private>
For me, the above was missing from the assembly reference in the csproj file.
This means on build it isn't copied, and so cannot be seen.
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.12.2.1100\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Private>True</Private>
</Reference>

Which is the right version for Fasterflect using SNAP?

When using autofac with snap, I encounter the following exception:
Test method Halcyon.Mall.Logging.LogCallTests.FooLogCallInterceptor_ShouldBeCalled threw exception:
Autofac.Core.DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> System.IO.FileLoadException: Could not load file or assembly 'Fasterflect, Version=2.0.1.0, Culture=neutral, PublicKeyToken=a64e1179c81b1e25' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The autofac (2.5.2.830) is installed as a nuget package manually.
The fasterflect (2.0.4429.39723) is installed automatically as a dependent package of SNAP (1.7.3)
I had the same problem today with Snap 1.7.7 -- the latest version. Snap.StructureMap appears to require Fasterflect 2.0 but a NuGet of Snap 1.7.7 retrieves the latest Fasterflect, which is 2.1. I was able to solve it by downloading Fasterflect 2.0.2 using NuGet in a separate project (PM> Install-Package Fasterflect -version 2.0.2), then deleting the existing reference to Fasterflect from my main project, then browsing to and adding a file-based reference to the older Fasterflect 2.0.2 DLL.