I migrated my ASP.NET project from 3.5 to 4.0 (VS2008 to VS2010) and when I tried publishing the site I encountered this error:
The type ‘TYPE’ exists in both
‘c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files…\App_Web_1z57x8dg.dll’ and
‘c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files…\App_Web_ofaxwney.dll’
However, when I went back to my .NET 3.5/VS2008 project it was publishable without a problem. I found a few SO questions with similar issues, this in particular was very informative. I did the batch="false" option but was still encountered the problem.
There had to be an issue with circular reference of sorts. Going back to the .NET 4.0 project I began looking a lot more closely at the errors and found many things like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ViewPresentationTabControl.ascx.cs" Inherits="Common_UserControls_PresentationTabControl" %>
If you look closely, the Inherits tag is pointing to the wrong control. This was a victim of copy and paste code (courtesy of offshore contractor we inherited this project from).
I went through all the errors and fixed the obvious mistake and the project was publishable in .NET 4.0/VS2010.
The purpose of this long drawn out post is why would 3.5 allow that to happen and not 4.0? It seems something like that would cause a major issue in any version, but it obviously didn’t.
Any information would be greatly appreciated.
and then delete everything from
you can in fact clear it for every version of framework installed on your machine v3.0, v3.5, v4.0 etc.
then try republishing the web site. If it doesn’t work then, you’ll need to go through every code file in the web project and check if namespaces are correct.
If you look at the content of files \Temporary ASP.NET Files\ [projectname] \ *.cs, you’ll find out the magic behind the asp.net page code generation engine.
The possible reason in your case is the differnce in build approach: 4.0 for some reason build the whole site content into one big application.dll assembly, so incorrect inherits are surfaced during the build. previously build was happening on a per page basis and one page was compiled into one assembly. To avoid this I normally build .msi packages for web site installation, that enforced the build of full website before packaging and all those errors were surfacing during the build