Problems with project loading, missing build configs and build errors in VS Code (nRF Connect SDK)

Hi,
I'm using nRF Connect SDK (v2.1.2) with VS Code on Windows for a project targeting nRF52811.

Even though everything is versioned in Git, I keep running into the following problems randomly when I reopen the project:

1) Sometimes the project doesn't load at all

The nRF Connect view in VS Code shows no project under "Applications", even though the folder is open and CMakeLists.txt is present.

2) Build configuration is missing

When the project loads, there is often no build configuration present, and I have to create a new one every time.
Isn't this supposed to be saved somewhere?
Where is the build configuration stored, and why does it not reload automatically?

3) Build error with west

Sometimes when I try to build, I get this error:

ERROR: it looks like . is a build directory: did you mean --build-dir . instead?
FATAL ERROR: refusing to proceed without --force due to above error

I don't understand where this comes from. The project structure doesn't change.

This is extremely frustrating and wastes a lot of time. I don’t know what causes it — sometimes everything works, and other times it breaks just by reopening the same project.

Can someone explain what could cause these problems and how to avoid them?

Thanks!


Related