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:
-
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.
-
Copy the template configuration file
codeinsight_scan_settings.inifrom <LOCAL_APP_DATA>\Local\Microsoft\VisualStudioto 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. -
In a text editor, open the
codeinsight_scan_settings.inithat you copied to the solution folder, and provide the following values in theSettingssection:Property Description CodeInsight Server Provide 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.AuthenticationToken Provide 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 Project Provide 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 CreateNewProjecttoTrue(see the later table entry). If the specified project already exists on the Code Insight server, ensure thatCreateNewProjectandCreatePrivateProjectare set toFalse.ScanFolders Specify the absolute paths for the project output folders (or any additional folders) to scan for the solution, separating each path with a comma. CreateNewProject If the Code Insight project you specified for CodeInsightProjectalready exists, set this property toFalse. 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 toTrue. The project is the name specified forCodeInsightProject. The Project Owner is the user who generated the JWT provided forAuthenticationToken. Use theCreatePrivateProjectproperty to define the new project as public or private.CreatePrivateProject Determine 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 .) ScanAfterBuild Specify Trueto have the Code Insight scan execute automatically after the Build or Rebuild Solution step. SpecifyFalseto start each scan manually, as described in Executing a Scan.Alias A 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 aliasproperty 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. -
Save the file changes.