Can't delete project folders created by Visual Studio 2010 - visual-studio-2010

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?

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.

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.

Try to exit from Visual Studio first

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

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.

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.

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!

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.

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.

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.

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

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

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.

Related

"The item already exists" when adding trying to add files to TFS

I am having problems adding files to TFS Online. Here are the steps I made to get up to this point:
Created a project in TFS "SomeProject_Classic"
Mapped it to a path in my computer C:\SomeProject\classic
Pushed all files from from WITHIN the \classic folder to this project
Deleted the project in TFS
Recreated a new project in TFS with the same name ("SomeProject_Classic")
Mapped it to a path on my computer C:\SomeProject
I try to add the classic folder (not only the files in it like step 3, but the entire folder itself)
On this last step, it gives me the error "The item $/SomeProject_Classic/classic/somefile.txt already exists".
Basically, I think it is having a problem thinking that I have already added these files because I created a project with the same name in TFS and never "checked those files out for deletion" before deleting the project.. I feel like I need to clear a cache or TFS memory or something. Any advice?
Clean the Cache folder on client computer. The folder path is: C:\Users\username\AppData\Local\Microsoft\Team Foundation\6.0\Cache.
Use the tf destroy command to destroy, or permanently delete, version-controlled files from Team Foundation version control. Check:https://msdn.microsoft.com/en-us/library/bb386005(v=vs.100).aspx
This was somewhat related to Cece's answer in that even though it was deleted on the server, my local computer still thought the file were in the uploaded workspace.
What I did was create a temp folder TempRepo on my desktop and moved the files from the "classic" folder to it. I mapped my workspace to this TempRepo folder. Then I was able to "add existing files" to the workspace and push my files from this temp folder to Visual Studio Online.
When I was done, I just mapped the workspace back to the original folder and performed a "Get" operation. Now I have all the files uploaded onto TFS and the correct workspace set.
I just changed the file name. Fixed it.
Just do "Undo Pending changes" and delete the files and check-in again...problem will be fixed..

Creating a virtual directory failed with the error

