Geeks With Blogs

News
Welcome to my blog.
Here's what we've got on the menu today:

Lorin Thwaits A geek says what?

Do you have arcane CS0006 errors haunting you, either in 1.1 or 2.0?  Something like this:

Compiler Error Message: CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\someProject\27bee1ac\cdebe31b\App_Code.glp37_b2.dll' could not be found

Source Error:

[No relevant source lines]

Additional symptoms: when you first build the app it works fine, but then when rebuilding it always comes up with this error.  Well, I know of three major reasons for this to occur:

  1. You've got a signed assembly (DLL) that you haven't installed in the GAC.
  2. You're using impersonation (via in web.config) and have not installed your DLL to the GAC.
  3. You have an assembly with a strong name properly installed in the GAC, but have now recompiled and thus have a new version.  You have then deleted the older one, leaving the CLR still looking for the older version based on its specific strong name.

For reasons #1 and #2, simply install your assembly in the GAC.

As a sidenote for reason #2, if it's impersonation you're after then you may want to check out Michele's excellent article promoting impersonation on demand:
http://www.theserverside.net/articles/showarticle.tss?id=SandboxingComponents

If you're facing reason #3 from the list, version trouble, then here's a good article on using publisher policy to get around the issue:

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconassemblyversionredirection.asp

And if that's confusing then you may want to start with this introductory article on versioning:
http://msdn.microsoft.com/library/en-us/dndotnet/html/managevers.asp

Posted on Friday, December 9, 2005 12:40 AM ASP.NET , Errors | Back to top


Comments on this post: ASP.NET Compiler Error CS0006

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
I have the problem, but don't have 1, 2, or 3. Any other suggestions?
Left by Travis on May 19, 2006 12:49 PM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
Hi

Here's a solution that works for us:

Look in Web.config - if you have the line <identity impersonate="true" /> then remove it.

Note that the problem does *not* occur if a username and password is specified in the <identity> setting.

Hope this helps

Andy
Left by Andy Stephens on Jun 22, 2006 12:39 AM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
I found the solution to this problem that has been bugging me for a long time! I’ve searched and searched and seen a million articles address this problem, but the only solution anyone has is to use the GAC. I really didn’t want to use the GAC, and with this solution you don’t have to. I call it the "Terry Allen Solution." :-)

Yes, setting impersonate=false solves the problem. But what if you need to impersonate? Nearly all my applications do.

Solution:

Set impersonate = false for your whole web application:

<system.web>
<identity impersonate="false"/>

</system.web>


Put all your code under a directory and set impersonate to true for that location.


<location path="Web">
<system.web>
<identity impersonate = "true">
</system.web>
</location>
Left by Terry Allen on Apr 27, 2007 1:30 PM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
Here's another solution; check the permissions for the relevant ASPNET (worker process) account on the %systemroot%\Temp and the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files directories.

Changing the permissions for the IIS_WPG group on the latter directory from Modify to Full corrected the issue without requiring a refresh of the worker processes in our case.
Left by Andy on Jun 18, 2007 1:10 PM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
check this:

CS0006 if

1) 2 projects in 1 solution had the same assembly name
2) the path is too deep. Windows can hold maxpath 260 characters. If you have a webproject, the assembly is cached, check whether the cache location and the assembly name together do not exceed this limit.
Left by Patrick Peters on Feb 22, 2008 2:01 AM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
2 projects in 1 solution had the same assembly name
Left by Tiffany co Necklaces on Oct 17, 2009 11:56 PM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
A good quality CCD has enough resoltution and goos signal to noise to feed a 14-bit AD converter with meaningful bits.
Left by DDos Protection on Nov 06, 2009 8:51 PM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
Yes, it is my problems too. Thanks so much for your sharing this article. It is very useful for me.
Left by replica designer handbags on Jun 06, 2010 7:02 AM

# re: ASP.NET Compiler Error CS0006
Requesting Gravatar...
abercrombie and fitch Every season abercrombie clothing fashion trends are abercrombie online closely watched. Tell you that prints are fashion. Meanwhile, the stamp is not just exclusively for women, men's printing and design is also particularly prominent in the season, painting style, big color images, conceptual and abstract and neutral colors printing, marbling, and moire effect .....are all clear trend in the abercrombie online store performance of the season abercrombie outlet.
http://www.aberclombie.com/abercrombie-shop.html
http://www.aberclombie.com/new-products.html
Left by aberclombie on Aug 11, 2010 2:51 AM

Your comment:
 (will show your gravatar)


Copyright © Lorin Thwaits | Powered by: GeeksWithBlogs.net