Avatar of David L. Hansen
David L. Hansen
Flag for United States of America asked on

Using/Import statement in code doesn't see reference of dll just added.

I add DLL's to my projects all the time (in C# and in VB). After employing the IDE to get the library into the project, I just type the normal "using theDLLsNameSpace" (or "Imports the DLLsNameSpace") to begin coding with that library. Nothing surprising there.

The issue I'm having today is that after adding the DLL to the project (successfully and without error) I type this:
using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;
using theDLLsNameSpace; //The problem is here

namespace XYZ
.
.

Open in new window

The good-old red underline appears with the following error (on line 4):
The type of namespace name 'theDLLsNameSpace' could not be found (are you missing a using directive or an assembly reference?)
By the way, I compiled the code myself (someone else's original code) in x86. The x86 is just because we've avoided some bugs doing it that way.

Any idea why this is happening or how to fix it?
* dllC#.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
David L. Hansen

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Elvio Lujan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
David L. Hansen

ASKER
That did it :)

I just rolled it back to 3.5 (and didn't use x86...not sure if that made a difference). Have you come across this before?

I'm surprised VS doesn't give a different error. It certainly knows that the reference is there and that the namespace typed in the code matches.  It's just not able to mesh the library with the solution because of conflicts between frameworks. You'd think the error would better communicate the possibility of a framework issue. Weird.
David L. Hansen

ASKER
Thanks for the help :)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck