Unable to Run OpenVINO™ Sample in Visual Studio* (VS2019 / VS2022)
Content Type: Troubleshooting | Article ID: 000058525 | Last Reviewed: 03/05/2026
The OpenVINO™ environment variables must be set before running an OpenVINO™ application.
Run setupvars.bat (Classic OpenVINO installations) or setvars.bat (OneAPI-based installations) in the terminal or environment in which the program will run.
Follow the OpenVINO™ installation guide to ensure the toolkit is installed correctly.
There are two options to implement this with VS2019:
Option 1:
VS Developer Powershell*
Option 2:
Automate OpenVINO™ Setup and Visual Studio Initialization.
Create a batch file that initializes the OpenVINO™ environment and opens Visual Studio.
Write the script below in a .bat file:
(For oneAPI installations, replace setupvars.bat with setvars.bat)
Steps: