Error 0x80131047 loading MySQL Connector DLL


PowerShell has just been opened sourced (v6.0.0-alpha.10), and I'm trying to get it to connect to a MySQL instance from OS X.

Oracle seems to suggest (if I'm reading it correctly) that they have a .Net Core connector here. I ran the install like this:

Install-Package MySql.ConnectorNET.Entity -Destination /MySQL

and the output looked good:

Name                       Version Source Summary                

----                       ------- ------ ------- 
MySql.ConnectorNET.Data nugget ADO.Net driver for MySQL    
MySql.ConnectorNET.Entity nugget MySql Connector/NET for Entity Framework 6

When I try loading the assembly like this:


I get the following error (note that I pass the path in with a variable $dll):

Exception calling "Load" with "1" argument(s): "Could not load
file or assembly
Culture=neutral, PublicKeyToken=null'. The given assembly name or
codebase was invalid. (Exception from HRESULT: 0x80131047)" At
/development/scripts/test.ps1:28 char:1
+ [System.Reflection.Assembly]::Load("$dll")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileLoadException

Any ideas on a workaround / fix? I realize that PowerShell is still in alpha.


I was able to install the MySQL provider using these two commands:

Register-PackageSource -Name -ProviderName NuGet -Location
Install-Package MySql.Data.EntityFrameworkCore -Destination /Volumes/Main/libraries/MySQL/ -AllowPrereleaseVersions

I tried registering all the assemblies I could think of:


But, when trying to create a new MySql object, it still bombs out with this:

New-Object : Cannot find type [MySql.Data.MySqlClient]: verify that the assembly containing this type is loaded.

asked on Stack Overflow Sep 18, 2016 by Jeremy • edited Jan 15, 2018 by JasonMArcher

2 Answers


That is not a .NET Core library - the word "Core" here indicates functionality shared between the EF6 and Web packages, and pre-dates the introduction of .NET Core.

Entity Framework Core has MySql libraries under development at the time of writing.

answered on Stack Overflow Sep 18, 2016 by James World • edited Sep 19, 2016 by James World


So, it turns out I was on the (mostly) right track. All of the DLLs need to be loaded. Make life easier by copying them into their own directory, and then load them by iterating over each one:

copy the DLLs to a new location

Get-ChildItem "/Volumes/Main/libraries/mysql/*/lib/netstandard1.*/*.dll" | Copy-Item -Destination "/Volumes/Main/libraries/NEW_mysql" -Force

load all required DLLs

Get-ChildItem "/Volumes/Main/libraries/NEW_mysql" | ForEach-Object {
$path = "/Volumes/Main/libraries/NEW_mysql/" + $_.Name
Add-Type -Path $path -PassThru | Out-Null
answered on Stack Overflow Oct 16, 2016 by Jeremy

User contributions licensed under CC BY-SA 3.0