Configure on a Connected Azure DevOps Server using a YAML Pipeline
- 3 minutes to read
Sign in to Azure Pipelines
Click the Azure DevOps logo to open the Projects page.
Select an existing project for your organization and click the Pipelines icon.
Create a New Pipeline
Choose New pipeline in the Pipelines page.
Select the location of your source code in the Connect wizard page.
Select a repository.
Choose a template.
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:
Click Save and run to commit a new azure-pipelines.yml file to your repository and run the build.
Click Save and run to confirm this commit.
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.
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.
Leave the configuration set to "Debug" (or set it to another configuration that can be used to run unit tests).
Send Logs Option
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.
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.
Click Add to add the CodeRush Server task changes to the yaml file.
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.
Save and Run
Click Save to confirm the commit.
Run the pipeline.
Track the build until it is completed.
View Analysis Results