主要内容

Install Polyspace as You Code

Polyspace® as You Code™ checks your code for bugs and coding standard violations while you work in a code editor or in these supported IDEs:

  • Visual Studio® 2019 (versions 16.11.0 and later) and 2022 (versions 17.2.0 and later).

  • Visual Studio Code (versions 1.62 to 1.105.0).1, 2

  • Eclipse™ (versions 2019-09 to 2025-03). For Eclipse-based IDEs support, see Polyspace as You Code Support on Eclipse-Based IDEs.

The installation of Polyspace as You Code consists of two separate installations: an analysis engine and the IDE extension. First, install the Polyspace analysis engine by using the MathWorks® installer or the mpm command at your system command line. Then, install the Polyspace as You Code IDE extension in your preferred IDE.

Note

Before you install the Polyspace as You Code extension, uninstall any previous version of the extension.

Install Polyspace as You Code Analysis Engine Using Installer

Install the Polyspace as You Code engine by using the MathWorks installer. Download the installer from https://www.mathworks.com/downloads/.

Installation

Run the MathWorks installer. Choose a license for Polyspace as You Code. For additional details on licenses, see Installation and Licensing.

Installation Folder

A default installation folder is used based on your operating system and the release version. During installation, you can change this default folder if needed. When installing on Windows®, the installer adds an environment variable for installation folder.

These are the default installation folders for release R2026a:

Operating SystemDefault Installation Folder
WindowsC:\Program Files\Polyspace\R2026a
Linux® (most distributions)/usr/local/Polyspace/R2026a
Mac/Applications/Polyspace/R2026a

Install Polyspace as You Code Analysis Engine from Command Line

Use MATLAB® Package Manager (mpm) to install the Polyspace as You Code analysis engine from the operating system command line.

Prerequisites

Before beginning installation using mpm:

  • Confirm that your computer has internet access. This example uses mpm to download the product files from mathworks.com. If you have already completed a download of products using the interactive installer or have a mounted product ISO image, you can use the --source argument to select the installation source instead.

  • Download MATLAB Package Manager. Always download the latest version of mpm before installing products. To get the latest version of mpm for your platform, see Get MATLAB Package Manager.

Installation

Run the mpm install command to install the Polyspace as You Code analysis engine.

To run the mpm install command and install the R2026a Polyspace as You Code analysis engine on Linux, run this command.:

.\mpm install --release=R2026a --destination=C:\Program Files\Polyspace \
--products Polyspace_as_You_Code

To complete the installation, copy your Polyspace as You Code license file to the licenses folder located in the Polyspace as You Code installation folder. For instance /usr/local/Polyspace/R2026a/licenses. Obtain the path to the license file from your Polyspace administrator.

The license file is typically named network.lic and contains the following lines:

SERVER MyServerName.example.com <optional-mac-address> 27000
USE_SERVER
where MyServerName.example.com is the hostname of the machine where you install the license manager.

Confirm Polyspace Engine Installation

Confirm your installation was successful by running the polyspace-as-you-code command to perform a Polyspace analysis. Navigate to polyspaceroot/polyspace/bin, where polyspaceroot is your installation folder, and run this command:

.\polyspace-as-you-code -sources "file.c" -results-dir \tmp\BF_result

In this command, file.c is the full or relative path to any C or C++ file. Polyspace as You Code can only analyze a single file at a time.

IDE Extension Installation

After installing the Polyspace as You Code analysis engine, install the extension in your IDE. The installation steps vary depending on which IDE you use. For instructions, see the installation page for your IDE:

Before you start using Polyspace as You Code, you must complete the configuration of your IDE extensions. See Configure Extension Settings.

See Also

Topics


1 It is likely that you can use Polyspace as You Code with later versions, however, issues can arise that prevent normal operation.

2 If your version of Visual Studio Code uses the Workspace Trust feature, the Polyspace as You Code extension is disabled when you open a folder in Restricted Mode. To enable the extension, mark the folder as trusted. See Workspace Trust.