Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do You Clear an ASP.NET app for compiling?

Tags:

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

like image 417
xarzu Avatar asked Jul 15 '13 09:07

xarzu


People also ask

What happens when an ASP NET application is compiled?

Automatic CompilationASP.NET automatically compiles your application code and any dependent resources the first time a user requests a resource from the Web site. In general, ASP.NET creates an assembly for each application directory (such as App_Code) and one for the main directory.

Where is temporary ASP Net Files folder?

The temporary files generated by Visual Studio after creating and running an ASP.NET application reside in: %SYSTEMROOT%\Microsoft.NET\Framework[64]\<vernum>\Temporary ASP.NET Files folder. The folders and files under this folder can be removed with no harm to your development computer.

Can Visual Studio 2012 create Web API?

Task 1 - Creating the API ProjectRun Visual Studio 2012 Express for Web, to do this go to Start and type VS Express for Web then press Enter. From the File menu, select New Project. Select the Visual C# | Web project type from the project type tree view, then select the ASP.NET MVC 4 Web Application project type.


2 Answers

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.

like image 169
Gayatri Avatar answered Oct 05 '22 08:10

Gayatri


For those using Visual Studio 2015 in Windows 8 or Windows 10, the solution is to remove all temp files from the following location:

%AppData%\Local\Temp\Temporary ASP.NET Files

and then rebuild your Solution.

like image 38
Paul Avatar answered Oct 05 '22 07:10

Paul