.NET Core 3.0 will be launched at .NET Conf, September 23-25th and the current version Preview 9 is the last preview before the final release. We tested our latest versions against this new framework and this article explains how to use TX Text Control .NET Server for ASP.NET in an ASP.NET Core 3 Web Application.
In order to create a .NET Core 3 application, you will need to download the .NET Core 3.0 SDK:
Visual Studio 2019 doesn't provide .NET Core 3.0 as a selectable target. Visual Studio 2019 Preview is required to create .NET Core 3.0 applications:
Why is .NET 3.0 supported and not .NET 2.1?
Word processing is a complex task and requires some high-performance modules which are written in C++. Finally, the .NET Core 3.0 runtime added support for IJW C++/CLI on Windows that makes .NET Core 3.0 a usable target for TX Text Control applications running on Windows.
Additionally, the official package System.Drawing.Common from Microsoft provides access to GDI+ graphics functionality which is required in TX Text Control applications.
Creating the Application
The following tutorial shows how to create an ASP.NET Core 3 Web Application that can be deployed to Windows machines.
In Visual Studio 2019 Preview, create a new project and select ASP.NET Core Web Application as the project template.
Select a project name, location and solution name in the next dialog and confirm with Create.
In the last dialog, select .NET Core and ASP.NET Core 3.0 as the project target, select Web Application (Model-View-Controller) as the template and confirm with Create.
Open the Package Manager Console by choosing Package Manager Console from the Tools -> NuGet Package Manager main menu and type in the following command to install the System.Drawing.Common package:
PM> Install-Package System.Drawing.Common
While the project is selected in the Solution Explorer, choose Project -> Add Reference... to open the Reference Manager. In the opened dialog, select Browse... to select the required TX Text Control assemblies. Navigate to the installation folder of TX Text Control and select the following assemblies from the Assembly folder:
Repeat this step with the following assemblies from the Assembly/bin64 folder:
After selecting these assemblies, close the Reference Manager by confirming with OK.
While the project is selected in the Solution Explorer, choose Project -> Add Existing Item.... Browse to the TX Text Control installation folder and select the following files from the Assembly/bin64:
Select the files from step 6 in the Solution Explorer and set the Copy to Output Directory to Copy always.
While the project is selected in the Solution Explorer, choose Project -> Add New Item.... Select Text File, name the file licenses.licx and close the dialog by clicking Add.
Open the newly added file and add the following content:
Set the Copy to Output Directory property to Copy Always.
Projects built with .NET Core 3.0 are not able to compile licenses into the resources using the license compiler. This manual step is required for licensed controls in .NET Core 3.0 applications.
Build the application now by pressing F6 or choose Build Solution from the Build main menu.
Open a Developer Command Prompt with explicit administrator rights and change the directory to the project output directory such as \bin\debug\dotnetcoreapp3.0. Type in the following command:
lc.exe /target:WebApplication.dll /complist:licenses.licx /i:"TXTextControl.Server.dll"
Where WebApplication.dll is the assembly name of your web application.
Now, type in the following command to rename and move the created license file to the project's root folder:
move webapplication.dll.licenses ..\..\..\dll.licenses
Back in Visual Studio, select the file dll.licenses in the Solution Explorer and set the Build Action to Embedded Resource.
Now, you can use ServerTextControl and MailMerge in your .NET Core 3 Web Application: