When building, particularly for release versions, VS can add a lot of characters to paths with its output files and if you end up with a path over 260 characters you can get build errors caused by the path being too long (file inaccessible etc errors).
A solution is to enable long file path support in windows.
On Windows 10/11
Use regedit to alter the following registry key:
(Type: REG_DWORD) must exist and be set to 1. You will likely need to reboot for the new setting to take effect.