I had the same issue, working with VS Studio in Windows 11. Resolving this issue took me quite a few steps.
First I concluded that 'anchor build' wasn't working on a Windows environment so you have to use WSL (windows system for Linux).
I read the following: "But "anchor test" still doesn't work, because the Solana-test-validator can't run on Windows, and seems that Solana's dev team doesn't resolve this problem. Solana 4608 So I think you should use a Linux system or other VM (VirtualBox) to develop". I have not verified this information but you can check this thread: https://github.com/coral-xyz/anchor/issues/1992
You can setup Visual Code Studio with WSL with the help of this page: https://code.visualstudio.com/docs/remote/wsl#_developing-in-wsl
but prior to that, you need to enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. If this feature is not enabled, you cannot use WSL. I'm mentioning this because it took me a lot of time to figure out why UBUNTU wasn't working.
To enable this feature, or check whether it's enabled or not, go to: https://pureinfotech.com/enable-hyper-v-windows-11/ or go to: https://www.simplilearn.com/enable-virtualization-windows-10-article and navigate to the explanation of your windows verions. I had to enable this feature in my BIOS settings under -> configuration -> virtualization technology.
Hope this helps anyone stumbling on this page using Windows.
:)