Solution to VS Codespaces The workspace can not be opened in a container

I’m working on setting up Codespaces for my project and tried to open my workspace and got this error:

The workspace can not be opened in a container. Folder {folder} is not a subfolder of shared root folder {folder}.

"Error message"

It’s a little cryptic, but what the message means is that you have folder(s) in your workspace that are not in sub-folders from the location of your code-workspace file.

The documentation for this limitation is here: https://code.visualstudio.com/docs/remote/containers#_open-an-existing-workspace-in-a-container

You can also follow a similar process to open a VS Code multi-root workspace in a single container if the workspace only references relative paths to sub-folders of the folder the .code-workspace file is in (or the folder itself).

My workspace file is here: /src/net/memealyzer.code-workspace and my workspace includes folders that aren’t sub-folders of that path, like /iac/bicep, and pac/tye.

So, in order to open the workspace in a Codespace, I had to move the code-workspace file to the root of the project.