Tuesday, August 20, 2019 ..:: Home ::.. Register  Login

Peter Henry on Facebook  Peter Henry on LinkedIn  Peter Henry on Twitter

All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
   TechTidBits (Blog)  

Are you trying to use Templated User Controls and getting missing using directive or assembly errors?

Sep 18

Written by:
Thursday, September 18, 2008 10:34 PM  RssIcon


In my ODNC MCTS Study group session this week, we did Web User Controls and more specifically Templated User Controls.  At the presentation this week, DL gave an awesome presentation which made me go revsit the Templated User Controls.  After TWO FULL NIGHTS of none functioning code, I was starting to think that was a bad decision!  I kept getting these error messages!

Missing Assembly Reference message

See the little teeny-tiny red squiggles under ShipperContainer and the missing using directive or assembly reference message?  That message has been staring me in the face all night! :<  The crux of all this is VS is unable to find the ShipperContainer class which is dutifully created in the App_Code directory.  Below is a screen cap of opening the website in a Solution, notice the icon on the App_Code directory (grey coloured folder).

Missing Assembly Reference message

Now, let's open the same website but as a website.

Missing Assembly Reference message

You will see the App_Code icon now change (similar folder to above but this time with a doc-like image superimposed on it).

Missing Assembly Reference message

BINGO!  Hit F6 and everything compiles JUST fine! Turns out, it's got NOTHING to do with the code but everything to do with the surrounding solution/project! 

Yes, that's right, in trying to keep things clean and neat with my code, I create and use Solutions with individual Projects for different aspects in the book we're learning.  Long story short, if you're getting this FRUSTRATION, uh, error, you need to open a Website, not a Solution/Project.  Once you do that (I hope! :>) your compile errors about missing using directives will go away.


Oh, and one closing note, VS will try to save a Solution file for you as soon as you hit the F6 to compile.  You should be good to go with opening up that Solution file the next time.  Not quite sure why that is though?!  Any commenters?


References:  I want to thank Peppi and KDavie for asking and answering this question just a week and a half ago!

Location: Blogs Parent Separator TechTidBits

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement