Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 -- are you missing a using directive or an assembly reference?

When I add a reference to my dll in Visual Studio project, I am able to use it, but when I compile my code or try to run it, I get an are you missing a using directive or an assembly reference?_ Error. I am able to confirm that I have the right using statement for my namespace and I am able to confirm that the dll is correctly loaded. Anyone have any idea what I may not have right in this?

like image 843
user272671 Avatar asked Dec 22 '10 18:12

user272671


People also ask

Are you missing a using directive or an assembly reference Visual Studio 2010?

Open your Project within the Solution Explorer. Right-click the References folder and Choose Add Reference.... Find and select the assembly that cooresponds to your error message or class. Click the Ok button to add it to your Project.

How do you solve are you missing a using directive or an assembly reference?

You need to look in the solution explorer and right click on project references and then go to add -> and look up the one you need.

How do I fix missing references in Visual Studio?

To fix a broken project reference by correcting the reference path. In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears. If you're using Visual Basic, select the References page, and then click the Reference Paths button.


4 Answers

Go to project settings and make sure that you are not compiling the project for a .net version that includes the text "client profile".

like image 88
Klaus Byskov Pedersen Avatar answered Sep 20 '22 01:09

Klaus Byskov Pedersen


I had just had an issue precisely like this, even if this is an old question thought I would add my 2c on what fixed it as none of the other answers helped:

For whatever reason, when I built the solution top to bottom a certain dll was not getting updated and output that held changed code. So while my solution had no visible errors, when you attempted to build, it was still referencing the old dll and started complaining.

It was simply a case of directly re-building the offending project and after that it picked up the latest dll and built happily.

This seemed to be a freak accident as no configuration had changed between when it worked / when it didn't.

like image 22
John Avatar answered Sep 21 '22 01:09

John


Sometimes, JUST REBUILD THE SOLUTION.

like image 25
ARK Avatar answered Sep 18 '22 01:09

ARK


The location of the DLL is important.

If you add a reference on your local machine to a DLL that is outside of your Visual Studio solution, it isn't necessarily copied into your solution files (depends on the type of solution/project).

If this is your problem, then you need to either put the DLL in the same path on the other machine, or copy it into your solution so it gets deployed along with the solution files, and change the reference.

You can also handle this with build instructions, but that might be beyond your aspirations at the moment.

like image 40
DOK Avatar answered Sep 19 '22 01:09

DOK