1

I've just gone thru a large-ish project and renamed A LOT of namespace directives. Everything works fine on my developer box - deploy it to stage and I get:

Compiler Error Message: CS0433: The type 'ASP.usercontrols_pageheader_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\89252a5f\7305b927\App_Web_hodsbmv3.dll' and ' c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\89252a5f\7305b927\App_Web_pageheader.ascx.6bb32623.bs4iljip.dll'

Yuck. Very similar to this: Deployment Project dlls cause ‘type x exists in both’ errors, but must be coming from a different cause.

I have none of the problems I've seen mentioned in other articles (App_Code / CodeFile directive). Worked out why it works on my machine: the website has no problem when it is in a vdir. If I remove the "PageHeader" usercontrol from the masterpage it lives on everthing is fine. If I rename "PageHeader" everything is fine. Updated: renaming the usercontrol doesn't help.

I'd had a look at the assemblies mentioned in the error in reflector; App_Web_hodsbmv3.dll contains dynamic classes for all the usercontrols in my project. \App_Web_pageheader.ascx.6bb32623.bs4iljip.dll' contains the same code just for the PageHeader usercontrol. Why would ASPX decide to create the same class in two assemblies?

Community
  • 1
  • 1

2 Answers2

0

Are you using web deployment projects?

Try deleting the asp.net temporary directory for this application (located here: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\yourappname). You have to stop the app pool for this site before you delete the dir.

Try the setting to merge all outputs to a single assembly to see if it makes any difference.

..update..

"Merge to create a single assembly for all the Web UI content files by using Aspnet_merge.exe with the w option." http://msdn.microsoft.com/en-us/library/bb397866.aspx

Raj Kaimal
  • 8,304
  • 27
  • 18
0

The winning answer goes to this forum post: Publish web site: TYPE exists in both temporary ASP.NET assemblies

If you're getting this error, review all of the directive attributes and code-behind class names in your web user controls and web forms.

Because I'd changed all the namespaces in the project I'd botched in asmx. I had an Inherits in the ASMX that didn't match the class in the code behind. Somehow this resulted in the compilation batching putting some (not all) usercontrols into their own temporary assemblies, AND the group assembly.