Main Content

Visual Studio: Install Polyspace as You Code Extension

The Polyspace® as You Code™ extension in the Visual Studio® IDE allows you to run Polyspace on the file that you are currently viewing and checks your code for bugs and coding standard violations. You must install the Polyspace as You Code analysis engine to run the analysis. The extension allows you to point to this analysis engine from Visual Studio and show results produced by the Polyspace analysis.

You can install the extension in one of two ways:

  • If you install the analysis engine by using the MathWorks® installer, install the extension by using the Visual Studio extension installer (VSIX) file. The VSIX file is available only after you run the installer.

  • Install the extension from the Visual Studio Marketplace. You can update your extension from within Visual Studio as long as your Polyspace license is for R2024b or more recent. Installing the extension from the marketplace does not install the analysis engine, which needs to be installed separately using the Polyspace installer.

You can install the extension in Visual Studio 2019 version 16.11.0 and later and in Visual Studio 2022 version 17.2.0 and later.

Note

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

Interactive Installation

To install the extension interactively:

  1. Double-click the .vsix file in the folder polyspaceroot\polyspace\plugin\visual_studio.

    Here, polyspaceroot is the Polyspace as You Code installation folder, for example, C:\Program Files\Polyspace\R2026a.

  2. Follow the prompts on the screen.

    If you see a message indicating that your Visual Studio installation does not satisfy the prerequisites for the extension and you are using Visual Studio 2019, install the latest updates and try reinstalling the extension.

Command-Line Installation

To install the extension without opening a graphical user interface, run the VSIX installer at the command line with the /q flag.

  • To install the extension in all versions of Visual Studio on the machine, enter:

    cd VSIXInstallerpath
    VSIXInstaller.exe /q polyspaceroot\polyspace\plugin\visual_studio\polyspace_as_you_code.vsix
    Here, VSIXInstallerpath is the path to the VSIX installer file. For example, in a Visual Studio 2022 installation, the path can be C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE.

  • To install the extension on a specific Visual Studio version, enter:

    cd VSIXInstallerpath
    VSIXInstaller.exe /q /s:name /v:version ^ 
    polyspaceroot\polyspace\plugin\visual_studio\polyspace_as_you_code.vsix
    Here, name is the name of the Visual Studio application, for example, Pro for the Visual Studio Professional edition. version is the version number in the form major.minor.patch, for example, 17.6.6 for the major version of Visual Studio 2022.

To uninstall the extension silently, use the /u flag. Use of the /u flag requires a vsixID value. To find the vsixID value of your VSIX file:

  1. Make a copy of the VSIX file and rename it as a ZIP file with a .zip extension.

  2. Open the ZIP file and locate the extension.vsixmanifest XML file.

  3. Open the extension.vsixmanifest XML file. Your vsixID value is the identifier guid in the <Identity Id="guid" /> tag.

An example of the /u flag containing a vsixID is:

VSIXInstaller.exe /u:Polyspace.1234a5bc-d678-9e01-f234-5gh6789ijklm

For more information on /q and /u flags, enter:

cd VSIXInstallerpath
VSIXInstaller.exe

Confirm Installation of Extension

To confirm that your Visual Studio installation has the Polyspace as You Code extension, check the list of installed extensions. From within Visual Studio, select Extensions > Manage Extensions and confirm Polyspace as You Code appears in the Installed pane.

You can also confirm that the extension starts as expected in the Output view. In the Output view, select Polyspace as You Code from the Show output from list. If the extension starts without errors, you see a message similar to this one:

[Information] No setting set for the port. Trying to find a free port.
[Information] Connector was successfully started on port 51294

The Polyspace Connector is an internal server that handles communication between the Polyspace as You Code analysis engine and the Visual Studio extension. If the default port is not available, the extension increments the port number by 1 and attempts to start the Polyspace Connector on this port. If you use multiple Visual Studio instances, you can run Polyspace as You Code on all the instances. The Polyspace Connector uses a different port for each instance.

See Also

Topics