Hello, Welcome to Microsoft Q&A,
In Release compilation mode, the HoloLens device and PC must remain connected during both the building and deploying of the UWP project on VS. In Debug or Master compilation mode, the UWP can be built first without a connection to the HoloLens.
Please check if the build is successful in Debug or Master compilation mode. If it is, the error might be due to an invalid connection between the HoloLens and the PC. You can refer to the Using Visual Studio to deploy and debug - Mixed Reality | Microsoft Learn to ensure the connection is valid and that your PC is paired with the HoloLens on VS via a PIN code.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.