Efcore.pg: MusicStore 2.0 with PostgreSQL 2.0.0-preview2-final throws Clone method not found

Created on 11 Aug 2017  路  23Comments  路  Source: npgsql/efcore.pg

hi @roji , we have a fork of the asp.net musicstore demo with postgresql support: https://github.com/redhat-developer/s2i-aspnet-musicstore-ex/tree/rel/2.0-example.

We've updated this example to use 2.0.0-preview2-final of Npgsql.EntityFrameworkCore.PostgreSQL. At application startup, we get an exception (see below).

Do you know what may be the cause of the error?

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
      Creating key {c8360f4c-09fb-4080-a8c8-3df8123d4600} with creation date 2017-08-11 17:10:15Z, activation date 2017-08-11 17:10:14Z, and expiration date 2017-11-09 17:10:14Z.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {c8360f4c-09fb-4080-a8c8-3df8123d4600} may be persisted to storage in unencrypted form.
info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
      Writing data to file '/opt/app-root/.aspnet/DataProtection-Keys/key-c8360f4c-09fb-4080-a8c8-3df8123d4600.xml'.
Unhandled Exception: System.AggregateException: One or more errors occurred. (Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.) ---> System.TypeLoadException: Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.
   at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper.<>c.<.ctor>b__6_1(TypeAndMapping tam)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper..ctor(RelationalTypeMapperDependencies dependencies)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
   at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
   at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_DatabaseCreator()
   at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreatedAsync(CancellationToken cancellationToken)
   at MusicStore.Models.SampleData.<InitializeMusicStoreDatabaseAsync>d__3.MoveNext() in /opt/app-root/src/samples/MusicStore/Models/SampleData.cs:line 24
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at MusicStore.Startup.Configure(IApplicationBuilder app) in /opt/app-root/src/samples/MusicStore/Startup.cs:line 202
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at MusicStore.Program.Main(String[] args) in /opt/app-root/src/samples/MusicStore/Program.cs:line 61

Most helpful comment

Wow, it's really nice to see so many people caring enough about Npgsql EF Core to provide manual instructions for building :)

I just released 2.0.0 to nuget.org, so you shouldn't need to do anything complicated anymore. Please report any issues you run into.

All 23 comments

At a glance, this seems like the result of a mismatch in versions between EF Core itself and the Npgsql EF Core provider. Double-check your csproj and try to restore again, and if the error persists please post your csproj here.

Hello @roji !
Simple Sample
Issues223.zip

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0-preview2-final" />
  </ItemGroup>

</Project>

```c#
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Issues223
{
public class TestDb : DbContext
{
public DbSet Tests { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => 
        optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Tests;Username=sa;Password=qwerty`123");
}

public class Test
{
    public int Id { get; set; }
    public string Name { get; set; }
}

internal class Program
{
    public static void Main(string[] args)
    {
        BuildWebHost(args).Run();
    }

    public static IWebHost BuildWebHost(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseStartup<Startup>()
            .Build();
}

internal class Startup
{
    public Startup(IConfiguration configuration) => Configuration = configuration;

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services) => services.AddMvc();

    public void Configure(IApplicationBuilder app, IHostingEnvironment env) => app.UseMvc();
}

[Route("api/[controller]")]
public class TestController : Controller
{
    [HttpGet]
    public IEnumerable<string> Get()
    {
        using (var db = new TestDb())
        {
            //db.Database.EnsureCreated();

            return db.Tests.Select(t=> t.Name).ToList();
        }
    }
}

}

GET http://localhost:5000/api/Test

System.TypeLoadException: 'Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.'


