How to setup library's path of imported projects? (ESP IDF)

I’m quite a noob when it comes to all the low level stuff in programming and things that have to do with program compilation of the IDE and flashing and what ever else and most of the times I open a project in a new visual code window it won’t compile because all of a sudden the IDE can’t find the included libraries…

My question is what is the most common and bullet proof way to specify IDF libraries and dependencies for a project?

Also how do you even choose a target device from COM if two microcontroller devices are connected without constantly editing the platformio.ini file?

You should best use the platformio.ini and use lib_deps = I think the easist way is to just specify libs available for your platform that can be found in the docs. They will be auto-downloaded when you run the build command.

That should be easy as platformio allows you to use several [env:xxx] configs at the same time. Let’s take an example: I’m using a gtest environment for my unittests. image
When I want them to build and to execute I have to tell platformio that I want this environment and this build filtered so that it knows what to do. It uses a different compiler and no board = at all.
I call it by writing pio test -e desktop -f desktop in the pio terminal to have only this variant built and run.
So, read the docs to setup your special environment and have fun ^^