Important Notice
This article explains how to use build servers for the following versions and requirements:
- TX Text Control .NET Server for Windows Forms 32.0 SP2 (or better)
- TX Text Control .NET Server for WPF 32.0 SP2 (or better)
- .NET 6 or better
If you are using TX Text Control .NET Server for ASP.NET, please use the following tutorial:
Compiling TX Text Control .NET Server 32.0 with Azure DevOps and Artifacts
Continuous integration (CI) is a development practice in which every check-in is verified by an automated build, allowing teams to identify problems early.
With Azure DevOps, Microsoft provides services for teams to share code and track their work. A key feature is continuous integration support for projects called Azure Pipelines. These hosted build agents can build projects on the fly or based on your specifications.
Text Control products are licensed on a per-developer basis. A separate, assigned license is required for each developer using our products. If you are using a build server, all developers who check-in code, that uses TX Text Control classes, need their own license.
On hosted build machines, such as Azure DevOps, third-party software required to compile the license into the application cannot be installed. To use hosted build agents, the license must be manually compiled and embedded as an embedded resource.
Uploading NuGet Packages to Artifacts
The required TX Text Control NuGet packages are installed with the developer license setup in the private, local "Text Control Offline Packages" source. Since Azure pipelines don't have access to this package source and Text Control NuGet packages are not listed on NuGet.org, the required packages must be uploaded to Azure Artifacts. Artifacts is an Azure service for creating public and private package feeds needed to build the project.
-
In Azure DevOps, open Artifacts and click Create Feed, provide a name and choose the required Visibility. Confirm with Create.
-
Select the newly created feed and click Connect to Feed:
-
From the list, select NuGet.exe
Important
To use NuGet.exe with Azure Artifacts, you'll need a recent version of NuGet (4.8.0.5385+) and the Azure Artifacts credential provider. If you've installed Visual Studio (v15.9-preview1 or later), including the Build Tools edition, you already have the credential provider and you should just download the latest NuGet to a directory on your PATH and outside of your repository.
-
Copy the feed path from the shown config file:
-
Open an elevated (developer) command prompt and push the Text Control NuGet package using the following command. Replace the src string with the string copied in the previous step.
nuget.exe push "C:\Program Files (x86)\Text Control GmbH\NuGetPackages\txtextcontrol.textcontrol.winforms.sdk.32.0.2.nupkg" -src "https://textcontrol.pkgs.visualstudio.com/Test/_packaging/MyPackages/nuget/v3/index.json" -ApiKey AzureDevOps
Download NuGet
The NuGet.exe CLI is not automatically installed by Visual Studio and can be downloaded directly here:
-
In the feed overview, the uploaded package should be visible:
Configure NuGet in Project
-
In your Visual Studio project, create a new file in the project's root folder named nuget.config and copy the following configuration into it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="MyPackages" value="https://pkgs.dev.azure.com/textcontrol/Test/_packaging/MyPackages/nuget/v3/index.json" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> <packageSourceCredentials> <MyPackages> <add key="Username" value="123" /> <add key="ClearTextPassword" value="PersonalAccessToken" /> </MyPackages> </packageSourceCredentials> </configuration> -
Replace PersonalAccessToken with a newly created Personal Access Token you can create in Azure DevOps:
-
Replace the first packageSources key (MyPackages in this sample) with your created package source in Azure Artifacts.
-
Create Azure Pipeline
Assuming you are using GitHub as your repository, commit and push your project. Now it is time to create your pipeline in Azure DevOps.
-
In your project, create a new pipeline and select GitHub:
-
Select your project from your repositories.
-
In this step, you can review the created pipeline YAML. Make sure that the NuGet restore command is using the feed (feedsToUse) from the created config file. The following task can be used to configure that:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters- task: NuGetCommand@2 inputs: command: 'restore' restoreSolution: '**/*.sln' feedsToUse: 'config' Important
If your nuget.config is in another folder or the project subfolder, use the nugetConfigPath property in the yml file:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters- task: NuGetCommand@2 inputs: command: 'restore' restoreSolution: '**/*.sln' feedsToUse: 'config' nugetConfigPath: 'myApp/nuget.config' A complete sample azure-pipelines.yml would look like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters# .NET Desktop # Build and run tests for .NET Desktop or Windows classic desktop solutions. # Add steps that publish symbols, save build artifacts, and more: # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net trigger: - master pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: NuGetToolInstaller@1 - task: NuGetCommand@2 inputs: command: 'restore' restoreSolution: '**/*.sln' feedsToUse: 'config' nugetConfigPath: 'yourAppName/nuget.config' - task: VSBuild@1 inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: VSTest@2 inputs: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)'
Running Pipelines
When creating your pipeline, a first run will be performed automatically. The result should look very similar to this:
Now, every time you check in your code, a new run is performed: