Skip to main content

Configuration Using MSBuild

The following steps describe how to use MSBuild to configure the Visual Studio plugin once it is installed.

To use the Visual Studio IDE interface to configure the Visual Studio plugin, do the following:

  1. Launch Visual Studio IDE in Run As Administrator mode to enable the Visual Studio plugin for MSBuild and create a project/solution. You need to perform this step only once.

  2. Copy the template configuration file codeinsight_scan_settings.ini from <LOCAL_APP_DATA&gt;\Local\Microsoft\VisualStudio to the Visual Studio solution folder you want to scan. The following is an example solution folder to which to copy the file: C:\Users\jsmith\Documents\Visual Studio 2015\Projects\MyProject.

  3. In a text editor, open the codeinsight_scan_settings.ini that you copied to the solution folder, and provide the following values in the Settings section:

    PropertyDescription
    CodeInsight ServerProvide the URL for the Code Insight core server in the format http://<SERVERHOSTNAME>:<PORT>/codeinsight/ (for example, http://codeInsightServer\.myorg\.org:8888/codeinsight/ ). Ensure that the URL is publicly accessible and that the port is available.
    AuthenticationTokenProvide the JSON Web Token (JWT) used to authorize user access to the Code Insight functionality. You generate this token using the Code Insight Web UI and then copy and paste it in this field. For more information, see Providing an Authorization Token.
    CodeInsight ProjectProvide the name of the Code Insight project that already exists or that you want this configuration process to create for you on the Code Insight server to store scan results. If you want the configuration process to create the Code Insight project you specified here, also set CreateNewProject to True (see the later table entry). If the specified project already exists on the Code Insight server, ensure that CreateNewProject and CreatePrivateProject are set to False .
    ScanFoldersSpecify the absolute paths for the project output folders (or any additional folders) to scan for the solution, separating each path with a comma.
    CreateNewProjectIf the Code Insight project you specified for CodeInsightProject already exists, set this property to False . However, if you want the plugin-configuration process to create a new project in which store scan results on the Code Insight server, set this property to True . The project is the name specified for CodeInsightProject . The Project Owner is the user who generated the JWT provided for AuthenticationToken . Use the CreatePrivateProject property to define the new project as public or private.
    CreatePrivateProjectDetermine whether the new project is to be created as public or private: If you want this new project to be public—that is, viewable by all Code Insight users, set this property to False. If you want this project to private to private—that is, viewable and managed by the Project Owner and select users, set this property to True. (The Project Owner is the user who generated the JWT provided for AuthenticationToken .)
    ScanAfterBuildSpecify True to have the Code Insight scan execute automatically after the Build or Rebuild Solution step. Specify False to start each scan manually, as described in Executing a Scan.
    AliasA name that you define for the scan-agent plugin. The alias is used to represent the “container” (scan root) under which all the files scanned in this instance will be listed in the API output and in the file tree in the Analysis Workbench . This name must be unique within the project.
    Host(Optional) A user-defined name for the instance where the scan-agent plugin is configured to run scans. This property along with the alias property will remain unchanged for each subsequent rescan. Although optional in general, this value is required if you are running the scan in a dynamic host environment. See Note About Rescans Performed by v2.0 and Later Plugins.
  4. Save the file changes.