SETVARS_CONFIG Environment Variable States
The SETVARS_CONFIG environment variable enables automatic configuration of the oneAPI development environment when you start your instance of Microsoft Visual Studio. The variable has three conditions or states:
Undefined (the SETVARS_CONFIG environment variable does not exist)
Defined but empty (the value contains nothing or only whitespace)
Defined and points to a setvars.bat configuration file
If SETVARS_CONFIG is undefined there will be no attempt to automatically run setvars.bat when Visual Studio is started. This is the default case, since the SETVARS_CONFIG variable is not defined by the oneAPI installer.
If SETVARS_CONFIG is defined and has no value (or contains only whitespace), the setvars.bat script will be automatically run when Visual Studio is started. In this case, the setvars.bat script initializes the environment for all oneAPI tools that are installed on your system. For more information about running the setvars.bat script, see Build and Run a Sample Project Using the Visual Studio* Command Line.
When SETVARS_CONFIG is defined with the absolute pathname to a setvars configuration file, the setvars.bat script will be automatically run when Visual Studio is started. In this case, the setvars.bat script initializes the environment for only those oneAPI tools that are defined in the setvars configuration file. For more information about how to create a setvars config file, see Using a Config File with setvars.bat.
A setvars configuration file can have any name and can be saved to any location on your hard disk, as long as that location and the file are accessible and readable by Visual Studio. (A plug-in that was added to Visual Studio when you installed the oneAPI tools on your Windows system performs the SETVARS_CONFIG actions; that is why Visual Studio must have access to the location and contents of the setvars configuration file.)
If you leave the setvars config file empty, the setvars.bat script will initialize your environment for all oneAPI tools that are installed on your system. This is equivalent to defining the SETVARS_CONFIG variable with an empty string. See Using a Config File with setvars.bat for details regarding what to put inside of your setvars config file.
Define the SETVARS_CONFIG Environment Variable
Since the SETVARS_CONFIG environment variable is not automatically defined during installation, you must add it to your environment before starting Visual Studio (per the rules above). You can define the SETVARS_CONFIG environment variable using the Windows SETX command or in the Windows GUI tool by typing “rundll32.exe sysdm.cpl,EditEnvironmentVariables” into the “Win+R” dialog (use “Win+R” to bring up the dialog).