Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project which was started coding in Visual Basic 2017 and now in 2019. There are 3 classes that I wrote into the project in 2017 that I no longer use. When I went to remove them they don't show up in the My Project list instead they are in a different directory than the main project is in ( the directory name is 'My Projects'). I do not refer to these classes in the program but the compiler still looks for them and throws an error saying it cant find them. I tried moving them to the same directory as the main program is in but that created more problems. Now, I have noticed as I add a new class or method it puts it in the 'My Projects' directory and it does not show up in the solution list. Questions, 1, why are this new class code being put into a different directory, and 2, how do I remove the old ones entirely from my solution. They are not on the Projects list so I can't do the normal delete as I have done in the past.There is also one .vb file the compiler is looking for that doesn't appear to be anywhere. I've run a full search on all of my drives and can not find it. The directory tree for the solution is:

C:\Visual Basic 2017\MyMovies-2019\MyMovies-2019

directory for the files I have a problem with is:

C:\Visual Basic 2017\MyMovies-2019\MyMovies-2019\My Projects

I have no idea how they ended up there when all other .vb files are in the main MyMovies-2019 directory.

What I have tried:

Tried to delete them through the 'My Projects' list but they don't show up there. Tried deleting from the 'My Projects' directory and get compiler errors. Now I have the .vb file that I can't find so I can recover it.
Posted
Updated 4-May-19 11:13am

It sounds as though your actual files and your project settings have become out of step. The simplest thing to do would be to create a new project and just copy over the sources that you need.
 
Share this answer
 
Comments
Member 10376725 4-May-19 11:39am    
That thought had entered my mind, but was hoping I'd find an easier way. You're probably right though. May have to bite the bullet.
Richard MacCutchan 4-May-19 11:59am    
It is possible to fix this by moving/deleting sources and editing the project files, but best avoided unless you understand their structure clearly.
Member 10376725 4-May-19 12:08pm    
No, I think I'll just rebuild it. That will allow me to clean up some other things and will probably be the safest course of action. Thanks Richard.
Maciej Los 4-May-19 17:14pm    
There's simplest way. Check my answer.
Please, follow the instruction from MSDN: Remove or Delete an Item or Project - SQL Server | Microsoft Docs[^]

Quote:
To remove a project item:

  1. In Solution Explorer, select the project item you want to remove.
  2. On the Edit menu, click Remove.
  3. On the confirmation dialog, click Remove to remove the item from the project.

A removed item still exists on the file system. Therefore, you can add a removed item to its original solution or to another solution.


[EDIT]
IF you can not locate file and you're able to see it in the left pane, go to:
Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer


If above is inaccessible, follow the instruction from: Visual Studio Tip #8: Adding existing files with Show All Files – The Brain Dump[^]
Then you'll be able to remove that files from solution explorer.

Finally, you can always show all files: Solution Explorer doesnt show the folder although the folder is present in my local drive (local copy) Visual studio - Stack Overflow[^]

Good luck!
 
Share this answer
 
v4
Comments
Member 10376725 4-May-19 17:47pm    
As I stated in my original inquiry these files do not show up in the Solution Explorer so can not be removed that way. They are in a sub directory called 'My Project' (not to be confused with the 'My Projects' under the Solution Explorer). I used 'Add' to add a new class, and when it was completed, doesn't show up in the Solution Explorer but is in the 'My Project' sub directory.
Maciej Los 4-May-19 18:15pm    
Check updated answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900