I can't solve this problem
I suggest I have to change c:\Windows\System32\drivers\etc\hosts file and add after
# localhost name resolution is handled within DNS itself.
the next line:
127.0.0.1 mysite.dev
but it doesn't help. Any suggestions?
Error ocсurrs when I try to open web site project in Microsoft Visual Studio 2012.
More often than not, at least in my case, this happens is when a *.csproj.user file is in the project directory and has <UseIISExpress>true</UseIISExpress> in it.
Alternatively, as mentioned by Zachary Cutler you can also simply: close Visual Studio, delete the *.csproj.user file and reopen Visual Studio. This will force VS to rebuild the file.
I've already found the solution. I just had to edit C:\Users\Administrator\Documents\IISExpress\config\applicationhost.config file, by adding my site to <sites> node.
You can opt to install IIS locally and edit a couple of tags on .csproj File.
Open you csproj file and go to section <VisualStudio> then find tag <UseIIS>True</UseIIS>
it must be set as true, then go to tag: <IISUrl> and set up with the URL address where the application will be hosted for testing:
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort></DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
**<IISUrl>http://localhost/myWebSiteAppSample</IISUrl>**
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
And that is. Now you can load your project normally.
The problem would be your project setup to be executed in the local IIS and the URL specified not exist.
There are options you can do to fix the problem.
Option 1 : (Use IIS Express)
1.) Open you web project .csproj file as XAML or in notepad.
2.) Find these properties and set according to your preferences.
UseIIS = false
UseIISExpress = true
and that's it.
Option 2 : (Use local IIS)
Follow the option 1 steps but change the following properties.
UseIIS = true
IISUrl = https://localhost
UseIISExpress = false
The issue can be fixed by deleting the folder named .vs in the project directory.
This solves the problem because while opening the project after deleting the .vs file, it creates the same folder with subfolder config and folder with project name.
The config folder applicationhost contains the necessary settings required to run the project successfully.
I just went to the directory named in the error and renamed the applicationhost.config and restarted and VS created a new file and ran fine.
Tried several approaches mentioned in the answers, but what finally
worked for me was swapping the <IISUrl> of .csproj with
<CustomServerUrl>.
Edit :
The above didn't solve the root cause of the issue for me. However,
If you've done a windows update recently, perhaps it might be the
reason that's causing the issue. Try executing netsh http add iplisten 0.0.0.0 and see whether it solves the issue.
Hope these would help someone still looking for a way.
I don't know why, by my applicationhost.config file was completely missing from my C:\Users\Administrator\Documents\IISExpress\config\ folder.
Copy/pasting C:\inetpub\history\applicationhost.config into that folder seemed to fix the problem for me.
Got the idea from here.
Turn on windows features "Internet Information Services" in control panel.
Open ".csproj" file and find
Modify this line based on your requirements.
http://localhost:777/
Open the project/solution now
If failed to load again, just right click the solution and select "Reload Project".
I know this is probably a rare occurrence, but figured I'd put it here:
My csproj file was set to "read only" (Don't ask me how I managed that), but after I turned off "read only" access, everything was fine. (VS2017)
Not the exact same error, but I was lead to this answer since the first half of the error matched. Your applicationhost.config file may simply be read-only. Taking that off solved the error for me. That error calls out the file specifically though, so you should be able to find it easily.
I had to somewhat combine some of the above answers. My solution was to edit (not delete) the file .vs\config\applicationhost.config
There is a section for the bindings of the site, simply change from localhost to whatever you desire to run it under. Note that the port numbers are in front of the server name.
I was able to resolve this by editing the file *.csproj in the root level of the project. I changed and from localhost to the site name as shown below. It may also be required to have the OverrideIISAppRootUrl set to True.
I was facing the same issue because of my network password changed.I changed my NetExtendor login password but I have to login in my laptop with old password.
Try these steps to fix this issue:
log into the Computer with whatever password works
log into vpn with whatever password works
ctl-alt-del to lock the pc then use the new password to unlock it
It worked for me :-)
Thanks!
So here are the steps to fix it:
Go where your .csproj file is. This is usually one directory below the solution (.sln)
Right click and open with a text editor (notepad)
Find IISUrl tag and replace its content for http://localhost:(YourPortNumber)
Save and reload your project!
My issue was with Windows 10 Defender. I had given IIS permission in the past, but seems like it is now ignoring it. Will look into it later, but for now I disabled controlled folder access and it worked.
I wanted open an exiting project of Visual Studio 2017 in VS 2019 and encountered with the same issue. I find its a version related problem. The solution is: Create a new project in the newer VS and copy the codes from the older VS.
Try decrypting the applicationhost.config file. That worked for me.
Creation of the virtual directory xxxx failed with error: Object
reference not set to an instance of an instance of an object...
Error Screenshot
This issue happened to me after deleting my local repository and downloading the repository from the cloud.
Per one of the solutions above, I deleted the .vs folder with no luck. To solve the issue, I ended up mixing a couple of the solutions in this forum.
I went to the folder .vs/SolutionName/config and pasted the applicationHost.config file from the latest subfolder on the folder C:/inetpub/history/
After that, I restarted VS and the error disappeared.
simply fix for me
Close your Visual Studio
o remove .vs in .Net
o remove IISExpress in Documents
Reopen it, everything should be fine

visual studio keeps asking to save project file as

I am using VS 2010 and recently I moved some files around and changed paths etc.
The solution still compiles correctly and all files are able to be loaded/compiled without error however just about every time I go to compile after a change it gives me the save as dialog and asks me to save one of the projects, if I try to give it a new name or something the dialog does not exist nothing I do can make it exit apart from pressing cancel.
If I do a build straight after cancelling it works fine and I'm not presented with the save as dialog. I have verified that the project file is not read only.
Any ideas as to whats going on here.
The solution is stored in TFS 2008
You need to do 2 things
1- remove the read-only tick from the project folder
2- when a save-as window prompts at build, just overwrite the project
next time you build, the window won't pop up
You need to run VS as administrator. (right click on VS Icon- Run as administrator)
I solved the issue. When I try to save as this time it gives the error that file is being used by another process. Google Sync prevents to save so it opens save as dialog.
You should put your project under a folder not sync while working.
Are the bindings in TFS set up correctly with the new location? TFS will mark files as read only unless they get checked in. It might have been marked as such before you moved everything around, and now, isn't being checked out properly.
Also, try closing sync. files tools like google backup and sync.

Visual Studio Publish Failed: "Unable to delete file ... Access to the path ... is denied."

