# Using a Private NuGet Feed to Build and Restore .NET Apps for Docker Deployment

> Learn how to set up a private NuGet feed for your .NET applications and use them in Docker containers. This guide covers the steps to create a private NuGet feed with GitHub, configure your .NET project to use it, and build Docker images that contain your private packages.

- **Author:** Bjoern Meyer
- **Published:** 2025-04-11
- **Modified:** 2025-11-16
- **Description:** Learn how to set up a private NuGet feed for your .NET applications and use them in Docker containers. This guide covers the steps to create a private NuGet feed with GitHub, configure your .NET project to use it, and build Docker images that contain your private packages.
- **5 min read** (985 words)
- **Tags:**
  - ASP.NET
  - ASP.NET Core
  - Docker
  - NuGet
- **Web URL:** https://www.textcontrol.com/blog/2025/04/11/using-a-private-nuget-feed-to-build-and-restore-dotnet-apps-for-docker-deployment/
- **LLMs URL:** https://www.textcontrol.com/blog/2025/04/11/using-a-private-nuget-feed-to-build-and-restore-dotnet-apps-for-docker-deployment/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2025/04/11/using-a-private-nuget-feed-to-build-and-restore-dotnet-apps-for-docker-deployment/llms-full.txt

---

The TX Text Control NuGet packages are not publicly available on nuget.org because they contain licensing information required for deployment. These packages are typically installed through the developer setup, which registers a local NuGet source on the developer's machine.

While this works well for local development, it can become a challenge when deploying applications, especially in automated environments such as CI/CD pipelines or Docker containers. An effective solution is to upload the licensed NuGet packages to a private feed, such as GitHub Packages, to make them accessible during the build and publish process.

##### Why Are TX Text Control Packages Not on NuGet.org?

TX Text Control packages are licensed components. Unlike open source or public libraries, they have licensing information embedded in the package. Because of these limitations, they are not distributed via public feeds. Instead, developers install them through the TX Text Control setup, which registers a local source such as:

*C:\\Program Files (x86)\\Text Control GmbH\\NuGetPackages*

This approach doesn't work with build servers or Docker containers. To solve this, you can host the packages in a private NuGet feed, like GitHub Packages.

#### Uploading TX Text Control Packages to GitHub Packages

GitHub Packages is a package hosting service that allows you to host and manage packages in your GitHub repositories. It supports multiple package formats, including NuGet, npm, Docker, and more. With GitHub Packages, you can easily share your packages with your team or the public, while keeping them secure.

##### Creating a GitHub Personal Access Token

To upload TX Text Control packages to GitHub Packages, follow these steps:

