-
Couldn't load subscription status.
- Fork 347
MySqlConnector - No ExportedTypes in Powershell 5 #1266
-
I can import and use MySqlConnector in Powershell 7, but can not get it to work with Powershell 5 :
[System.Reflection.Assembly]::LoadFrom("E:\lib\net461\MySqlConnector.dll") | Select-Object -ExpandProperty ExportedTypes
PS7 returns 58 types
PS5 returns nothing
Is there a solution or a work around ? or i'm i missing something here ?
Thank you !
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments 3 replies
-
Works for me?
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\> [System.Reflection.Assembly]::LoadFrom("C:\MySqlConnector\bin\net461\MySqlConnector.dll") | Select-Object -ExpandProperty ExportedTypes
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False DbColumn System.Object
True False MySqlAttribute System.Object
True False MySqlAttributeCollection System.Object
True False MySqlBatch System.Object
True False MySqlBatchCommand System.Object
True False MySqlBatchCommandCollection System.Object
True False MySqlBulkCopy System.Object
True False MySqlBulkCopyColumnMapping System.Object
True False MySqlBulkCopyResult System.Object
True False MySqlBulkLoader System.Object
True True MySqlBulkLoaderConflictOption System.Enum
True True MySqlBulkLoaderPriority System.Enum
True True MySqlCertificateStoreLocation System.Enum
True False MySqlCommand System.Data.Common.DbCommand
True False MySqlCommandBuilder System.Data.Common.DbCommandBuilder
True False MySqlConnection System.Data.Common.DbConnection
True True MySqlConnectionProtocol System.Enum
True False MySqlConnectionStringBuilder System.Data.Common.DbConnectionStringBuilder
True False MySqlConnectorFactory System.Data.Common.DbProviderFactory
True True MySqlConversionException System.Exception
True False MySqlDataAdapter System.Data.Common.DbDataAdapter
True True MySqlRowUpdatingEventHandler System.MulticastDelegate
True True MySqlRowUpdatedEventHandler System.MulticastDelegate
True False MySqlRowUpdatingEventArgs System.Data.Common.RowUpdatingEventArgs
True False MySqlRowUpdatedEventArgs System.Data.Common.RowUpdatedEventArgs
True False MySqlDataReader System.Data.Common.DbDataReader
True False MySqlDateTime System.ValueType
True True MySqlDateTimeKind System.Enum
True False MySqlDbColumn System.Data.Common.DbColumn
True True MySqlDbType System.Enum
True False MySqlDecimal System.ValueType
True False MySqlError System.Object
True True MySqlErrorCode System.Enum
True True MySqlException System.Data.Common.DbException
True False MySqlGeometry System.Object
True True MySqlGuidFormat System.Enum
True False MySqlHelper System.Object
True False MySqlInfoMessageEventArgs System.EventArgs
True True MySqlInfoMessageEventHandler System.MulticastDelegate
True True MySqlLoadBalance System.Enum
True False MySqlParameter System.Data.Common.DbParameter
True False MySqlParameterCollection System.Data.Common.DbParameterCollection
True True MySqlProtocolException System.InvalidOperationException
True False MySqlProvidePasswordContext System.Object
True False MySqlRowsCopiedEventArgs System.EventArgs
True True MySqlRowsCopiedEventHandler System.MulticastDelegate
True True MySqlServerRedirectionMode System.Enum
True True MySqlSslMode System.Enum
True False MySqlTransaction System.Data.Common.DbTransaction
True False ConsoleLoggerProvider System.Object
True False IMySqlConnectorLogger
True False IMySqlConnectorLoggerProvider
True True MySqlConnectorLogLevel System.Enum
True False MySqlConnectorLogManager System.Object
True False NoOpLogger System.Object
True False NoOpLoggerProvider System.Object
True False AuthenticationPlugins System.Object
True False IAuthenticationPlugin
Beta Was this translation helpful? Give feedback.
All reactions
-
How were you able to get the mysqlconnector files installed on your machine and added to your powershell session?
I’m running into package loop issues with install-package. I tried using nuget.exe and it pulled down the dll and all of the dependencies but when I add the MysqlConnector.DLL I have the same issue as OP. @JuGGyFreak
Beta Was this translation helpful? Give feedback.
All reactions
-
The fact that it works for you gives me hope to get it working for me too - thank you for that !!!
So I'm trying to understand why it doesn't work for me - maybe i did not install it correctly ?
Unlike the Oracle connector, which came as an msi installer, I could not install this nupkg.
So what i did was unzip the nupkg and executed 'LoadFrom' directly on the 'MySqlConnector.dll' from the extracted archive.
I also tried on Windows 11 and Windows Server 2019, both PS5 and this also didn't work.
I have some other systems here, I'm gonna try them tonight.
I did not have this issue importing the Oracle mysql connector (MySql.Data)
PSVersion 5.1.22000.1335
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.1335
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Beta Was this translation helpful? Give feedback.
All reactions
-
I have the same issue on Windows server 2019 performing an offline install using nuget. Used nuget on an internet connected machine to get the dependencies. Copied over to the offline machine and performed nuget install MySqlConnector. Reinstalling indicates that it is already installed. Calling it from PowerShell results in not finding the assembly, same results as the OP. The Oracle MSI version works fine, but errors are created because I'm not connecting to MySQL.
Is there something special that needs to be performed for the PowerShell 5.1 environments to bring it in successfully that we are missing?
Beta Was this translation helpful? Give feedback.
All reactions
-
The dependencies are not properly identified as system.diagnostics.debug appears when installing offline. Once that is fixed, a dependency to Microsoft.NETCore.platforms is identified and that was with
install MySqlConnector -framework net48
To force the target. How many other dependencies aren't listed?
Is this one bug, or more?
Beta Was this translation helpful? Give feedback.
All reactions
-
@JuGGyFreak -- Not sure if you ever found a solution to this. I found that as I started using later versions of NugetPackages for database providers in PowerShell, things became complicated, particularly if they had a lot of dependencies. I wrote a powershell module to wrap up those complexities - you might find it helpful -- you can click through my name to find the module if you are interested.
Beta Was this translation helpful? Give feedback.