# Create Your First Application

> Create a .NET console app with TXTextControl.TextControl.Core.SDK from the private NuGet feed and save your first DOCX and PDF with ServerTextControl.

- **Product:** TX Text Control .NET Server
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET Server > Getting Started > Document Processing > Create Your First Application
- **1929 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/llms-full.txt

---

Your first TX Text Control application is a .NET console application that uses `ServerTextControl` to create a document and save it as DOCX and PDF. You install TX Text Control from the Text Control private NuGet feed, write a few lines of C# and run the application. The last section shows where to continue when the same code runs in ASP.NET Core.

### Choose Core or Classic

TX Text Control .NET Server ships with two versions of the document processing engine, each in its own NuGet package: Core (`TXTextControl.TextControl.Core.SDK`) for Windows and Linux, and Classic (`TXTextControl.TextControl.ASP.SDK`) for Windows only. Both contain the `ServerTextControl` class, so your code looks the same. This tutorial uses the Core package, which is recommended for new projects; [The Document Engine](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/architecture/#the-document-engine) compares the two and explains when you need Classic.

### Prerequisites

- A TX Text Control .NET Server license with a serial number assigned to your email address. The private NuGet feed only shows the packages you are licensed for.
- The `nuget.config` file for the [Text Control private NuGet feed](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/nuget/private-feed/llms-full.txt). When a serial number is assigned to you, you receive an email with a download link for your personal `nuget.config`. The file contains your credentials, so do not commit it to source control.
- The .NET 8 SDK or higher. The steps were written with Visual Studio 2026 and .NET 10 (Long Term Support). You can also use the .NET CLI with any editor, for example Visual Studio Code on Linux.

See [System Requirements](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/requirements/llms-full.txt) for the supported operating systems and .NET versions.

### Create the Project

Use either Visual Studio or the .NET CLI.

#### Visual Studio

1. In Visual Studio 2026, create a new project by choosing **Create a new project**.
2. Select **Console App** as the project template and confirm with **Next**.
3. Enter a project name and choose a location to save the project. Confirm with **Next**.
4. Choose **.NET 10.0 (Long Term Support)** as the **Framework** and confirm with **Create**.

#### .NET CLI

1. Open a terminal and create a new console application:

    ```bash
    dotnet new console -n MyTextControlApp
    ```
2. Change to the project directory:

    ```bash
    cd MyTextControlApp
    ```

### Install the NuGet Package

NuGet downloads the package from the private feed with the credentials in `nuget.config`. Your license is injected into the package on the server before the download, so there is no license file to manage and no activation dialog.

#### Visual Studio

1. Copy the `nuget.config` file you downloaded to the root folder of your project.
2. In **Solution Explorer**, select your project and choose **Manage NuGet Packages...** from the **Project** main menu.
3. In the **Package source** drop-down, select **TextControl**.
4. Browse for `TXTextControl.TextControl.Core.SDK` and install it.

![The Visual Studio NuGet Package Manager with TextControl selected as the package source: the Browse tab lists the TX Text Control 34.0 packages, and the details pane shows TXTextControl.TextControl.Core.SDK with its Install button.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-server/nuget-manager-private-feed.e9a528c0.webp)

If Visual Studio does not recognize the `nuget.config` file, follow the steps in [Visual Studio](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/nuget/private-feed/visual-studio/llms-full.txt).

#### .NET CLI

1. Copy the `nuget.config` file you downloaded to the project directory.
2. Optionally, list the packages your license gives you access to:

    ```bash
    dotnet package search "TXTextControl" --source TextControl
    ```
3. Add the package to the project:

    ```bash
    dotnet add package TXTextControl.TextControl.Core.SDK
    ```

### Write the Code

Open `Program.cs` and replace its content with the following code:

```csharp
using TXTextControl;

using (ServerTextControl tx = new ServerTextControl())
{
    // Initialize the new instance before using it
    tx.Create();

    // Set the text of the document
    tx.Text = "This is a sample document.";

    // Save the document as DOCX and as PDF
    tx.Save("sample.docx", StreamType.WordprocessingML);
    tx.Save("sample.pdf", StreamType.AdobePDF);
}

Console.WriteLine("Documents created: sample.docx and sample.pdf");
```

What the code does:

- The `using` statement disposes the `ServerTextControl` at the end of the block, so its resources are released as soon as the work is done.
- [Create](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/create-method/llms-full.txt) initializes the resources of the new instance. You must call it before you use any other member.
- The [Text](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/text-property/llms-full.txt) property sets the text of the document.
- [Save](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/save-method/llms-full.txt) writes the complete document to a file. The [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) value selects the format: `WordprocessingML` for DOCX and `AdobePDF` for PDF. If the file already exists, it is overwritten.

### Run the Application

Start the application:

- In Visual Studio, press **F5** or choose **Debug** > **Start Debugging**.
- With the .NET CLI, run the following command in the project directory:

    ```bash
    dotnet run
    ```

The application writes `sample.docx` and `sample.pdf` to its current working directory. With `dotnet run`, this is the project directory. When you start the application from Visual Studio, look in the build output folder, for example `bin\Debug\net10.0`. Open the PDF in any PDF viewer and the DOCX file in a word processor.

The PDF contains the text of the document on an otherwise empty page. Built with the trial packages, the application also adds a line of trial text above it:

![The top of sample.pdf: a small gray line of trial text saying that the document has been created with the TX Text Control trial version, and below it the text "This is a sample document."](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-server/sample-pdf-trial-text.6e6bae9c.webp)

Documents created with the packages from the private NuGet feed don't contain this line. If yours do, the application was built with trial packages; [Trial and Licensed Packages](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/licensing/development/#trial-and-licensed-packages) explains how to replace them.

### Use ServerTextControl in ASP.NET Core

`ServerTextControl` works the same way in an ASP.NET Core application. The only difference is that a web application usually saves the document to a byte array and returns it to the browser instead of writing it to disk. [Return a Document from an ASP.NET Core Controller](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/save-docx-pdf/#return-a-document-from-an-asp-net-core-controller) creates such an application and a controller that returns DOCX and PDF documents.

### Troubleshooting

- **The package is not found:** Check that `nuget.config` is in the project folder, that you selected the **TextControl** package source, and that a serial number is assigned to your email address. See [NuGet Authentication](https://docs.textcontrol.com/tx-text-control-dotnet-server/troubleshooting/nuget-authentication/llms-full.txt).
- **The application runs on Linux:** See [Linux Requirements](https://docs.textcontrol.com/tx-text-control-dotnet-server/deployment/linux/requirements/llms-full.txt) for what the target system needs.

### Next Steps

- [Load a Document](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/load/llms-full.txt) — open existing DOCX, RTF, HTML and PDF files.
- [Create a Document](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/create/llms-full.txt) — add formatted text, tables and headers.
- [Save as DOCX and PDF](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/save-docx-pdf/llms-full.txt) — save to files and byte arrays, and return documents from ASP.NET Core.
- [Simple Mail Merge](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/mail-merge/simple/llms-full.txt) — merge JSON data into a template.

---

## Nearby

- **Previous:** [Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/llms-full.txt)
- **Next:** [Load a Document](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/load/llms-full.txt)
