2

I am fighting for weeks already with this creepy compilation error messages, that sometimes just go away after I run re-compile a dozen times.

I have an ASP.NET 2.0 Website (not WebApplication). When I compile I get this all the time (for different types, unpredictably).

I wonder - what does it has to do with Framework\v4.0.30319 ?? It's a .NET 2.0 project.

Error 189 The type 'XXX' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\MyWebSite\7f070f1a\b1e2bb52\App_Web_search.ascx.cc671b29.j7lvxos_.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\MyWebSite\7f070f1a\b1e2bb52\App_Web_mey4xl1t.dll'

I tried deleting these Temporary ASP.NET Files - doesn't help.

Tried to add batch="false" to compile element in web.config, takes forever to build, but the problem remains.

hwcverwe
  • 5,287
  • 7
  • 35
  • 63
monstro
  • 6,254
  • 10
  • 65
  • 111
  • Have you tried cleaning the solution. – Despertar Apr 29 '13 at 17:38
  • Does this have to do any of the functionality that was moved from the `System.Web` assembly to the `System.Web.ApplicationServices` assembly in .NET 4.0? (e.g. Membership, Roles, etc.) If so, you probably have references to the wrong version of `System.Web` – smartcaveman Apr 29 '13 at 17:44
  • Of course I tried to clean and re-build. Doesnt help. – monstro Apr 29 '13 at 17:48
  • After running compilation several time it just goes away, but then, appears again. All parts of the project are .NET 2.0. – monstro Apr 29 '13 at 17:49
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). – John Saunders Apr 29 '13 at 18:05
  • This had been aswered here : http://stackoverflow.com/questions/371426/asp-net-error-the-type-foo-exists-in-both-temp1-dll-and-temp2-dll – AlexB Jan 06 '17 at 12:49

1 Answers1

1

You have duplicate declaration of a class or other object.

Look at the name of the class mentioned, and search both dlls for it's declaration. One of them is obviously wrong.

Kami
  • 19,134
  • 4
  • 51
  • 63
  • 1
    @Sigourney_Weaver Because your IIS website is set to use an application pool running in ASP.NET 4.0, rather than 2.0, most likely. – J. Steen Apr 29 '13 at 18:13
  • Actually not, it's IIS 5.1, no application pool, website is set to .NET 2.0. – monstro Apr 30 '13 at 18:52
  • @Sigourney_Weaver I would double check that all the references in the project are v2.0 as this error suggests you have a v4.0 dll somewhere. Look at the two Dlls in Object browser to determine what they are and why they are included in the project. – Kami May 01 '13 at 09:04