1. Install the TX Text Control setup on your local machine. This will register the local NuGet source.
2. Create a GitHub personal access token (PAT) with the scope *write:packages* and *read:packages*. You'll use this token to authenticate when you publish.
    
    
    1. While logged in to your GitHub account, open the token settings:
        
        [Personal access tokens (classic)](https://github.com/settings/tokens)
    2. Click on **Generate new token** and select *Generate new token (classic).*
    3. Give your token a descriptive name, select the expiration date, and check the scopes **write:packages** and **read:packages**.
        
        ![Creating a GitHub Token](https://s1-www.textcontrol.com/assets/dist/blog/2025/04/11/a/assets/github1.webp "Creating a GitHub Token")
    4. Click on **Generate token**. Make sure to copy the token immediately, as you won't be able to see it again. Store the token securely. You will need it to authenticate when you publish the packages.

##### Publishing TX Text Control Packages

Once you have the personal access token (PAT), you can publish the TX Text Control packages to GitHub Packages. Follow these steps:

1. Open PowerShell or Command Prompt and use the following command to set up the GitHub Packages source:
    
    ```
    dotnet nuget add source --username YOUR_GITHUB_USERNAME --password YOUR_GITHUB_PAT --store-password-in-clear-text --name github "https://nuget.pkg.github.com/YOUR_GITHUB_USERNAME/index.json"
    ```
    
    Replace **YOUR\_GITHUB\_USERNAME** with your GitHub username and **YOUR\_GITHUB\_PAT** with the personal access token you created earlier.
2. Use the following command to publish the TX Text Control packages:
    
    ```
    dotnet nuget push "C:\Program Files (x86)\Text Control GmbH\NuGetPackages\TXTextControl.TextControl.Core.SDK.33.0.0.nupkg" --source "github" --api-key YOUR_GITHUB_PAT
    ```
    
    Replace **TXTextControl.TextControl.Core.SDK.33.0.0.nupkg** with the path to the TX Text Control package you want to publish. This sample uses the TX Text Control .NET Core SDK package.

##### Adding the GitHub Packages Source to Your Project

1. In your .NET project, create a file named *nuget.config* in the root directory. This file will contain the configuration for the NuGet sources.
2. In the *nuget.config* file, add the following content:
    
    ```
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <!-- Default NuGet.org -->
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    
        <!-- GitHub Packages -->
        <add key="github" value="https://nuget.pkg.github.com/YOUR_GITHUB_USERNAME/index.json" />
      </packageSources>
    
      <packageSourceCredentials>
        <github>
          <add key="Username" value="YOUR_GITHUB_USERNAME" />
          <add key="ClearTextPassword" value="YOUR_GITHUB_PAT" />
        </github>
      </packageSourceCredentials>
    </configuration>
    ```

##### Restoring TX Text Control in Docker Builds

In your Dockerfile, make sure that the nuget.config file is copied to the image. This ensures that the Docker build process can access the TX Text Control packages from GitHub Packages.

Here is an example of a Dockerfile that includes the nuget.config file:

```
### See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

### This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

WORKDIR /app
EXPOSE 8080
EXPOSE 8081

### This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release

WORKDIR /src

COPY ["tx-web-api-core.csproj", "tx-web-api-core/"]
COPY ["nuget.config", "tx-web-api-core/"]

RUN dotnet restore "./tx-web-api-core/tx-web-api-core.csproj"

WORKDIR "/src/tx-web-api-core"
COPY . .

RUN dotnet build "tx-web-api-core.csproj" -c $BUILD_CONFIGURATION -o /app/build

### This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./tx-web-api-core.csproj" -c $BUILD_CONFIGURATION -r linux-x64 -o /app/publish /p:UseAppHost=false

### This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "tx-web-api-core.dll"]
```

In this example, the Dockerfile copies the *nuget.config* file to the project directory in the image. The dotnet restore command will use this configuration to restore the TX Text Control packages from GitHub Packages.

##### Defining the Target Runtime

Pay attention to line 29 in the Dockerfile. The *-r linux-x64* option is used to publish the application for the Linux x64 runtime. This is important because the TX Text Control packages are platform-specific, and you need to ensure that the correct version is restored for the target platform.

After building the Docker image, you can run the container and use TX Text Control in your application.

##### Conclusion

By following these steps, you can successfully upload TX Text Control packages to GitHub Packages and use them in your projects. This approach allows you to manage your dependencies more effectively, especially in automated environments such as CI/CD pipelines and Docker containers.

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Building a TX Text Control Project with GitHub Actions and the Text Control NuGet Feed](https://www.textcontrol.com/blog/2026/02/09/building-a-tx-text-control-project-with-github-actions-and-the-text-control-nuget-feed/llms.txt)
- [ASP.NET Core Document Editor with Backend via the Text Control Private NuGet Feed](https://www.textcontrol.com/blog/2026/02/09/aspnet-core-document-editor-private-nuget-feed/llms.txt)
- [Text Control Private NuGet Feed](https://www.textcontrol.com/blog/2026/02/09/text-control-private-nuget-feed/llms.txt)
- [Announcing the Official DS Server Docker Image on Docker Hub](https://www.textcontrol.com/blog/2025/05/02/announcing-the-official-ds-server-docker-image-on-docker-hub/llms.txt)
- [Deploying the TX Text Control Document Editor Backend Web Server in Docker](https://www.textcontrol.com/blog/2025/04/10/deploying-the-tx-text-control-document-editor-backend-web-server-in-docker/llms.txt)
- [Creating a .NET Console Application with Visual Studio Code and TX Text Control (on Linux)](https://www.textcontrol.com/blog/2025/04/03/creating-a-dotnet-console-application-with-visual-studio-code-and-tx-text-control-on-linux/llms.txt)
- [Using TX Text Control with Ultra-Minimal Chiseled Linux Containers](https://www.textcontrol.com/blog/2025/03/12/using-tx-text-control-with-ultra-minimal-chiseled-linux-containers/llms.txt)
- [Getting Started: Document Editor with ASP.NET Core and Docker Support with Linux Containers](https://www.textcontrol.com/blog/2025/03/12/getting-started-document-editor-with-asp-net-core-and-docker-support-with-linux-containers/llms.txt)
- [Version 33.0 Preview: NuGet Packages Explained and Why we Minimize Dependencies](https://www.textcontrol.com/blog/2025/02/24/version-33-0-preview-nuget-packages-explained-and-why-we-minimize-dependencies/llms.txt)
- [Why an Unlimited Runtime License (OEM) for TX Text Control is Perfect for Cloud Deployments](https://www.textcontrol.com/blog/2025/01/08/why-an-unlimited-runtime-license-oem-for-tx-text-control-is-perfect-for-cloud-deployments/llms.txt)
- [Creating an ASP.NET Core Web App with Docker Support and GitHub Packages](https://www.textcontrol.com/blog/2024/01/05/creating-an-asp-net-core-web-app-with-docker-support-and-github-packages/llms.txt)
- [Deploying an ASP.NET Core Web App to Azure App Services](https://www.textcontrol.com/blog/2023/09/23/deploying-an-aspnet-core-web-app-to-azure-app-services/llms.txt)
- [Deploying an ASP.NET Core Web App with Docker](https://www.textcontrol.com/blog/2023/09/23/deploying-an-aspnet-core-web-app-with-docker/llms.txt)
- [Document Editor Deployment with Docker and Windows Server Core 2019 and 2022 including Fonts](https://www.textcontrol.com/blog/2023/06/02/document-editor-deployment-with-docker-and-windows-server-core-2019-and-2022/llms.txt)
- [Deploying an ASP.NET Core Web Application using the Document Editor with Docker](https://www.textcontrol.com/blog/2022/09/02/deploying-an-aspnet-core-application-with-docker/llms.txt)
- [WeAreDevelopers World Congress Europe 2026 Wrap Up: Record Breaking Days in Berlin](https://www.textcontrol.com/blog/2026/07/13/wearedevelopers-world-congress-europe-2026-wrap-up-record-breaking-days-in-berlin/llms.txt)
- [C# Document Generation: A Developer's Guide for .NET](https://www.textcontrol.com/blog/2026/07/08/csharp-document-generation-developer-guide-for-dotnet/llms.txt)
- [Validating PDF/UA Documents in .NET C#: A Practical Guide](https://www.textcontrol.com/blog/2026/07/06/validating-pdf-ua-documents-in-dotnet-csharp/llms.txt)
- [See Text Control at WeAreDevelopers World Congress Europe 2026 in Berlin](https://www.textcontrol.com/blog/2026/07/06/see-text-control-at-wearedevelopers-world-congress-europe-2026-in-berlin/llms.txt)
- [DWX 2026 Wrap-Up: Four Days of Innovation, Conversations, and Enterprise Document Solutions](https://www.textcontrol.com/blog/2026/07/03/dwx-2026-wrap-up-four-days-of-innovation-conversations-and-enterprise-document-solutions/llms.txt)
- [Create SignFabric Envelopes from Mail Merge Templates in .NET C#](https://www.textcontrol.com/blog/2026/06/23/create-signfabric-envelopes-from-mail-merge-templates-using-dotnet-csharp/llms.txt)
- [Convert SSRS RDL Reports to DOCX and TX Text Control Templates in .NET C#](https://www.textcontrol.com/blog/2026/06/22/convert-ssrs-rdl-reports-to-docx-and-tx-text-control-templates-in-dotnet-csharp/llms.txt)
- [Export Document Tables to CSV in .NET C#](https://www.textcontrol.com/blog/2026/06/19/export-document-tables-to-csv-in-dotnet-csharp/llms.txt)
- [Major SignFabric Updates: Stronger Audit Trails, Validation, and Recipient Workflows](https://www.textcontrol.com/blog/2026/06/17/major-signfabric-updates-stronger-audit-trails-validation-and-recipient-workflows/llms.txt)
- [Text Control Expands North American Conference Presence with WeAreDevelopers World Congress North America](https://www.textcontrol.com/blog/2026/06/12/text-control-expands-north-american-conference-presence-with-wearedevelopers-world-congress-north-america/llms.txt)
