C# – How Do You Clear an ASP.NET app for compiling

asp.netcvisual studio 2010

I have been building and rebuilding an ASP.NET program.

I made the horrible mistake, I think, of recently copying the published content back to the folder I was developing.

So now I have an unusual error when I build the code. It says That there is a duplicate definition in one file in a temporary directory with anohter file in a temporary directory.

Error 3

The type 'ChildEventHandler' exists in both
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files…\b90cc7a4\28d266b\assembly\dl3\c4cf1ea3\b6e4b808_ef7cce01\App_Code.DLL'
and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files…\b90cc7a4\28d266b\App_Code.asx5jp5d.dll' C:\inetpub\wwwroot…\Resources\usercontrols….ascx.cs 11 18 C:……\

I removed project and file names, of course, but this is basically what the error says.

Since the error is with temporary files, what should I do?

I do not see a "clear" option in visual studio to clear out the files of a compile.

enter image description here

Best Answer

This problem I faced sometimes back while compiling. Go to this folder c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and delete all the files and folder under it. When you build an application which is not hosted under IIS, temporary debug files and folder get created under this folder.

It may happen that you get an access denied error while deleting them. Close your Visual Studio solution and delete everything under this folder. It will resolve the compilation error.

Related Topic