I've recently switched from a Windows XP machine to Windows 7. I use Subversion and TortoiseSVN.
I cannot publish my .NET application in Visual Studio. I get over a thousand errors like this:
Unable to delete file
"obj\Debug\Package\PackageTmp\Views\ViewName.svn\text-base\ActionName.aspx.svn-base".
Access to the path
'C:\Code\SolutionName\ProjectName\obj\Debug\Package\PackageTmp\Views\ViewName.svn\text-base\ActionName.aspx.svn-base'
is denied.
Why is Subversion giving me trouble? How do I fix it?
I disabled the file indexing of my bin and obj folders. But, that didn't work.
I noticed that my folders were read-only. I changed that.
It worked! Publish succeeded.
I believe your issue is related to the default permissions assigned the to C: drive in windows 7 (and Vista).
Open explorer and find the c:\code folder
Right click on the c:\code folder
and select properties
select the security tab
select the user ID "Users"
In the permissions box, tick the
"modify" allow box
Select OK, OK until permision dialog
boxes close
That should resolve the permission issue
I had this same problem, and none of the previous solutions worked. What worked for me was to take the bin and obj folders out of repository. After doing that, I was able to publish.
The most likely cause is a permissions issue. The path in question may have been created while you were running with elevated permissions and hence requires admin permissions to delete. Try running Visual Studio as an admin and see if the problem goes away.
If so then the best solution is to do the following
Save the changes to that directory (check in if necessary)
Delete the repository
Re-check out the repository and ensure you are not running as an admin when doing so
I just deleted the existing folders at the publish destination which then allowed publishing to work. Un-setting read-only didn't seem to work. (Not sure why this started occurring).
What actually works is the solution that Zack Peterson gave? Thanks Zack!
I am writing an application that will automatically remove all of the .SVN folders and files during deployment. While doing so, I was getting the same error as described above.
Once I changed the folder to NOT be Read Only, I was able to delete files and folders programmatically.
My next step is to set the attribute programmatically on NOT Read Only so that I can accomplish the entire installation with the click of a button.
Oddly enough, I tried building an old project with Visual Studio 2010. It gave me the error that it failed due to my access being denied. I tried to remove the read-only off the directory and had no luck.
Although, when I opened it in Visual Studio 2015, it gave me the error that my certificate was expired.
Upon creating a new certificate and rebuilding - everything was fine.
For me, the windows service was running in the background. closing the service from the task manager and then rebuilding the project did the job for me.
If you are being denied access to any specific folder, then it is being used by some other application.Check if any other application is using that path to reference that folder of any file in that folder.
In my case , my application was reference a file inside the bin folder. So every time i publish and delete the old one. error will be thrown that bin folder can not be deleted. access denied.
i went in my application. checked in the refrenced path of each dll, removed the ones which referenced the publish path and BOOM
Issue solved.
My problem resolved after doing:
Close VS and Restart your machine.
Update all your softwares to latest stable versions at Manage Nuget package for solution
Run your test now.
Hope this helps.
Right click on the shortcut you start the IDE from and select properties. Click advanced and click'Run as Administrator'. Worked as charm for me.

The project file has been moved renamed or is not on your computer

