09/18/2025
How-to | SDK | Docker

Build snap with Docker on Windows for ctrlX AUTOMATION

Introduction

In this article I will show you how to pack and release an app through docker on Windows system. This tutorial is based on the Samples from SDK for ctrlX AUTOMATION in three different languages (.net, python and C++).

In another tutorial I think you already know something about the ctrlX WORKS App Build Environment. This environment can usually only be configured on Linux systems or Linux virtual machine on Windows system. If you are a pure Windows follower, you can also actually package and publish app for your ctrlX Core.

Note that this tutorial does not cover the debugging of the app. If you want to learn how to debug an app, please move here.

Preparation (The version used for this tutorial)

Additional

If your computer can connect directly to the Internet, then you can skip this part.

If your computer needs a proxy (usually a company computer) to enable docker containers to Internet and download files, then I recommend to install and run px.exe as local proxy server on your Windows host.

Operation

  1. Download the released SDK compressed package from GitHub and decompress it. For example, ctrlx-automation-sdk-2.6.7.zip

    Released ctrlx-automation-sdk on github
  2. Download the snap build script compressed package and decompress it. There are scripts in three different languages (.net, python and C++) ​​for Windows.

    Script overview
  3. Copy the script to the corresponding sample project. For example, you want to package a .net sample project datalayer.provider.alldata under the Windows system. Then you can copy the script in this way: Win\Net\build-snap-dotnet.ps1 -> ctrlx-automation-sdk\samples-net\datalayer.provider.alldata

    Copy the script to the project root directory
  4. Open Docker Desktop and keep it running in the background. If you cannot run docker due to WSL issues, you can try running the following command in the command window:

    bcdedit /set hypervisorlaunchtype auto
  5. Open a command window in the project root. Then run the commend:

    .\build-snap-dotnet.ps1
    Run the script in the command window

    Notice: If you are not using a proxy, please remove these lines from the script.

    -e http_proxy="http://host.docker.internal:3128" ` 
    -e https_proxy="http://host.docker.internal:3128" `

    Content that needs to be deleted if without proxy

    If you end up seeing something like this, congratulations! You can install the snap-App on your ctrlX CORE now.

    The result of successful script execution
  6. Here is a brief explanation of how the script works (Take .net as an example). See the script for more details.

    1. Select the target device. (amd64 or arm64)

    2. Compile and publish .net program. (If you don't have a compiler installed on your computer, please go here)

    3. Check and modify the original snapcraft.yaml file.

    4. Download Image ghcr.io/canonical/snapcraft:8_core22 in Docker.

    5. Run commend in Docker to package the published .net program into a snap file.

Summarize

  • .Net: The compilation, debugging, publishing and packaging of the program can be fully realized on Windows in Docker.

  • Python: The compilation and debugging of the program need to be completed in the ctrlx-sdk environment due to some dependencies on ctrlx-datalayer. No need to publish. The packaging process can be achieved under Windows in Docker.

  • Cpp: The compilation, debugging, publishing need to be completed in the ctrlx-sdk environment due to some dependencies on ctrlx-datalayer. Only the packaging can be achieved under Windows in Docker.

debugging

release

packaging

.net

Yes

Yes

Yes

python

No

don't need

Yes

cpp

No

No

Yes

3
script.zip
5.94KB
Types
How-to
Example
Products
Controls
Markets

Latest published/updated articles