# Detect CI builds for every CI system

In order to unify the environment variable to detect whether a build is a CI build as simply `CI` (as is done already in [GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables), [Circle CI](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) and [GitLab](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)), you just place this bit of MSBuild in every project's `Directory.Build.props` to make things consistent everywhere:

```markup
<PropertyGroup Label="CI" Condition="'$(CI)' == ''">
  <CI>false</CI>
  <!-- GH, CircleCI, GitLab and BitBucket already use CI -->
  <CI Condition="'$(TF_BUILD)' == 'true' or 
                 '$(TEAMCITY_VERSION)' != '' or 
                 '$(APPVEYOR)' != '' or 
                 '$(BuildRunner)' == 'MyGet' or 
                 '$(JENKINS_URL)' != '' or 
                 '$(TRAVIS)' == 'true' or 
                 '$(BUDDY)' == 'true' or
                 '$(CODEBUILD_CI)' == 'true'">true</CI>
</PropertyGroup>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.cazzulino.com/msbuild/detect-ci-builds-for-every-ci-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
