This article explains how to use build servers with TX Text Control using the .NET Framework (4.8). If you are using .NET 6 or later, please see this article instead:
Compiling TX Text Control .NET Server 31.0 with Azure DevOps and Artifacts
Continuous Integration (CI) is a development practice where each check-in is verified by an automated build which enables teams to detect problems at an early stage.
With Azure DevOps, Microsoft offers services for teams to share code and track their work. A major feature is the continuous integration support for projects called Azure Pipelines. These hosted build agents can build the projects immediately or based on your specifications.
This article explains how to setup your project in Visual Studio to use Azure DevOps Pipelines, but in general this is valid for all available build agents including:
- Azure DevOps
- Octopus Deploy
Text Control products are licensed on a per-developer basis. Each developer who uses our products must have their own, assigned license. 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, no third-party software can be installed which would be required to compile the license into the application. In order to use hosted build agents, the license must be compiled manually and embedded as an embedded resource and all TX Text Control DLLs must be copied to the output folder.
Preparing the Project
Assuming that you already created an ASP.NET (Core) 5 project using TX Text Control, the following steps are required to prepare the project for Azure Pipelines. In this sample, we will use GitHub as the source of the pipeline, but this is completely independent and doesn't influence the project preparation.
- Adding TX Text Control Files
In a first step, all TX Text Control files including the assemblies and binaries from the bin64 folder must be included in the project.
- Select the project in the Solution Explorer and choose Project -> New Folder from the main menu and name the folder Text Control Dependencies.
- Select the folder and choose Add Existing Item....
- Browse for the TX Text Control installation folder (C:\Program Files\Text Control GmbH\TX Text Control 30.0.NET Server for ASP.NET\Assembly) and include the following files:
- Now, repeat the last step with all files from the bin64 folder.
- Select all files in the new folder and change the Copy to Output Directory to Copy always.
- Building the License File
In this step, we will compile the license file manually once to embed it into the project.
Open a Visual Studio Command Prompt, change the current directory to your project folder and type in the following command and replace MyApplication with your Assembly name:
lc.exe /target:MyApplication.dll /complist:licenses.licx /i:"C:\Program Files\Text Control GmbH\TX Text Control 30.0.NET Server for ASP.NET\Assembly\TXTextControl.Server.dll"
The DLL(s) listed after the /i switch must be referenced from the TX Text Control installation path.
The license compiler will generate the 'MyApplication.dll.licenses' resource file in the project's root folder. By default, the license compiler will add the namespace to the filename.
Rename the generated resource file to dll.licenses.
Back in Visual Studio, select the project in the Solution Explorer and choose Add Existing Item.... Browse for the created license file, select it and confirm with Add.
Select the newly added file dll.licenses and change the property Build Action to Embedded resource.
In the Solution Explorer, find the licenses.licx in your project tree and remove it.
In case you are creating a classic .NET Framework 4.5 (or better) application, set the target to MyApplication.exe and rename the resulting license file to exe.licenses for the steps above.
- Set Platform Target to 64bit
Select the project in the Solution Explorer and choose Project -> Properties, open the tab Build and set the Platform target to x64.
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. Confirm by clicking Run.
This creates a pipeline and places the YAML into your project. You might have to provide Azure DevOps access to this GitHub repository in this step.
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: