Vb.net Solution Explorer


I'm trying to clean my solution explorer by placing forms in their own folders, reports, classes and so on. I'm worried that doing this though will create problems in my application because now the forms will be in different folders. I think once I did this and a couple days later my whole app was confused where the forms went.

Is there a correct way to do this, do I need to clean-up or rebuild the app or something after I placed all the forms in their respective folders?

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
As long as you do the job in the Solution Explorer itself and not in Windows/File Explorer, this is OK because Visual Studio understands what you do when you reorganize the files and folders through it.

You can create folders in Solution Explorer with a right click. You then drag the files to the folders where you want them.

The same approach also works if you want to remove or rename files. Doing it in the Solution Explorer is OK, but doing it from outside of Visual Studio can lead to warnings.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
*No Points*

Bear in mind that the display in Visual Studio Solution Explorer is *strictly* for your benefit.  So as James has stated, use the Visual Studio Solution Explorer to make these changes.

To add onto what James stated, as long as you do not also change the namespaces on these files, then there will not be a problem.

FCapoAuthor Commented:

After putting all my reports in one folder, I get the following error when trying to open up a form that has a report :

Unable to find the report in the manifest ressources. please rebuild the project and try again
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Jacques Bourgeois (James Burger)PresidentCommented:
Visual Studio "follows" the items that it uses itself during compilation, but it cannot handle  stuff that you define implicitly in your code or that are added by third party components.

Report generators are not part of Visual Studio. They are add-ins that incorporate themselves into VS. As many third party tools, many of them do not integrate themselves completely. Some will insist on a direct or relative path in order to find the report, without following the changes that are made to the solution.

For these, you might have to change the location in your code or in the designer that you used to create the report. Or bring them back in the original location.

What type of reports are you using?
FCapoAuthor Commented:

I'm using crystal reports;

It's just very messy to leave all these reports in the root folder, I was hoping to do a little cleaning up
Jacques Bourgeois (James Burger)PresidentCommented:
Click on one of your report files and give a look at the Build Action in the properties Window.

If the property is set to Embedded Resource or Content, you can usually move the files around without any problem in the Solution Explorer. I have stopped using Crystal eons ago, but last time I checked, around 2008, these mechanisms were the ones that were suggested, depending on whether you wanted the user to be able to edit the report or not.

But there is also another way of working with external files, and this one does not follow the files when you move them around. If the Build Action is set to None, then the files might be incorporated into the build through that other mechanism.

Before doing the following, make a copy of your project. If somebody manually changed the name of the resources (by default it is matched with the file names), this could cause problems in the application later.

Open the Project's Properties window and go to the Resources tab. Look for your report files in there, probably under Files in the ComboBox at the upper left corner of the window. If so, move your files in your new directory. They will then be flagged with an error icon in the Resources window because it lost its trace. Remove all those from the window (you can Ctrl-Click or Shift-Click to select them all). Grab the files in the new directory and drag them to the Resource window. They will be referenced with the new path and your application should build.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.