Configure on a Connected Azure DevOps Server using a YAML Pipeline

  • 3 minutes to read

Sign in to Azure Pipelines

  1. Click the Azure DevOps logo to open the Projects page.

    AzureLogo

  2. Select an existing project for your organization and click the Pipelines icon.

    PipelinesICon

Create a New Pipeline

  1. Choose New pipeline in the Pipelines page.

    BuildPipelines

  2. Select the location of your source code in the Connect wizard page.

    SelectRepository

  3. Select a repository.

    Template

  4. Choose a template.

    Configure

  5. Add the CodeRush Server task after the Build solution (VSBuild@1) task in the azure-pipelines.yml file. Use the following YAML:

- task: CRServerTask@201
  inputs:
    solution: '**/*.sln'   

The result is shown below:

Configure

  1. Click Save and run to commit a new azure-pipelines.yml file to your repository and run the build.

    Review

  2. Click Save and run to confirm this commit.

    Commit

NOTE

You can use a self-hosted build agent. The CodeRush Server task requires you install the Visual Studio Build Tools and .NET Framework 4.7.2 on a build agent. When installing Visual Studio Build Tools, make sure you select the ".NET Core build tools" item in a list of toolsets to be installed. The Code Coverage feature requires installation of Microsoft Visual C++ 2015 Redistributable.

Configure the CodeRush Server Task

Locate the CRServerTask task in the azure-pipelines.yml file and click the Settings link to access the task settings.

Edit

You can specify the following options:

Solution or Project Option

This option allows you to specify a relative path to the repository root of the project or solution to run. Wildcards can be used but the result must point to a single file.

LeaveDebug

Configuration Option

Leave the configuration set to "Debug" (or set it to another configuration that can be used to run unit tests).

LeaveDebug

Send Logs Option

Enable the "Help DevExpress improve this product by sharing usage data anonymously" option if you want CodeRush Server to collect logs. This helps us improve this product. No personal information is collected (see Privacy Policy).

HelpImprove

Exclude Tests in Categories Option

Set the Exclude tests in categories option to "TODO | Exclude". This option allows you to ignore tests by category. Excluded tests are marked as ignored on the Tests view page.

ExcludeTests

Exclude Projects and Assemblies from Analysis

Use the RunSettings file location option to specify a relative path to a .runsettings file. Wildcards may be used. CodeRush Server excludes projects and functions from code coverage analysis if you add them to the corresponding Exclude section of the .runsettings file.

Use the Assemblies excluded from analysis option to specify relative paths to assemblies, or assembly names, which you want to exclude from testing and analysis. Wildcards may be used.

ExcludeTests

Click Add to add the CodeRush Server task changes to the yaml file.

ExcludeTests

Another way to customize the CodeRush Server task in the azure-pipelines.yml file is to replace the existing CRServerTask with the following:

- task: CRServerTask@201
  inputs:
    solution: '**/*.sln'
    sendLogs: true
    excludeCategories: 'TODO | Exclude'
    runsettings: 'Project.runsettings'
    excludeprojects: |
      **/*Tests.Functional.dll
      **/*Validation.DataAnnotations.dll

Build Configuration Option

Assign the "Debug" value to the buildConfiguration option in the azure-pipelines.yml file.

Build

Save and Run

  1. Click Save to confirm the commit.

    Confirm

  2. Run the pipeline.

    Confirm

  3. Track the build until it is completed.

    Watch

View Analysis Results

Click CodeRush to view analysis results on Dashboard, Tests, Coverage, and Diagnostics views after the solution is built.

Dashboard