9

I created a Visual Studio 2010 project that I want to remove completely and that includes all project folders.

I'm logged in as the administrator.

I tried to delete the folders in the file explorer, but only get a message telling me I need to have administrator permission to delete it.

Visual Studio seems to have put a lock on the project folders that an administrator account can't access.

I know I have rights to create and remove folders on my own because I created a test folder and deleted it without any issues.

Do you know a work-around for this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152

13 Answers13

17

Solved:

Here are the steps I took:

  • Navigate into one of the folders inside the one to remove. If it can't be deleted, navigate into a sub folder.

  • Delete it.

  • After the sub folder are removed, I was able to get rid of the main solution folder.

  • I have not tried this yet for deleting, but I recently found how to turn on the hidden Administrator account. I'm assuming it would let me delete the files.

Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152
  • In my experience, you have to navigate to obj/Release and delete its contents. Once you've cleared out that folder, you must delete Release, then obj, then obj's parent, and then obj's parent's parent, and so on and so forth until you've deleted the project directly entirely. If I never have to develop under Windows again, I'll be a very happy man. – weberc2 Nov 01 '12 at 13:29
  • I have been using a Mac mini with parallels desktop for developing in windows. I really got spoiled by the Mac. Yes I agree with you about windows. I hope one day visual studio and sql server will be available for Mac. :-) – Emad-ud-deen Nov 03 '12 at 02:34
14

There is a process (VBCSCompiler.exe) in Windows Task Manager to every solution you have started it. to delete the solution directory you have to kill this process (VBCSCompiler.exe) then delete the directory.

3

Try to exit from Visual Studio first

bluebyte
  • 560
  • 2
  • 7
  • 23
2

Go to task manager and find all visual studio programs and end the tasks.

Then delete the folder.

1

I had the same problem. None of the suggestions I found on the internet worked (ownership, permissions, etc.) I had all this anyway as I am administrator on my PC and the dialogue box said I must get permission from myself to delete it!

In the end I renamed the folder 1st, then deleted it. It worked. I tried to verify this, but subsequent folders that I created with VS didn't give the same problem.

Henri
  • 11
  • 1
1

This is a major annoyance. I'm tempted to write a DOS batch shell script that drills down and removes files from the bottom of the project hierarchy on up. But I've a job with deadlines.

I just cut and pasted the project folder to my c:\temp folder to get it out of my sight!

Joe
  • 19
  • 2
1

I added a new item like user control. Then excluded the folder from project. Closed VS 2010. Then went to the project folder and deleted the files/usercontrol.ascx. Finally deleted the folder. Now opened the VS solution from my local drive itself and did not use view start page-link to open the solution.

1

None of the answers worked for me. Only after i ended the process devenv.exe via Task Manager, it allowed me to delete .vs folder.

TValerii
  • 160
  • 1
  • 6
1

For me, it came down to the /bin/roslyn/ folder. If this is the case for you, end all instance of VBCSCompiler.exe in the Task Manager.

Can not delete \bin\roslyn\VBCSCompiler.exe - Access is denied

drew08
  • 11
  • 1
0

In my case, none of these solutions worked.

For those who run their application with Docker support, make sure you stop the container first with:

docker stop your_container_id

or

docker rm -f your_container_id

and then you can delete the project folder. However, in some cases, you may have to quit Docker temporarily to delete the folder.

nPcomp
  • 8,637
  • 2
  • 54
  • 49
0

I deleted the .vs folder and then the other folders at the same level. That allowed me to delete the main folder.

0

I have experienced same problem with visual studio 2022 multiple time and every time this solution works.

If you don't want to do anything then wait for 1 min and try again to delete that folder after closing visual studio.

I think windows takes some time to automatically clean up resources in Project folder used by visualstudio.

Hemendr
  • 673
  • 6
  • 12
0

I was able to delete the folder only after deleting all of the files in all the sub folders first.

Very strange though. It seems Visual Studio somehow locks it even after a reboot but it does not lock the individual files. For example I had to remove all the files in 1 particular folder. Once they were deleted it allowed me to delete the folder itself.

Well, at least I know how to handle it the next time.

Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152