at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper.<>c.<.ctor>b__6_1(TypeAndMapping tam)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper..ctor(RelationalTypeMapperDependencies dependencies) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkRelationalServicesBuilder.<>c.<TryAddCoreServices>b__3_0(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_1(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() at Microsoft.EntityFrameworkCore.DbContext.get_Model() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityType()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.get_EntityQueryable() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.SelectTSource,TResult
at Issues223.TestController.Get() in c:usersadministratorSourceReposIssues223Issues223Program.cs:line 61
at lambda_method(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
```

@exp10der You're getting that error because of the version mismatch between Microsoft.AspNetCore.All and Npgsql.EntityFrameworkCore.PostgreSQL. I don't believe the PostgreSQL provider is ready to be used with EF Core 2.0. If you move your Microsoft.AspNetCore.All package back to 2.0.0-preview2-final, you'll see that exception go away.

@roji i have the same issue moving from asp net core 2.0.0-final-preview2 to 2.0.0 stable release

Same issue here with 2.0.0 stable

Same error

  Herramientas de la l铆nea de comandos .NET (2.0.0)

 Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

  Runtime Environment:
  OS Name:     Mac OS X
  OS Version:  10.12
  OS Platform: Darwin
   RID:         osx.10.12-x64
   Base Path:   /usr/local/share/dotnet/sdk/2.0.0/
  Microsoft .NET Core Shared Framework Host

   Version  : 2.0.0
   Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d


   <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0-preview2-  final" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />

Unhandled Exception: System.TypeLoadException: Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlTypeMapping' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper.<>c.<.ctor>b__6_1(TypeAndMapping tam)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlEFTypeMapper..ctor(RelationalTypeMapperDependencies dependencies)

Same problem after upgrade to 2.0

Same problem here. Itching to move to NET STANDARD 2.0!

Same here! Just moved everything to 2.0 and got stuck on this.

@roji Clone method was added in this commit - https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/commit/68669add1921f9e189478a5ee33b1ef9463d95a3. And it's not a part of v2.0.0-preview2-final release - https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/compare/v2.0.0-preview2-final...dev. If you look at file - Clone is missing

Updated to core 2.0 and same issue. What's our best bet at the moment? Wait for the 2.0 release of this package?

Updated to core 2.0 and same issue. What's our best bet at the moment? Wait for the 2.0 release of this package?

Technically you could make your own build. As far as I can tell its been fixed in the dev branch.

Good afternoon.
When will new version of the package be available?

For anyone looking for a temporary work around, I was able to upgrade all of my packages to 2.0 except those related to Npgsql or Entity Framework Core. Keeping those packages at the last stable release before 2.0 allows me to at least keep my project running.

Here's an example console application that I am targeting netcoreapp2.0 but using the old 1.1.1 libraries for my database connections.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
    <PackageReference Include="Npgsql" Version="3.2.5" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.1" />
    <PackageReference Include="Serilog" Version="2.5.1-dev-00873" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.0-dev-10172" />
  </ItemGroup>
</Project>

Temp solution:
Add the attachment ddl as follows

  <Reference Include="../Npgsql.EntityFrameworkCore.PostgreSQL.dll"></Reference>

and add reference to Npgsql nugget package

  <PackageReference Include="Npgsql" Version="3.2.4.1" />

Npgsql.EntityFrameworkCore.PostgreSQL.dll.zip

@ngonzalezromero can you send a PR with the code changes you have made?

@tmds #224 looks promising

@wonea No c# files change in that PR so I am doubtful it covers this issue.

You can build it from sources by yourself if you want.
1) Clone repo
2) Modify this line to looks like this
[assembly: DesignTimeProviderServices("Microsoft.EntityFrameworkCore.Design.Internal.NpgsqlDesignTimeServices")]
(because current attribute value in dev branch, trying to define the class that not exists)
3) Publish EFCore.PG locally
4) Open your NuGet local feed directory. You can find it in Tools - NuGet Package Manager - Package Manager Settings. In opened window, change 'General' to 'Package Sources'. In Machine-wide package sources section, you will find your local nuget feed.
For me it was 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages'
5) Copy published .nuget package from step 3 to directory, from step 4
6) Install library to your project (dont' forget change package sources to 'All' and enable 'Include pre-release' checkbox)
7) Just use it)

P.S. - you can use my nuget build from here. I've changed package version to 1.9.9, for easy-to use update when 2.0.0 comes to NuGet packages repository.

@NoMoreLoad brilliant, it works as expected, thank you :)

Updating the assembly reference in step 2, above, is important for the 2.0.0 release. Without that change, a TypeLoadException is thrown when running dotnet ef migrations add Xyz.

Wow, it's really nice to see so many people caring enough about Npgsql EF Core to provide manual instructions for building :)

I just released 2.0.0 to nuget.org, so you shouldn't need to do anything complicated anymore. Please report any issues you run into.

@roji Thank you so much!!!

Was this page helpful?
0 / 5 - 0 ratings