Jump to content
Xtreme .Net Talk

CS0012 (missing assembly reference) but assembly is referenced!


Recommended Posts

Posted

The solution compiles fine, but when running I get a CS0012 error. The supposed missing reference is indeed referenced. This started occurring when added some implict operators...here's the scenerio:

 

in namespace CompanyName.Whatever1 there is a class called X; in namespace CompanyName.Whatever2 there is also a class called X. These two classes our highly coupled (purposefully) but *are* indeed seperate objects (let's not get into this design, it's a problem that's being addressed).

 

Anyway these two 'X' object have to be pretty interchangable so we're using implicit casting. This is all fine and well, and again works fine, but now at runtime when you go to create an instance of Whatever1.X you get CS0012 saying you need to add a reference to CompanyName.Whatever2.dll Verision 1.0.0.0 blah blah...and this is what is referenced in the assembly references!!! It compiles just fine, so I don't understand why we're getting the runtime error.

 

I have a zip I can email that demonstrates the behavior if you think you can help. (too large to attach to post)

 

Thanks

  • Leaders
Posted (edited)
When the code is compiled, for any reference that is made to any type the IL explicitly declares the name of the module, namespace, and the class that is being referenced. I'm curious to see what the compiled IL looks like. I don't see how there can any sort of naming conflict. Could it possibly be a versioning issue? Would it be possible for you to use Reflector to decompile the code that is throwing the exception and post it here? Edited by snarfblam
[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

Is there, by chance, a circular reference between the two projects? Do you have them setup as project references or file references?

 

If you have file references and a circular reference, as well as having the assemblyInfo files having a hard-coded version number, you might get this error. It's just a guess, but that's mine.

 

You can email me the project at nerseus at google mail dotcom (you know the one, gmail.com). If you do, please include some basic instructions for setting it up. You can often reduce the size of project by removing the bin and obj folders, if that helps.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...