I've been attempting to connect a MySql database to my project in Visual Studio 2015. In order to connect it in the Server Explorer, I had to download and add the reference to my project. Easy peasy.
Then, when I attempted to follow this tutorial, I get this error message:
The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?)
I have indeed added the assembly reference (I believe, if I understand the term correctly), by checking the MySql.Data in the References/Extension.
Am I using the wrong MySql.Data? How do I know which one? I've read that perhaps it can have to do with mixed versions of .NET Frameworks, but honestly I don't know how to check.
I'm an up-and-coming programmer, who before this, had only worked with static, hard-coded webpages, and never used databases in a project before.
EDIT: I have indeed added the 'using MySql.Data.MySqlClient to the same class file as I am attempting to use it in.
More information. What is displayed when I hover over the Data in MySql.Data.MySqlClient in the 'using' statements.
Your first screenshot shows the quickactions window suggesting that you use a fully qualified name, for the type, because it cannot determine where the type comes from.
Search to make sure that MySql.Data is not used, as a namespace, elsewhere in your project, so that it does not collide with the MySql.Data namespace from the dll you are referencing.
Related
I looked for the answers here and there with no luck, so I decided to ask out.
I want to implement openalpr (open source Automatic License Plate Recognition)
repository on my own PC and I am following this video to accomplish the task. I have done all the steps he did and at the end, when I tried to build it but, in one of the .cs code there is CS0246 error that says:
Error CS0246 The type or namespace name 'AlprNet' could not be found (are you missing a using directive or an assembly reference?) number_plate c:\users\sohib\documents\visual studio 2015\Projects\number_plate\number_plate\Form1.cs
I could only find AlprNet in my D:\Projects\plate_recognition\openalpr-master\src\bindings\csharp\AlprNetTest and it is in .csproj format.
AlprNet is not in .dll format like other references so I cannot reference it in References.
I found some say that it might be because of different versions of .NET Framework platforms. I almost did nothing to check that, because I don't think it's related to .NET
In my mere opinion I should link that AlprNet.csproj to get its content, but I'm not sure. If someone can help get around this issue, I'd be very grateful.
If it's not a .net Assembly (dll) that's referenced and it's not a nuget package, then check that the code isn't expecting the Assembly to already be present in the Global Assembly Cache (If you have access to another developer machine where this works, this is easy to check).
Failing that, adding the .csproj to your .sln and then referencing it sounds like the way to go (provided you have access to that of course!).
I am trying to ressurect an older project of mine in a newer Unity3D version. This is all well and good, except for a plugin that it was using is messing up.
I am using TouchScript : https://github.com/TouchScript
I updated to the newest version and everything, but i keep getting an error saying:
Assets/Scripts/Puzzle/Gesture Usage/PickupScript.cs(149,33): error CS0246: The type or namespace name `TouchHit' could not be found. Are you missing a using directive or an assembly reference?
This script has the required Using TouchScript.Hit; line. And i opened up the DLL to make sure that the class "TouchHit" is there, and it is. However when viewed in monodevelop by going to the DLL itself, it does not show at all. It shows the other classes that are supposed to be there, but not that specific TouchHit class.
I used that class, thus the error. But i am unsure on how to proceed with fixing this. I tried all sorts of import settings but no luck.
Any ideas?
Sincerely,
Smileynator
The classes in question were marked INTERNAL at some point, and documentation did not reflect this until i started looking at the commit regarding this change in feb 2014.
https://github.com/TouchScript/TouchScript/commit/ccb1a6cb44cb444618ca613fe1f8e5b15c076cc3
I'm using Visual Studio 2013, and I'm getting an error in my C# code that I can't figure out. I'm working with the Microsoft Kinect SDK, but I'll keep it general.
I downloaded the SDK, and I can get the included sample programs to build and run. But when I try to use the code in my own project, I get the
Type or namespace name 'Kinect' does not exist in the namespace 'Microsoft' (Are you missing an assembly reference)
error.
The thing is, I'm not missing an assembly or reference. I have it added to the project's references, and the path is valid. Also, the using statements at the top of the file will autocomplete to "Kinect" for me. If I start typing using Microsoft., Kinect will appear as an autocomplete option.
What are the steps to debugging an error such as this? Could it be a 32/64 bit issue? I tried using Dependency Walker to look at the Kinect DLL, and while it throws some errors (Error: Modules with different CPU types were found.), it doesn't show any issues that I don't see with other DLLs that I'm using successfully.
What are some other potential issues that might cause a problem with DLLs not being recognized?
1 - Try going to your project settings and verify the version of the .NET framework it uses.
The best to do is to choose the same version as the external libraries.
If it's a client profile, it will very often bring that exact problem. (I'm not sure what the client profile is, but I ended up never using it...)
2 - Check if any of your references got an exclamation mark.
I have an issue with a class being used in another project.
Visual studio is able to add a using statement using Resolve (Ctrl+.), but:
The type or namespace name 'SomeClass' could not be found (are you missing a using directive or an assembly reference?
Resolving this again fully qualifies the type but the namespace in the type path is highlighted as not being found.
The namespace appears also in intellisense and the target class is visible in the Object Browser.
Removing unused namespaces removes the added using statement.
I've tried:
Rebuild.
Confirm project dependency in solution options.
Delete reference and re-add.
Confirm class accessibility (despite namespace not being found).
Checked build mode (Debug/Release).
Restart Visual Studio.
Cleared bin folders in both projects.
Restart machine.
What is the next step to diagnosing this baffling issue?
This is likely to be a .Net framework versioning issue. The class being referenced was probably built using a higher version of the framework.
Try checking your framework versions all align in properties, build settings. A project cannot reference an assembly of a higher framework version.
Last time I had this problem my class was not marked public. Just an idea.
This issue was caused by similar namespaces e.g. Company.Product.Project and Product.Project with:
namespace Company.Product.Project
{
using Product.Project;
The class was in Product.Project, but the compiler was searching for Company.Product.Project.
See: Should 'using' statements be inside or outside the namespace? for more details.
I have a class lib and I referenced it to another windows project. I added its namespace to my Form.cs (using SaglikNetClassLib;). they are seem unknown when I want to access to classes. I can see their properties and methods. But the complier says "Error 7 The type or namespace name 'SaglikNetClassLib' could not be found (are you missing a using directive or an assembly reference?), Do you have any suggestion?
KR,
Çağın
Are you targeting the .net Client Framework? Visual Studio let's you add references to incompatible assemblies, but then gives exactly that error.
Check your project settings to make sure you're targeting the full .net framework.
Also, check that the Ilalcar class is public and not internal (which is the default if it's only declared as class without any modifier)
You probably need an using statement to put the class into scope.
using SaglikNetClassLib;
C# won't auto suggest it if the project has not been rebuild. Also make sure the class library project has been build before using it in code.
Intellisense seems to lag behind a bit at times. Simply pressing f5 (run) sometimes rebuilds the project completely and simply runs or gives a better error message.