Alex Rivera | Logout

ASP.Net error: “The type ‘foo’ exists in both ”temp1.dll“ and ”temp2.dll" (pt 2)

Asked 2010-04-07T21:36:33.883
14

Solution:

I had also moved ashx and asmx files at the same time as this. The Class attribute of the WebService/WebHandler directives were pointed at the wrong namespace. The moral of the story is to make sure you view the markup for all as*x files you change the namespace for by right-clicking on them and choosing "View Markup".


I'm experiencing the same problem as in this question and this link, but none of the answers fixed my problem. (edit: Setting the web.config batch attribute works, but that's a coverup, not a solution)

The problem I'm having is with a User Control that I moved from the root directory to a subdirectory within the same Web Application project. It used to work fine before I moved it. When I moved it it started giving me the error message.

It's saying that the class name exists in two dll files in Temporary ASP.NET Files. Sure enough, when I open Reflector, it's in two dlls.

If I rename the class and ascx file, everything works fine. No usages of the original name exist within any of the files in my entire application. When I rename the file, I opened all of the dll files in Temporary ASP.NET Files with Reflector, and no references to the original class name exists.

So where's this phantom reference coming from how can I fix this?

Update: I literally grepped every file in my working directory for the solution and my temp directory for the old class name and deleted every file that contained it. I then renamed back to the original, broken name and I still get the error.

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this reques

Edit
Report

2 Answers

5

Clean Temporary ASP.NET Files. It could be that control before moving has an assembly and after - an another one

answered 2010-04-07T22:08:36.973
1

With a lot of projects and folders, it's possible to sometimes get the namespaces messed up, especially if you're trying to force things by using namespace declarations.

To see if this really is a problem, I'd go through all my code files - .cs and .designer.cs - and remove ALL the namespace declarations, then rebuild all to see if that fixes the problem.

You don't mention what version of Visual Studio and .net you're using, that might help too - I remember dealing with a similar problem in VS2005.

answered 2010-04-12T19:07:47.187

Your Answer