1.20.2011

Application Can't Find References

For the past several hours I have been trying to understand why a C# console application would not build. I'm using Visual Studio 2010. I have several other console applications that are working properly. However, this one kept claiming that it could not find two custom assemblies that I had referenced. I was getting
The type or namespace name 'StructureMap' could not be found (are you missing a using directive or an assembly reference?)
Of course, I checked repeatedly that the assemblies were in fact referenced. I even went as far as deleting and recreating the project, all to no avail. I finally found a stackoverflow post that addressed the problem. Turns out my custom assemblies are compiled targeting the .NET 4 Framework. My console application was only targeting the .NET 4 Client Profile. This caused the console application to lose track of the custom assemblies. Extremely frustrating as the error message was not indicative of the problem. Glad it was an easy fix though.

6 comments:

  1. Thanks very much Scott! Saved my lots of time..

    ReplyDelete
  2. Thank you - you've just stopped me from throwing my laptop out of the window in frustration! ;)

    ReplyDelete
  3. That just saved me hours of frustration. Thanks!

    Jeremy

    ReplyDelete
  4. Thank you just saved my life as well

    ReplyDelete
  5. Thank you. It helped me alot. -- Roopesh

    ReplyDelete

Note: Only a member of this blog may post a comment.