3

I added a new property to my model of an ASP.NET MVC 5.2 application with MySQL database, and now I'd like to add a database migration for this by using this command:

Add-Migration RegisterPropertyAdded

But, I get an exception:

Type is not resolved for member MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d

It seems that MySQL wants to throw an exception but can't find the exception class for reasons I don't understand. I installed the following NuGet packages in the project:

EntityFramework Version 6.1.3

MySql.Data Version 6.9.7

MySql.Data.Entities, Version 6.8.3.0

MySql.Data.Entity Version 6.9.7

In the model, the class MySql.Data.MySqlClient.MySqlException is shown, so it seems like the class exists and I can't find any information that additional packages are required for the exception class.

1
  • Please show the class and property that you have added. Commented Jul 18, 2015 at 22:34

2 Answers 2

4

In order to see this exception you have to update MySQL Connector/Net
Also make sure that MySQL server is up and running and you can connect to it.

Sign up to request clarification or add additional context in comments.

2 Comments

I was confused that this solves the problem because a few days ago it worked, although I hadn't install the MySQL Connector yet. So I thought It would have something to do with the package-updates I did via NuGet a few days before. But now I installed the MySQL Connector and it worked - strange issue! Thanks for the solution :)
Ran into this when using MariaDB - the MariaDB installer doesn't install the Connector by default so you need to get it separately.
1

For me this message appeared due to an incorrect connection string in Web.config.

1 Comment

I added MultipleActiveResultSets=true to my connection string and got this error with BetterModules.Core

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.