I get this error when I try to load a VS 2008 project from TFS source control:
The project file has been moved, renamed or is not on your computer
After I click OK the project says "unavailable".
What is the problem? How do I resolve this? I never had this problem before. Some blogs said to delete the .suo file but I can't locate the .suo file. I deleted the entire project on my local computer so that the next time it opens it will create a new one, but I still get same error.
What typically helps to fix it is deleting the Solution User Options aka "SUO".
VS up to 2013
In the older VS it is stored as a "hidden" SolutionName.suo in the same folder as the main .sln file.
VS2015 or later
In VS2015 the same data was moved to a "hidden" .vs folder under the same folder as the main .sln file.
I just ran into this issue using VS 2013 after renaming a project. Stanley's answer guided me to the solution:
Close VS - delete .suo file - start VS again.
Delete the .suo file in a special way.
Don't have the solution open when you delete the hidden .suo file.
Restart VisualStudio.
Open solution and Add project without error message.
TFS works like most source control packages: It remembers what it has put on your computer so that when you "Get Latest" it only has to get the chnages since your last "Get" instead of having to get absolutely everything.
This has one caveat: If you delete or rename the local files on your disk, TFS won't know that you have done this, and it will still think they are where it left them.
If you then "Get Latest" it will not bother to update the missing files.
You are then likely to get all kinds of "missing file" errors, from TFS and any other tools that look for the files.
To get around it, you need to:
If you think you might have any changes in there that you don't want to lose, copy the source folder on your PC as a back up just in case!
Right click on the project (in Solution Explorer) or folder (in Source Control)
Choose "Get Specific Version" from the context menu
Choose to get the "Latest Version" and tick the option that says (something like) "force get of files already in your workspace", which tells TFS to forget about what it "knows" and get all the files again anyway.
If you have any locally-changed (writable) files, then be careful. There is a second option that will overwrite these, losing your changes. But you have the backup, so you should be safe. It's generally better to tick this option as well to make sure that all your source code is completely up to date. (But obviously only if you don't mind losing any local changes!)
When you OK, this will forcibly get all the files in the project to your local drive, and should correct the problem.
Easiest option worked out for me is:
Right click the project & Remove the "not loaded" or "unavailable" project
Right click the solution & Add "Existing Project"
Though it's well known VS defect, definately we can handle it!
Open the solution file in edit mode
Modify the relative path to match the modified/moved physical path ..
SccProjectUniqueName1 = Source\\Order\\Order.csproj
SccProjectName1 = Order.ApplicationService
SccLocalPath1 = Order.ApplicationService
Also, makesure of correct relative path for the referring project(s)
Project("{asdasd-301F-11D3-BF4B-asdasd}") = "Order",
"Source\Order\Order.csproj", "{E25641BC-C990-40E2-8876-08AE8728F763}"
EndProject
Try opening the .csproj or .vbproj instead of the .sln. What has probably happened is the .sln (solution) file has a absolute file reference (instead of a relative path) to the compoenent project(s). You may need to re-create the .sln, or hand-edit it.
In my case, deleting the .suo file was insufficient. I discovered that my workspace configuration had an error. I discovered and resolved the problem with these steps:
In Team Explorer, "Manage Workspaces..."
Click "Edit..."
Correct the value under "Local Folder"
Finally, delete the affected .suo files per the accepted answer.
I found it easiest to create a new Solution sln file.
Clear out your workspace mappings (File -> Source Control -> Workspaces). Edit the workspace and either clear out all the mappings (more repercussion) or find the one that's associated to this server path. Then open Source Control Explorer and remap. Double click the SLN in Source Control explorer and it should get latest. Not entirely sure what has happened or what state you managed to get into, but with this should get you moving again.
I ran into this issue and was able to resolve it by obtaining the .rptproj files from a co-worker and copying them into my local directory. The project was then able to re-load.
I spent a lot of time for trying solve this problem. I did these steps : rename project, rename namespaces, rename project folder, edit .sln file, edit hidden .suo file. Project loaded but it was unrecognizable for TFS! Finally I found this guide.
If you're using Resharper and TFVC is your version control, follow these steps :
Right-click the project in Solution Explorer, select Rename, and enter the new name
Right-click the project again and select Properties. Change the "Assembly name" and "Default namespace" on the Application tab.
Right-click the project again and select Refactor -> Adjust Namespaces. Accept the changes.
Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs
Delete bin and obj directories in Windows Explorer
Open the Source Control Explorer and rename the project's directory. This will close the solution. Let it be closed.
Open the SLN file (with a text editor such as Notepad++) and change the path to the project (there should be multiple places).
Open the Solution again. Clean and Rebuild the project.
Right click on the unavailable project and edit the project file ... chances are, you will find a hardcoded file path or a virtual one that does not match where you checked the project out to.
Kindness,
Dan
Solution for this
Again rename the project folder
Set specific version & force get in TFS
remove read only & hidden option in the latest folder (not the rename one)
Now you can open the project without any issues
Sometimes, even though you changed .sln and .csproj path, and manually rename, you might forget to check the folder name that contains the project.
It happened to me too. Apparently the csproj files were not checked in when I had created them in my old computer, and so when I downloaded the project from TFS in my new computer, the files were not there.
After checking them in using my old computer and getting them from TFS in the new computer, I succeeded in reloading the project.
In my case, because I modified .csproj file, it changed to .csproj.user .
I remove .user from the end of the file.

Resources