azure-devopsenvironment-variablesdotnet-test

Azure Devops - How to pass environment variables into dotnet test?


I have a standard .NET Core (Ubuntu) pipeline on Azure Devops and within my Test project, I use environment variables. Within my pipeline, I have defined my group variables like so

variables:
- group: MyApiVariables

Whenever I run the tests for my project

- task: DotNetCoreCLI@2
  displayName: "Testing Application"
  inputs:
    command: test
    projects: '**/*Tests/*.csproj'
    arguments: '--configuration $(buildConfiguration)'

The actual environment variables aren't passed in. They are blank.

What am I missing to get this running? I've even defined variables in the edit pipeline page too with no luck

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: echo $AppConfigEndpoint
  env:
    AppConfigEndpoint: $(AppConfigEndpoint)
    ApiConfigSection: $(ApiConfigSection)

Thanks!


Solution

  • CASING Strikes again! MyVariableName was turned into MYVARIABLENAME on Azure Devops. I changed my variable names in my group to all caps and it worked. I spent way too much time on this.