Efcore: ADD-MIGRATION 3.01 Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo'

Created on 21 Nov 2019  Â·  6Comments  Â·  Source: dotnet/efcore


add-migration EF30Empty -project EventEtObjectContext crashes with an exception

System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(Object reportHandler, IDictionary args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Exception has been thrown by the target of an invocation.

"Microsoft.EntityFrameworkCore" Version="3.0.1"
"Microsoft.EntityFrameworkCore.Design" Version="3.0.1"
"Microsoft.EntityFrameworkCore.Proxies" Version="3.0.1"
"Microsoft.EntityFrameworkCore.Tools" Version="3.0.1"
"Pomelo.EntityFrameworkCore.MySql" Version="3.0.0"

Project Sdk="Microsoft.NET.Sdk"
TargetFramework>netstandard2.1
Database provider: MySQL Pomelo

Project file: EventEtObjectContext.csproj.zip

closed-question customer-reported

Most helpful comment

Fixed !!

I have changed
PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"
PrivateAssets all PrivateAssets
IncludeAssets runtime; build; native; contentfiles; analyzers; buildtransitive /IncludeAssets
/PackageReference
to PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"/

(remove PrivateAssets and IncludeAssets)

And it is working , don't know why it was there and working with 2.2.6 ?

Thanks for your help

All 6 comments

That error generally happens when you have mix 2.2 packages with 3.0 packages. I looked at the csproj you shared but it is using all 2.2 packages. Can you share the csproj file being used after upgrading to 3.0?

Soory bad project file !
EventEtObjectContext.zip

Sorry I didn't take the right project

Zip with the project and 2 dependency projects

Thanks

Le jeu. 21 nov. 2019 à 17:21, Smit Patel notifications@github.com a
écrit :

That error generally happens when you have mix 2.2 packages with 3.0
packages. I looked at the csproj you shared but it is using all 2.2
packages. Can you share the csproj file being used after upgrading to 3.0?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/EntityFrameworkCore/issues/19012?email_source=notifications&email_token=AKPVY2PLF3VJWDJIT6IXLZLQU2YRTA5CNFSM4JQEWIVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE2ZQTY#issuecomment-557160527,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKPVY2NYUAYEVOGJAZ4MOTDQU2YRTANCNFSM4JQEWIVA
.

Fixed !!

I have changed
PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"
PrivateAssets all PrivateAssets
IncludeAssets runtime; build; native; contentfiles; analyzers; buildtransitive /IncludeAssets
/PackageReference
to PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"/

(remove PrivateAssets and IncludeAssets)

And it is working , don't know why it was there and working with 2.2.6 ?

Thanks for your help

Fixed !!

I have changed
PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"
PrivateAssets all PrivateAssets
IncludeAssets runtime; build; native; contentfiles; analyzers; buildtransitive /IncludeAssets
/PackageReference
to PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6"/

(remove PrivateAssets and IncludeAssets)

And it is working , don't know why it was there and working with 2.2.6 ?

Thanks for your help

Thanks is working for me, thanks

Was this page helpful?
0 / 5 - 0 ratings