I try to add a new file to my source controlled VS2012 solution and receive this message:
A file or folder with the name 'xxx' already exists. Please give a unique name to the item you are adding, or delete the existing item first.
I'm 100% sure that there is no file with the given name.
So how do I get VS to add items again?
Restarting Visual Studio didn't help, the folder is cached on the system.
Open
Solution Explorer
there is an icon that looks like a many Pages: which is theShow All Files
. Once clicked, one is able to see the hidden, to the visual studio project, the folder that was causing this error. (Look for the folder in the View section.)After I deleted the unwanted folder, and Rebuild Project, You should be able to Create the controller which will create the view automatically...
If you're trying to create a new Controller, you should also check the Views and Models. Even though there was no folder or file with the Controller name, I had to delete a View folder with the same name (that already existed for some reason) using
Show All Files
and rebuild the solution.Restarting Visual Studio helped me.
The project file was unloaded in visual studio 2017
The easiest way is to copy your project folder and paste different repository then open your project in visual studio then after run the project, it should work. for example (D:--------->E:[here i mentioned repository these things])
I fixed it by actually adding a file and then deleting it again.
Steps if a folder is Missing
Show All Files
in the solution explorer to show the existing, but missing folder.Include in Project