Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A file or folder with the name already exists Visual Studio

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?

like image 221
Ruudt Avatar asked Aug 23 '13 12:08

Ruudt


People also ask

What will happen if you create a file with the same name which already exist?

If you were to create a same file that has the same name to it then your computer would recognize the file with the same name and will ask you whether you would like to replace the existing file or if you would like to make duplicate copy of the existing file.

Which folders already exist in File Explorer?

Some folders already exist in File Explorer, such as Documents, Desktop, and Downloads. (Documents may be called “My Documents” in older versions of Windows). You can create more folders or folders within folders to allow for better organization. To create a folder, right-click, then select New>Folder.

How do I add an existing directory to a VS solution?

Right click the project or contained folder and choose Add | Existing Item... . Use Show All Files . Click on files or folders you would like to add to the project and choose Include In Project . Drag and drop files and folders from Windows Explorer.

Can I delete the .VS file?

No. You should not delete.


2 Answers

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: Show All Files which is the Show 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...

like image 122
misterzik Avatar answered Sep 18 '22 12:09

misterzik


Restarting Visual Studio helped me.

like image 44
niaher Avatar answered Sep 17 '22 12:09

niaher