Skip to main content

Configuring access to the CodeQL CLI

The CodeQL for Visual Studio Code extension uses the CodeQL CLI to compile and run queries.

Configuring access to the CodeQL CLI

If you already have the CodeQL CLI installed and added to your PATH, the extension will use that version. This might be the case if you create your own CodeQL databases instead of downloading them from GitHub.com. For more information, see "Preparing your code for CodeQL analysis."

Otherwise, the extension automatically manages access to the executable of the CodeQL CLI for you. This ensures that the CodeQL CLI is compatible with the CodeQL extension. You can also check for updates with the CodeQL: Check for CLI Updates command from the VS Code Command Palette.

Notes:

  • The extension-managed CodeQL CLI is not accessible from the terminal. If you intend to use the CLI outside of the extension (for example to create databases), we recommend that you install your own copy of the CodeQL CLI."

  • To override the default behavior and use a specific version of the CodeQL CLI, you can specify the CodeQL CLI Executable Path in the extension settings. For more information, see "Customizing settings."

Troubleshooting

If you have any difficulty setting up access to the CodeQL CLI, check the CodeQL Extension log for error messages or to see the location of the CodeQL CLI being used. For more information, see "Accessing logs." In particular, in the Extension log you can see the location of the CodeQL CLI that is being used. This is useful if you want to see whether this is an extension-managed CLI or an external one.

If you use the extension-managed CodeQL CLI, the extension checks for updates automatically (or with the CodeQL: Check for CLI Updates command) and prompts you to accept the updated version. If you use an external CLI, you need to update it manually (when updates are necessary).