VS2017 renaming projects - the folder already contains an item named - visual-studio-2017

I am reorganizing numerous small solutions/projects into one solution in Visual Studio 2017 but I keep getting error messages like:
The folder already contains an item named 'Staging'
Followed by:
Exception of type 'System.Runtime.InteropServices.COMException' was
thrown
The projects are all in individual folders in a folder called Packages with the project folders named like:
Staging.Finance
Staging.HR
Staging.SharePoint
There is no folder called Staging in the Packages folder and there are no files called Staging in the folder for the project I am trying to rename. The project file name is currently Finance-SSIS which I am trying to rename to Staging.Finance.
There is a project called Staging in my solution but this is in a different folder from these projects.
I can rename the project files outside of Visual Studio but want to understand why I'm getting this error.

Upon searching I came across these three solutions:
Try Restarting Visual Studio.
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
A project can exist in a solution in only one location. To correct this error:
To show hidden Solution Folders, select the solution or a Solution Folder that contains a hidden Solution Folder and then on the Project menu, select Unhide Folders.
Credits for solution 1 & 2: See original answers
Credits for solution 3: See original post

I suggest to search in main projects file content about 'Staging' . For example take a look at solution file (with .sln extension) content and search about 'Staging', I hope you will find it there!

Related

Visual Studio 2019: Linking to folder

I am trying to link to a folder that is not inside the project directory. To give an example,
If my project is in C:\project and I have a folder C:\shared, how can I manage to link C:\shared into the project (and being able to edit/view the files in Solution Explorer) without making a copy of the directory and placing it into the project directory.
I need this due to the fact that many projects will use this folder and it would be ideal to have them edit/use the same files rather than copy the folder into each project individually. That way if a bug is fixed in one project, all other projects will now use the fixed files as well.
For more context, this is a C++ project using Visual Studio 2019.
What I've tried/considered.
Additional include directories
Problem: This does not show the files in the Solution Explorer
Dragging/dropping the folder (or copy/pasting) as seen in another StackOverflow thread.
Problem: This just crashes my visual studio completely. The folder is quite large so I assume that's related to why.
Appreciate any insight on how to proceed. It's really unfortunate that this is a pain, I would think that something like this would be common, but all the posts I've seen related to it have either gone unanswered or could not be applied to my situation.
Thanks.
Shared Projects are the key here.. I just found out they existed. After creating one, drop the folder/files in the same directory that has .vcxitems file. Now in the project you want to include the shared folder, right click your solution, Add -> Existing Project and select your .vcxitems file.

Visual Studio 2019 is having several problems, including loading files

I have been working on a project for a while now (C++), in Visual Studio 2019, but I've suddenly run into several problems that send me in circles between them.
I loaded it one morning, and found that it couldn't load any of the files.
So thinking I must have accidentally moved files or something, I just copied my files again from my Github repository, but then it started having problems with every include file for the headers.
Manager.h is in a different folder in the project, which makes this more confusing to me because if the source files can't open a header file in the same solution, the headers should have problems opening a different header in a different part of the project.
I've tried deleting the project settings and reloading it, but VS won't reload them, and Github desktop is freaking out with any action with the project.
Cloning my repository again and loading that just sends me back to the first problem...
Anyone have any other ideas for what I can do?
Check to see if the files are in the folder present in the error message. If they are that can be a problem with the config files of the project/solution.
Possible solutions:
Since you have the project in the repository, a quick way to solve it would be to delete your local project and clone the repository project. (Or clone it to a different location)
You can try to repace the <Subscriber.h> by "Subscriber.h".
Create a new empty project and add all the project files through the Solution explorer:
right-click on the folder where you want to add the project (I recommend Source for the .cpp and Headers for the .h);
Select Add -> Existing item -> select the files.

Visual Studio 2019, no Intellisense with "Show all files"

I have started learning C++ with Visual Studio 2019 and noticed a strange behaviour. When you create an empty project you are represented with "Filter" files. Now if I active "Show All Files" I can create directories. I created the following structure:
/Core/
/Engine/
Main.cpp
Now if I create a "class" it is, by default, created next to Main.cpp. I would then move the Class.h and Class.cpp into /Core/.
Now if I start editing the newly created files I loose Intellisense. If I uncheck "Show All Files" I get it back. Does anyone else have the same problem?
Another question I wanted to ask was about filter files and project folder structure. Should I use the filter files to organize my project or an actual folder structure? I'm slightly confused because of the Intellisense problem, that's why I'm asking.
And if I should create a folder structure, how should I handle includes like this #include "..\..\... \FileUpInTree.h". In Javascript and Webpack you could define "Alias" Directories to eliminate this. I was wondering if something like this exists for Visual Studio aswell. Maybe namespaces?
Now if I start editing the newly created files I loose Intellisense.
If I uncheck "Show All Files" I get it back. Does anyone else have the
same problem?
I have faced the same issue as you described and when I migrate a file to another folder under the Show All Files filter, Intellisense does not work, which is really strange. When I didn't migrate the file, Intellisense works well at the default address.
And I have reported this issue on our DC Forum and you can add any detailed info on that link and also anyone who is interested in this issue will vote it so that it will make Microsoft attach great importance.
The workaround is that you should uncheck Show All Files and then click it again. After that, Intellisense will turn back and works well.
Another question I wanted to ask was about filter files and project
folder structure. Should I use the filter files to organize my project
or an actual folder structure? I'm slightly confused because of the
Intellisense problem, that's why I'm asking.
Actually, when you use the default project type in c++ projects(not click Show All Files), this structure will automatically identify each file in your project and categorize it into its own filtering folder. At this time, the intellisense works perfectly, because subdividing various files will not conflict.
But in this format, you cannot create folder structure.
Besides, using the filter files or the actual folder structure are the same effect. If you use actual project structure in the Windows Explorer, it will be showed under solution explorer(click Show All Files) automatically.
Suggestion
As long as you do not want to migrate files at will, you can use Intellisense under this filter.
Or
1) create folder structure under Show All Files and then uncheck Show All Files to get Intellisense.
And if I should create a folder structure, how should I handle
includes like this #include "....... \FileUpInTree.h". In Javascript
and Webpack you could define "Alias" Directories to eliminate this. I
was wondering if something like this exists for Visual Studio aswell.
Maybe namespaces?
I think you do not need to worry about this too much.
When you want to use the file under the folder structure of the project, you can just use #include"xxx.h" and the Intellisense will automatically grab the header file in the project.
And if you want to reference a c++ class, you can just use namespace <the c++ class namespace>.

Visual Studio 2010, error when including headers from another folder within the same solution space

I am new to Visual Studio 10 c++, I imported a sample project, the project came with multiple folders in the same solution space project, each with files in it, including any of those files in any other file within any of the project worked perfectly then I added another filter to the project, it worked fine but the files in it can not be included in any of the original project files, is there anything am missing out? I followed these instructions when creating the folder
Right Click project
Click Add
Select New Filter
change Filter Name
Right Click Filter
Add
Select Class
And could someone tell me how to make the Filters and file in them visible in explore, the Sample project came with Visible Filters/Folders so there has to be a way of making them visible in explore and VS, here are Images showing what I mean, in the project I have the laneDetector filter which does not exist in project folder
Showing My VS project layout with LaneDetector filter/folder visible
Showing My VS project in explore with no LaneDetector filter/folder

c++ visual studio 2010 - How to create a project under a different folder name?

I would like to have a the following structure of folders:
Myproj\src
Myproj\include
Myproj\lib
Myproj\src should include all sources and project files etc.
EDIT: also, $(projectDir) should equal Myproj\src
The problem is with Myproj\src, when I create a new project in VS2010 a folder named \Myproj is created and in it all sources are placed. How can I break this connection and have my desired structure made?
A TFS friendly solution would be nice.
After you create a project, you can change the folders where certain files are stored. When you right-click the project in solution browser, there will be option for VC++ Directories - Include Directories.
If you add your $(ProjectDir)\src and $(ProjectDir)\include to this field, you will be able to put your files in these places. However, default VS creators, such as "Add Class" will still add your files to Project folder.
As for "lib" - I am guessing you are trying to create a library project. For that, you must find the "General->Output directory", and change it accordingly.