Skip to content

windows image (nanoserver, windowsservercore) with Native AOT support #6874

Description

@LucHeart

Describe the Problem

I am trying to publish a console application for windows using native AOT. However when using the nanoserver image it fails with the following:

C:\Users\ContainerUser\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.1\build\Microsoft.NETCore.Native.Windows.targets(142,5): error : Platform linker not found. Ensure you have all the required prerequisites documented at https://aka.ms/nativeaot-prerequisites, in particular the Desktop Development for C++ workload in Visual Studio. For ARM64 development also install C++ ARM64 build tools. [C:\builds\launcher\Launcher.csproj]

Describe the Solution

I think it would be good to have nanoserver image, with native AOT support, like the new linux-aot images.

Im personally not sure how doable this is, since the documentation only states "Visual Studio 2022 or later, including the Desktop development with C++ workload with all default components.". I could not find a workload via the dotnet workload command that would be fitting.

Additional Context

Nanoserver Image Used: mcr.microsoft.com/dotnet/sdk:10.0-nanoserver-ltsc2025
Build command: dotnet publish -r win-x64 Launcher.csproj -o ./bin
Native AOT enabled in .csproj

EDIT:
servercore image also fails with the same reason, I previously assumed it would work due to the documentation stating that only the nano image isnt preconfigured for it.
Workaround, use the servercore image and install the build tools manually.
Do note that this uses a lot of disk, I assumed thats why its not included in any of the normal images...

- powershell -Command "Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile vs_buildtools.exe"
- powershell -Command "Start-Process -FilePath .\vs_buildtools.exe -ArgumentList '--quiet --norestart --wait --nocache --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.26100' -Wait"

Activity

  1. changed the title [-]nanoserver image with Native AOT support[/-] [+]windows image (nanoserver, windowsservercore) with Native AOT support[/+] on Dec 11, 2025
  2. added theissue type on Dec 15, 2025
  3. added
    area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates
    and removed on Dec 15, 2025
  4. lbussell commented on Dec 17, 2025

    @lbussell
    Member

    Thanks for the feature request. This is probably something we'd like to support.

    As far as I know installing VS buildtools on Nano Server isn't supported (it definitely doesn't work - I just tried it).

    We'll need to create a proof of concept for including VS Buildtools + those MSVC workloads on the Server Core image. The size increase will inform whether we should offer a windowsservercore-aot image or just bundle them into the existing SDK image.

    According to dotnet/versions the 10.0 SDK servercore 2025 image size is ~3.64 GB. From my initial test, the MSVC tools were ~1.5GB (need to confirm though).

    /cc @richlander @baronfel

  5. self-assigned this
    on Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions