Visual Studio 2022 Issue

When I try to create a new project, Visual Studio is picking up a totally unrelated source directory.

1. Create New Project
2. Select empty console project
3. Enter the new project name "NEWPROJ"
4. Create.
5. NEWPROJ Shows up in the Solution Explorer.
6. I move some files into the NEWPROJ directory.
7. I select Add Existing Files
8. I get an Open File dialog with all the files in OLDPROJ
What is going on? How do I fix this?
I would expect the Open File dialog to show me the contents of the NEWPROJ directory with the files I just moved there.
Last edited on
A couple of versions ago VS 2022 changed the behavior of how it added existing files to a project.

It sucks, but that's MS for ya.

So now I add new (empty) source files to the project with the names of the files I had already coded up. Once those empty files exist in the project's source dir I copy/move the "old" source files, and VS suddenly recognizes I already wrote the frikkin' code.
And no, I haven't found any where in the IDE tools or options to return the behavior of searching for files back to what was standard behavior a couple of revisions ago. I have searched and searched and searched and searched. Within the IDE and on the 'interwebs. All to no avail.
@George P: Thanks for the reply, but that's not quite the problem I'm having.
My problem is that I never mention the OLDPROJ folder, but when I try to add a file, it tries to do it from that folder. Not the one I created for the project (NEWPROJ).
You never defined OLDPROJ in your OP. Are we talking a project in the same solution or different solution?

FWIW: I'm using VS 2019.

1. I created a new solution, ExSol, with an initial console project, Project1.
2. Within ExSol, I create another console project, Project2.
3. I right-clicked Project2 in Solution Explorer > Add > Existing Item and selected Test.cpp and Test.h that I created and moved into ExProj\Project2 directory. After highlighting both files and clicking "Add" in the "Add Existing Item" window, Test.h was moved into ExProj\Project2\Header Files and Test.cpp was moved into ExProj\Project2\Source Files.

Did you get the "Add Existing Files" option by right-clicking on a project?
@ElusiveTau: OLDPROJ was NOT a member of the solution.
Yes, I got the Add Existing Files option by right clicking on my new project and selecting Add Existing File after moving the files into the empty NEWPROJ folder.
Topic archived. No new replies allowed.