Asp net website publish does not recompile the codebehind


ASP.NET is a popular programming language used for developing web applications. One common issue that face is when the ASP.NET publish does not recompile the codebehind. This can lead to behavior and errors in the . In this article, we will explore the possible solutions to this problem with .

Understanding the Issue

When an ASP.NET website is published, the codebehind files are compiled into a DLL (Dynamic Link Library) file. This DLL contains the compiled code that is executed by the web server when the application is accessed. However, sometimes the publish process does not recompile the codebehind files, resulting in outdated or incorrect code being executed.

Solution 1: Clean and Rebuild the Solution

The first solution to try is to clean and rebuild the solution. This can be done by following steps:

1. Open the solution in Visual Studio.
2. Go to the "" menu and select "Clean Solution".
3. Once the solution is cleaned, go to the "Build" menu again and select "Rebuild Solution".

This will force Visual Studio to recompile all the code files, the codebehind files, ensuring that the latest code is used during the publish process.

Solution 2: Delete Temporary ASP.NET Files

If the first solution does not resolve the issue, you can try manually deleting the temporary ASP.NET files. These files are stored in a specific folder on the web server and can sometimes cause conflicts or prevent the codebehind files from being recompiled.

To manually delete the temporary ASP.NET files, follow these steps:

1. Open the folder where your ASP.NET application is deployed.
2. Navigate to the "Temporary ASP.NET Files" folder.
3. Delete all the files and folders within the "Temporary ASP.NET Files" folder.

After deleting the temporary files, try publishing the website again and check if the codebehind files are recompiled correctly.

Solution 3: Check Web.config Settings

If the previous solutions did not work, it is worth checking the Web.config file for any incorrect settings that may be preventing the codebehind files from being recompiled. Specifically, check the section in the Web.config file.

Ensure that the debug attribute is set to in the section. This will ensure that the codebehind files are compiled in release mode during the publish process.

Save the Web.config file and try publishing the website again. This should force the codebehind files to be recompiled correctly.


When the ASP.NET website publish does not recompile the codebehind, it can cause issues in the application. In this article, we explored three possible solutions to this problem. By cleaning and rebuilding the solution, manually deleting temporary ASP.NET files, and checking the Web.config settings, you can ensure that the codebehind files are recompiled correctly during the publish process. Implementing these solutions will help resolve the issue and ensure the smooth functioning of your ASP.NET web application.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents