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): Git
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.
- Navigate to the main page of the repository and click Settings.
- In the Security section of the sidebar, select Secrets and variables | Actions.
- Click New repository secret in the Secrets tab.
Set your personal NuGet API key as the secret value.
Repeat the same steps to add another secrect with your personal license key.
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.
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
Open your project CI/CD settings (Settings > CI/CD):
Add a new variable.
- Click Expand.
Click Add variable.
Specify variable parameters:
Important
- Select the Masked option.
- Variables defined in this way are available globally for every pipeline and its jobs.
Add another variable to store your DevExpress License Key.
- 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
ordotnet 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"
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.
- Obtain your NuGet feed credentials.
- Add the NuGet.config file next to the .sln file in your project.
- 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 Nu
#Feed Authorization Key
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>
Add a new build pipeline.
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 Nu Get. config Path to Nu Get. config Path to your Nu Get. fileconfig Click the New/Add button to add feed credentials.
Specify the connection settings as shown below and save them.
#NuGet Feed URL
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>
Add a new build pipeline.
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 Nu Get. config Path to Nu Get. config Path to your Nu Get. fileconfig
#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.
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.DevExpress_License
, DevExpress_License
) to avoid license activation issues. On most Unix-like systems, file and environment variable names are case-sensitive.
For example, a macDEVEXPRESS_LICENSE
or devexpress_license
.
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
Create a new remote repository in Artifactory with the following settings:
Settings Values URL https://nuget. devexpress. com/ Nu Get Download Context Path api/v2/package Nu Get Feed Context Path api/v2 Nu Get v3 Feed URL https://nuget. devexpress. com/api/v3/index. json
JFrog Artifactory creates a NuGet feed on the jFrog server.
Read the following help topics for additional information:
- JFrog Artifactory – Set Up Remote NuGet Repositories
- JFrog Artifactory – How to Configure NuGet Remote Repository as DevExpress
#Nexus OSS
Create a new remote repository with the following settings.
Settings Values Format nuget Type proxy Remote Storage https://nuget. devexpress. {Your feed authorization key}/api/v3/index.com/ json
Nexus OSS creates a proxy URL feed with access to the DevExpress NuGet packages.