"Are you missing an assembly reference?" compile error - Visual Studio

165,160

Solution 1

Right-click the assembly reference in the solution explorer, properties, disable the "Specific Version" option.

Solution 2

In my case it was a project defined using Target Framework: ".NET Framework 4.0 Client Profile " that tried to reference dll projects defined using Target Framework: ".NET Framework 4.0".

Once I changed the project settings to use Target Framework: ".NET Framework 4.0" everything was built nicely.

Right Click the project->Properties->Application->Target Framework

Solution 3

If none of the solutions above worked, try this 10-second fix.

Navigate to the startup project in solution explorer. Right click, properties > Application > Target framework. Change the target framework to anything else. Press Yes for the confirmation dialog. Give the changes a few seconds to take effect, then switch the framework back to what it was before.

The error will hopefully go away for you like it did for me!

Solution 4

Are you strong-naming your assemblies? In that case it is not a good idea to auto-increment your build number because with every new build number you will also have to update all your references.

Solution 5

I bumped the answer that pointed me in the right direction, but...

For those who are using Visual C++:

If you need to turn off auto-increment of the version, you can change this value in the "AssemblyInfo.cpp" file (all CLR projects have one). Give it a real version number without the asterisk and it will work the way you want it to.

Just don't forget to implement your own version-control on your assembly!

Share:
165,160
Michael Kniskern
Author by

Michael Kniskern

I am currently working as an IT engineer for the government of Mesa, Arizona USA

Updated on December 11, 2021

Comments

  • Michael Kniskern
    Michael Kniskern over 2 years

    I am currently working on a server control for other applications in our company to interface with a WCF service. Every time I make a change code change and recompile the control, I increment the the AssemblyVerison and AssemblyFileVersion class in the AsseemblyInfo.cs by one. For example, my latest build went from 1.0.07.0 to 1.0.08.0.

    When the consuming application updates the file by copying the latest file in the bin directory and tries to compile, they receive the following error:

    The type or namespace name 'MyControl' does not exist in the namespace 'MyNamespace' (are you missing an assembly reference?)

    In order to resolve this error, they have to delete the current reference and re-add the reference.

    Is there any way to update the server control without having to delete and re-add the reference?

    I am not strong naming the server control.
    @JPunyon - Do you mean have the consuming application add the server control project to their solution?