Skip to main content

DevExpress NuGet Packages and Popular Continuous Integration Systems

  • 8 minutes to read

Important

This help topic lists basic setup steps for a few popular Continuous Integration Systems (CIS): GitLab, GitHub, Azure DevOps, and others. Additional configuration may be necessary. For in-depth configuration information, consult documentation for the CIS you use.

This topic describes how to integrate an application with DevExpress controls into GitHub Actions, GitLab, Azure DevOps, JFrog Artifactory, and Nexus OSS continuous integration (CI/CD) systems.

#Notes on Licensing

To license DevExpress components in CI/CD environments, map your license key to an environment variable named DevExpress_License. (Examples below demonstrate how you can do this.) This variable must be available during the build task. This is the stage when license information is injected into produced artifacts.

You can set license key scope to a pipeline or the entire project. Note that license information is sensitive and should be stored as a secret. You may want to store the key in a storage with additional security and access control capabilities (such as Azure Key Vault or AWS Secret Manager).

For information on how to obtain your License Key, review the following help topic: License Key for DevExpress .NET Products.

#GitHub Actions

Create a secret with your DevExpress NuGet credentials for CI/CD operations. You must be the repository owner to create secrets for an environment in a personal account.

  1. Navigate to the main page of the repository and click Settings. github settings
  2. In the Security section of the sidebar, select Secrets and variables | Actions.
  3. Click New repository secret in the Secrets tab.
  4. Set your personal NuGet API key as the secret value.

    github new secret

  5. Repeat the same steps to add another secrect with your personal license key.

    github new secret

  6. Use secret values in your GitHub Actions CLI scripts (YAML). Assign the license key to the environment variable named DevExpress_License. Use the NuGet API Key when you register the package source. Note that GitHub Actions can only read a secret if you explicitly include the secret in a workflow. Enclose the secret’s name within the quoting rules when you pass a secret in the command line. This is required to avoid special characters that may affect your shell.

jobs:
  build:
    # ...
    env:
      DevExpress_License: ${{ secrets.DEVEXPRESS_LICENSE }}
    # ...
    steps:
      - name: Register DevExpress Source
        run: dotnet nuget add source https://nuget.devexpress.com/api/v3/index.json -p ${{ secrets.DEVEXPRESS_FEED_AUTH_KEY }} -u DevExpress -n devexpress-nuget

Refer to the following article for more information on how to use secrets in the GitHub workflow: Using secrets in a workflow.

Sample YAML file
name: .NET Core Desktop

on:
 push:
   branches: [ "main" ]
 pull_request:
   branches: [ "main" ]

jobs:

 build:

   strategy:
     matrix:
       configuration: [Debug]

   runs-on: windows-latest  

   env:
     DevExpress_License: ${{ secrets.DEVEXPRESS_LICENSE }}
     Solution_Name: your-solution-name                         
     Test_Project_Path: your-test-project-path                 
     Wap_Project_Directory: your-wap-project-directory-name    
     Wap_Project_Path: your-wap-project-path                   

   steps:
   - name: Checkout
     uses: actions/checkout@v4
     with:
       fetch-depth: 0

   # Add DevExpress license file
   #- name: AddDevExpressLicense
   #  shell: cmd
   #  run: |
   #    set "SRC=%GITHUB_WORKSPACE%\DevExpress_License.txt"
   #    set "DEST=%APPDATA%\DevExpress"
   #    if not exist "%DEST%" mkdir "%DEST%"
   #    copy "%SRC%" "%DEST%" /Y

   # Add DevExpress license file
   - name: AddDevExpressLicense
     shell: cmd
     run: |
       set "DEST=%APPDATA%\DevExpress"
       if not exist "%DEST%" mkdir "%DEST%"
       echo "${{ secrets.DEVEXPRESS_LICENSE }}" > %APPDATA%\DevExpress\DevExpress_License.txt

   # Install the .NET Core workload
   - name: Install .NET Core
     uses: actions/setup-dotnet@v4
     with:
       dotnet-version: 8.0.x

   # Add local NuGet source
   - name: Register DevExpress Source
       run: dotnet nuget add source https://nuget.devexpress.com/api/v3/index.json -p ${{ secrets.DEVEXPRESS_FEED_AUTH_KEY }} -u DevExpress -n devexpress-nuget      
       shell: cmd

   # Restore
   - name: Restore
     run: dotnet restore ./Sample

   # Build
   - name: Build
     run: dotnet build ./Sample

   # Run app to generate image
   - name: Run
     run: dotnet run --project ./Sample/DashboardCICDExport.csproj

   # Upload PNG artifact
   - name: Upload 
     uses: actions/upload-artifact@v4
     with:
       name: generated-image
       path: .\output.png

#GitLab

  1. Open your project CI/CD settings (Settings > CI/CD):

    GitLab - Open Project CI/CD Settings

  2. Add a new variable.

    • Click Expand.
    • Click Add variable.

      GitLab - Add Variable

  3. Specify variable parameters:

    Important

    • Select the Masked option.
    • Variables defined in this way are available globally for every pipeline and its jobs.

    GitLab - Specify Variable Parameters

  4. Add another variable to store your DevExpress License Key.

    GitLab - Add Variable with License Key

  5. In your script, specify an environment variable with your license key. Use your NuGet Feed API Key when you add a package source. The variable value will be masked in job logs during dotnet build or dotnet restore command execution.
variables:
  SOLUTION_NAME: "your-solution-name"     

# ...
restore:
  stage: restore
  script:
    - dotnet nuget add source "https://nuget.devexpress.com/$DEVEXPRESS_API/api/v3/index.json" --name DevExpress_Feed
    - dotnet restore "$SOLUTION_NAME.sln"
