cannot build WinForms app with linux docker

Ivory Wolf
2 min readJul 11, 2021

Ephemeral agents (basically Docker containers with all your build dependencies that can consume code and generate artifacts for a CI/CD pipeline) in Jenkins seemed like a neat way to design a CI/CD system for a project I was working on.

Even though a target platform is Windows, why should it matter what platform the code was built on? Note I am talking about building NOT running the application. The benefit of cross-platform containerisation could really come into its own in a CI/CD scenario. And, for server-side code and code libraries is it possible. However, Microsoft does not allow their desktop technologies to be built anywhere other than Windows platforms.

In my case, I was hoping to build a Winforms application that had been updated to .NETCore within a Docker container of the .NETCore SDK running on a Linux server.

Running this command from the working directory:

docker run --rm -it -v $PWD:/app -w /app -p 8000:80
/core/sdk:3.1 /bin/bash

and issuing:

dotney build

give the following error:

/usr/share/dotnet/sdk/3.1.410/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error NETSDK1100: Windows is required to build Windows desktop applications. [/app/WindowsFormsApp1/WindowsFormsApp1.csproj]

Various articles/forum discussions bleat on about how “Windows app running on Linux does not make sense!”. That is true but surely just building should be possible? We are only writing the instructions to load a .dll and show a message box, not actually load it and show it?

Some comments from MS-looking people mention it not being part of their plan.

Anyway for now it seems it's not a possibility and there are probably good reasons why. I did find out that there are others in the same boat and it would be useful to plenty. Time will tell.