A file or folder with the name already exists Visu

2019-01-26 02:45发布

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?

8条回答
趁早两清
2楼-- · 2019-01-26 03:20

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...

查看更多
一夜七次
3楼-- · 2019-01-26 03:24

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.

查看更多
我想做一个坏孩纸
4楼-- · 2019-01-26 03:29

Restarting Visual Studio helped me.

查看更多
5楼-- · 2019-01-26 03:31

The project file was unloaded in visual studio 2017

image

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])

查看更多
劳资没心,怎么记你
6楼-- · 2019-01-26 03:33

I fixed it by actually adding a file and then deleting it again.

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-01-26 03:34

Steps if a folder is Missing

  1. Select visual studio project which holds the missing folder.
  2. Select/turn on Show All Files in the solution explorer to show the existing, but missing folder.
  3. Select the hidden folder then right click and select Include in Project
查看更多
登录 后发表回答