Visual Studio 2015 not creating subfolders for projects? - visual-studio

When I try to create a new project by selecting visual c++/general/empty project. The subfolders for the project are not created. It was working just fine for one project then I deleted that project and haven't been able to get it to create them since. The folders I'm talking about are like the source folder and others when you open up the project folder. How would I go about fixing this?

When you create a project, it exists inside a "virtual" solution. The solution becomes visible once you add a second project. Go in the File menu, Add, New Project.

Ok so after several hours trying to figure out what had happened. I finally came to the conclusion that it had something to do with the solution explore. When I was looking for it I had opened it up to view it. Turns out that what I was looking before was the class view, and when I opened the solution explore the folders I was looking for were right were they should have been.

Related

Refactor Solution Folder to New Solution

I've got a a fairly large project with many code files in Visual Studio 2015.
This folder contains lots of structures and classes that have no ties to the solution they're in, but need to be moved to an external solution to resolve a circular dependency issue.
Is there any way to automatically refactor a solution folder in VS to a new project? Resharper/other?
I found that while resharper is enabled, you can right click on a solution folder and select "Move" to automatically refactor a solution folder and it's contents..

A file or folder with the name already exists Visual Studio

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.

The working directory does not exist in Visual Studio 2010

I am using Visual Studio 2010.
I wanted to study some code that dumps relevant data in a database, find out how it works and adapt it to my own version.
I only got as far as loading the solution in VS 2010, hitting the "Start Debugging" button, and then I got this error:
The working directory does not exist:
'D:\Dev\CodeProject\articles\smartcardfmwk\Smartcard_Framework
How can I fix this error?
The source code in question is Smart Card Framework, from Code Project
I downloaded the "Updated Project (VS2010)" and I can open it in VS2010, as well as build, but debugging just wouldn't work.
I did not try replicating the path yet, but as this is a working project, my company requires that it is placed on a very specific location accessible by others.
Nevermind, I got it. It was so simple, I'm sorry for wasting anyone's time.
The source Solution had a lot of Projects under them. I figured at least one of them was pointing to a directory that doesn't exist, so I waded through the Projects,
I right-clicked a Project and clicked the Properties
This will open up the ProjectName Property Tab
Under the Debug tab, there is a filed called "Working Directory"; I changed it to where the project is currently located.
This solved my problem, for now, unless there's a Project I missed. I am wondering, though, if I have to do this again if I move the Solution elsewhere.
This happened also in VS 2019 after importing / upgrading an old C# project. I was not able to see any project properties to change.
Finally it was fixed by manually editing the file <ProjName>.user.csproj as follows:
Replace
<StartWorkingDirectory>[wrong directory name]</StartWorkingDirectory>
with
<StartWorkingDirectory>.\</StartWorkingDirectory>
I also faced this problem that working directory does not exist, but I managed to solve it. There are certain steps to follow properly Whenever this error occurs.
In VS, open the "Project" at Toolbar.
Then go for Project properties.
Select Debug And check your working directory. If the path is wrong just browse it...

how to rename a project without killing solution

When I rename a project within a solution, and then try and build that project, I get the error: "The project file "xyz.csproj" was not found. Where xyz is the old project file name!
The annoying thing is that I can search my project & solution for the old project file name, and the search will come up with nothing, and when I click on the error VS does nothing.
So there seems to be no way of finding where the old reference is.
This is a .web project hosting a silverlight page, if that makes any difference.
These are steps I follow when I rename a project:
Click on the project in the solution and rename it. This renames the .proj file and the project name(but not the directory containing the project).
Close solution, rename the project folder. At this stage, the solution still references the old folder.
Open sln file and replace the old folder name with the new one. This should only be in one place. it will look something like this.
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "OldProjectName\NewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"
You will need to make it look like this:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "NewProjectName\NewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"
With all visual studio projects, you can usually just close visual studio, edit the solution/project files with a text editor, and reopen visual studio. They're just XML. As long as you're careful not to change anything major, a search & replace in a text editor should do the trick.
OK this was my problem.
I deleted the service reference to the project I renamed, but still got the error message, then via some trial and error adding and removing projects I found that there is a "WCF Ria Services Link" Project property, doh.
That's a bit of a trap.
I also had to rename the namespace and point the project's startup object to the renamed program:
<old_project>.Program to <new_project>.Program

Source Safe 6.0d and Visual Studio 2005 project tree problems

Whenever I try to add a new project to my SourceSafe repository it creates 3 folders with the same name nested within each other. There is only one folder on my drive yet in Sourcesafe there are 3??
Can anyone suggest what may be causing this?
Thanks
If you drag and rop a new project folder into VSS and do a recursive add then that's just how it works. Otherwise you have to create your own root project folder in VSS and add each file one at a time to VSS by hand.
Try creating the project in VS2005 disconnected from source control, then creating the project folder in VSS, set the working folder correctly, add the files to sourcesafe from VSS, then lastly edit the source control bindings in VS2005 and check the bound project into source control.
A little kludgey but this is how I do it.
well, that problem comes due to visual studio. because visual stuio by default save solution file in the my documents/...../.../vs 2008/projects/ location and that address is also saved in the .sln file.
that's why every time you get latest within visual stuio it try to creat same strucute and make another copy with in the main project folder.
Solution, well i still trying to figure out how to tackle it.
cheers,
Genious

Resources