So I just performed the coup de gras on my project by accidentally clicking on Exclude From Project instead of Add on my controllers folder.
When trying to add a folder named Controllers I get the error "this folder exists". However, If I try to click on the project -> Add Existing... I cannot select a folder, but only the controllers.
Kind of at a loss here, has anyone had experience with this, or does anyone know how to get the folders back into the solution?
Click on the Show All Files icon in the solution explorer and then simply include the folder:
Visual Studio Express 2012
Select Your Project Folder Click On "Show All Files" icon to show all Excluded Folders And Files
Then Right Click on Excluded Folder or File and Click on "Include In Project"
In my ASP.Net Webforms project after excluding the file I could't find it even under 'Show all files', but they were at project folder so I had to right click on project in Visula Studio then add existing item.
For anyone wanting a different solution, you can also browse to your project in a File Explorer and delete the offending folder (Be sure to copy it somewhere safe first!). Restart Visual Studio and proceed to add the folder as you regularly would.
Related
I have Visual Studio community 2017. coming from eclipse it was just enough to copy file to project directory and hit refresh then files were appearing in project explorer.
In VS, however when I copy some i.e. *.cpp or *.h in windows explorer to project directory, in VS solution explorer I can not see them. switching to folder view I see but can not include them into project.
via drag&drop to solution explorer (project view) I see them but are not part of project and in folder view and actual directory there is nothing.
what is going on with VS? How can I manually copy paste some files into project while they become part of project?
I will note that there's nothing "going on" with Visual Studio in the sense that something is actually wrong with it, it's just that adding files to your project just requires you to actually add them to your solution. Essentially, it allows you to add miscellaneous files to your folders without automatically including them in your build project (for example, if you're working with some test images/files).
To add files/folders to your project you simply right click on your project in the Solution Explorer and then go to Add > Existing Item.... Then, it's just a matter of selecting one (or Ctrl + A/Shift Clicking to select all/multiple files) and then it will add them to your solution.
In the solution explorer pane, click on the show all files button,
it will reveal all files including your pasted file,
Right click on your file and select "include in project".
In older versions of VS when you dragged a folder from windows file explorer into your VS solution, it would make a reference to that folder including all the sub folders' structure and files.
In VS2015 when I drag a folder into the solution it simpley makes a reference to all the files in that folder and sub folder but ignore the folder structure.
So it dumps all the files reference under one filter.
Is there a way to get the former behavior in VS2015?
The way that I do this is to add the folders to the project structure (i.e. underneath the .sln file) and then enable "Show All Files" (you may need a "Refresh").
Right click the folders you want to add and click "Include In Project".
(I didn't know about the drag and drop!)
The answer is as follows:
the reason you don't see the "include in project" is : either you created the solution externally to visual studio community or the solution got corrupt
to resolve this:
make a backup the solution (just in case)
in solution explorer - right click the project name , and choose "Rebuil solution"
Press the "show all files" (if not pressed already)
go to the folder you want to include, and now you should see the "include in project" option. Choose it
press again the "show all files" button (on top of the "solution explorer") to once again hide irrelevant files/folders from your solution explorer
Working with VS2015 and SSIS Solution:
Miscellaneous Folder - When I created a Sub-Folder in VS2015 and then Added the files contained therein it added them but not with the Name I Had but the name "Miscellaneous". Not how it worked in previous versions!
I was able to Add a Custom-Named Folder to the Solution but not the Project. When adding existing files to the Project it put them under the aforementioned Miscellaneous Folder.
I have a large directory structure I want to add to a solution. I can't drag the folder into the solution explorer, and there is no button to 'show all files'.
It´s very simple, first copy all directories where you want.
Then open your solution, and select the project that you want add these folders. Go to Project Menu and do click in show all files.
Now you can see your folders in solution explorer.
Next right click in folder and include in project.
Thanks.
I try to add a new file to my source controlled 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 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...
Restarting Visual Studio helped me.
Steps if a folder is Missing
In the Solution Explorer window
Select visual studio project which holds the missing folder.
Select or turn on the Show All Files button ( ) to show the existing, but missing folder.
Select the hidden folder then right click and select the menu item Include in Project to add into the project in the project view.
Simply, On Solution Explorer Right CLick on Project's name -> Unload Project.
then right click on the same project and click 'Reload'.
Problem is Fixed (y)
If you're using MVC, and 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.
I right clicked and removed folder. Then Clicked upper the folder I wanted to create project in and created project. In the Location section I opened the File explorer and the file I had deleted still appeared -> deleted it from here and then went ahead.
I fixed it by actually adding a file and then deleting it again.
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])
Visual Studio 2017 v 15.9.12 ... I ran into this problem, but with no actual folder conflict. In my case, I had solution folder named NewOrder, and I was trying to create a child project with the same name, but encountered the above error. I tried closing and reopening the solution (didn't restart VS so not sure if that would have made a difference) but here's what worked for me.
renamed solution folder
created my project. At this point, I got a strange error about not being able to locate the .net standard 2.0... so then I did restart VS, which fixed that problem
renamed the folder back
Now everything works fine. I restarted VS again just for good measure and all works fine now.
In my case, when trying to add a new project to a solution, even though a project with the same name had been removed from the solution in visual studio (2019), I had to open file explorer and delete the folder for the removed project.
I just had a tab open with the file name, closing it solved the issue for me
Click on Show All Files Menu in Solution Explorer and See That file in Controller, Views and Model Folder and delete that from there also
You need to give attention if adding a file automatically add other files/folders..for example if I added a controller which automatically add folder with controller name in views..I couldn't add controller .cs file until I deleted folder with controller name from views.
I have an existing directory structure that is all nicely checked into SVN, so I don't really want to mess with it.
The website code lives in a folder called C:\Projects\TheProject\Website. I want to bring the website files into a new Web Application Project without changing the directory structure.
Ideally the resulting file structure would look like this:
C:\Projects\TheProject\TheProject.sln
C:\Projects\TheProjects\Website\Website.csproj
No matter what I try I dont get what I want. There is no option to create a web application from existing code. This is very frustrating. Does anyone know if it is possible?
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Have you tried something like this?
Create a new Visual Studio Blank Solution from File-->New Project-->Other Project Types-->Blank Solution, making sure to specify c:\Projects\TheProject as your solution directory.
Copy the folder with all of the existing website stuff into c:\Projects\TheProject\WebSite.
Back in Visual Studio, right-click your solution in Solution Explorer and select "Add Existing Website." Then, pick your c:\Projects\TheProject\WebSite folder.
Good luck, HTH.
Create a new web project with a .csproj file. Delete all the files it comes with. Drag everything into the project.
In the File menu, click Open, and then click Web Site. Choose the root folder where your Web Site is located
On top of #cbp answer I would like to add that if you would like to keep the Version control history of those files - in step 6 - instead of copy do:
git mv original-website/* new-web-application-directory/.
What have you tried? I normally create a blank solution and add existing folders (drag and drop on solution explorer works best), and have not had a problem.
in VS 2008 File->New->Project From Existing Code