Is it safe to delete the obj\Debug folder in a C# project?

Cenk 1,021 Reputation points
2024-10-15T07:08:47.9166667+00:00

Hi,

I am encountering the following error:

Severity	Code	Description	Project	File	Line	Suppression State	Details

Error (active)	MSB3713	The file "obj\Debug\net6.0\IMS.CoreBusiness.AssemblyInfo.cs" could not be created. The process cannot access the file 'C:\Users\Source\Repos\IMS.WebApp\IMS.CoreBusiness\obj\Debug\net6.0\IMS.CoreBusiness.AssemblyInfo.cs' because it is being used by another process. The file is locked by: "EXCEL.EXE (19948)"	IMS.CoreBusiness	C:\Program Files\dotnet\sdk\8.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets	199

Is it safe to delete the obj folder under Debug?

Thank you.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,571 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,584 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tiny Wang-MSFT 2,721 Reputation points Microsoft Vendor
    2024-10-15T07:41:30.0233333+00:00

    Is it safe to delete the obj folder under Debug?

    It's safe to delete the obj folder under the Debug directory. The obj folder is used to store build files such as compiled assemblies, generated files, and metadata. Deleting it will not harm your project, because the folder will be generated again once we rebuild the application. Deleting obj and bin folder is a good approach when we faced an issue similar to: I have a project which working in my computer, but I copy and paste my project into a new computer it gave me complied error.

    The error message you shared contained The file is locked by: "EXCEL.EXE (19948)" IMS.CoreBusiness which looks like you were trying to delete the obj folder but failed. Maybe you can restart the application which can make sure this folder is not in use. You can certainly try to find "EXCEL.EXE(19948)" in task manager and then stop it.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Tiny

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.