Sample YAML file
stages:
 - restore
 - build
 - run
 - upload

variables:
 SOLUTION_NAME: "your-solution-name"         
 PROJECT_PATH: "path-to-your-project"                  
 ARTIFACT_PATHS: "output/*"

default:
 image: mcr.microsoft.com/dotnet/sdk:8.0

restore:
 stage: restore
 script:
 # Assuming no NuGet.Config is present
   - dotnet nuget add source "https://nuget.devexpress.com/$DEVEXPRESS_API/api/v3/index.json" --name DevExpress_Feed
   - dotnet restore "$SOLUTION_NAME.sln"
 tags:
   - windows

build:
 stage: build
 script:
   - dotnet build "$PROJECT_PATH"
 tags:
   - windows

run:
 stage: run
 script:
   - dotnet run --project "$PROJECT_PATH"
 tags:
   - windows
 artifacts:
   paths:
     - $ARTIFACT_PATHS

upload:
 stage: upload
 artifacts:
   paths:
     - $ARTIFACT_PATHS
 tags:
   - windows

Note

If the dotnet build and restore are separated into separate lines/steps, run the restore first. Then run the build command with --no-restore flag.

#Azure DevOps

Azure DevOps does not support custom upstream NuGet sources. Use the NuGet.config file to configure the system.

  1. Obtain your NuGet feed credentials.
  2. Add the NuGet.config file next to the .sln file in your project.
  3. Add a package source with your DevExpress NuGet feed URL to the NuGet.config file.

The next steps depend on whether you use an authorization key or feed URL.

Note

Storing credentials in a NuGet.config file (especially when saving NuGet.config to your source control) is risky because it can lead to credential leakage. If you store credentials in NuGet.config, please consider using a more secure option as described in Consuming packages from authenticated feeds and How to Protect Your Private NuGet Feed and Safely Consume the Feed From External Systems.

#Feed Authorization Key

  1. Specify content of the Nuget.config file as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="DevExpress Feed" value="https://nuget.devexpress.com/api/v3/index.json" />
      </packageSources>
    </configuration>
    
  2. Add a new build pipeline.

  3. Add a new NuGet restore task to the pipeline and configure it to work with NuGet.config. You should specify the following settings:

    Settings Values
    Command restore
    Feeds to use Feeds in my NuGet.config
    Path to NuGet.config Path to your NuGet.config file
  4. Click the New/Add button to add feed credentials.

    Azure Task with Credentials

  5. Specify the connection settings as shown below and save them.

    Azure Connection Settings

#NuGet Feed URL

  1. Specify content of the Nuget.config file as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="DevExpress Nuget server" value="https://nuget.devexpress.com/{Your feed authorization key}/api/v3/index.json" />
      </packageSources>
    </configuration>
    
  2. Add a new build pipeline.

  3. Add a new NuGet restore task to the pipeline and configure it to work with NuGet.config. You should specify the following settings:

    Settings Values
    Command restore
    Feeds to use Feeds in my NuGet.config
    Path to NuGet.config Path to your NuGet.config file

#Specify Your License Key

Locate your pipeline and select Pipeline | Edit | Variables. Store your license key in the new variable and select the option Keep this value secret. For additional information on how to add variables, see Set Secret Variables.

Azure DevOps - Add License Variable

When you write a script, map this pipeline variable to the DevExpress_License OS-specific environment variable.

env:
  DevExpress_License: '$(DEVEXPRESS_LICENSE)'

Important

Use the exact casing (DevExpress_License.txt, DevExpress_LicensePath, DevExpress_License) to avoid license activation issues. On most Unix-like systems, file and environment variable names are case-sensitive.

For example, a macOS development machine or Linux-based CI/CD pipeline will not activate the DevExpress license if the environment variable is named DEVEXPRESS_LICENSE or devexpress_license.

Sample YAML file
trigger:
 - master

pool:
 vmImage: 'windows-latest'

variables:
 solution: '**/*.sln'
 buildPlatform: 'Any CPU'
 buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1
# Assuming no NuGet.Config is present
- script: dotnet nuget add source "https://nuget.devexpress.com/$(DEVEXPRESS_API)/api/v3/index.json" --name DevExpress_Feed
 displayName: 'Register DevExpress NuGet feed'

- task: NuGetCommand@2
 inputs:
   command: 'restore'
   restoreSolution: '$(solution)'
   feedsToUse: 'select'
   vstsFeed: ''

- task: VSBuild@1
 env:
   DevExpress_License: '$(DEVEXPRESS_LICENSE)'
 inputs:
   solution: '$(solution)'
   msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
   platform: '$(buildPlatform)'
   configuration: '$(buildConfiguration)'

- task: PublishPipelineArtifact@1
 displayName: 'Publish pipeline artifacts'
 inputs:
   targetPath: '$(Build.ArtifactStagingDirectory)'
   artifactName: 'drop'

#JFrog Artifactory

  1. Obtain your NuGet feed credentials.

  2. Create a new remote repository in Artifactory with the following settings:

    Settings Values
    URL https://nuget.devexpress.com/
    NuGet Download Context Path api/v2/package
    NuGet Feed Context Path api/v2
    NuGet v3 Feed URL https://nuget.devexpress.com/api/v3/index.json

JFrog Repository

JFrog Artifactory creates a NuGet feed on the jFrog server.

Read the following help topics for additional information:

#Nexus OSS

  1. Obtain your NuGet feed credentials.

  2. Create a new remote repository with the following settings.

    Settings Values
    Format nuget
    Type proxy
    Remote Storage https://nuget.devexpress.com/{Your feed authorization key}/api/v3/index.json

Nexus OSS Repository

Nexus OSS creates a proxy URL feed with access to the DevExpress NuGet packages.

See Also