So I am trying to create a Windows Forms application that accesses a MySql database, but trying to create a using directive for MySql created a "Type or namespace not found(using directive or assembly reference possibly missing)" error.
Asked
Active
Viewed 43 times
-2
-
7**assembly reference possibly missing** ? Probably worth starting there... – ProgrammingLlama Oct 17 '18 at 08:19
-
Place your cursor on the red underlined MySql and hit Ctrl+. does it offer you adding an assembly reference? – Fildor Oct 17 '18 at 08:21
-
The error references two *distinct* possible causes. Adding a using directive does nothing if you're *also* missing the assembly reference (and vice versa) – Damien_The_Unbeliever Oct 17 '18 at 08:22
1 Answers
0
You likely don't have a reference to the MySql driver. You can install it using NuGet:
- Select Tools | NuGet Package Manager | Manage NuGet packages for the solution...
- Click Browse
- Type mysql in the search box.
- Select MySql.Data by Oracle
- Check the box next to your project on the right-hand side
- Click install
- Wait, agree to the licensing prompt
Once all is done, you should be able to add using statements without issue.

ProgrammingLlama
- 36,677
- 7
- 67
- 86