AvaloniaUI. PublishAot doesn't work with Visual Studio 2026
avaloniavisual studio
Trying to compile an Avalonia application on .NET 9 with Native AOT on Windows, but getting a linker error: error: Platform linker not found. Ensure you have all the required prerequisites documented at https://aka.ms/nativeaot-prerequisites
What I've already done: • Installed the "Desktop development with C++" workload in Visual Studio • Verified that link.exe exists at: C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC...\Hostx64\x64\link.exe • Verified that Windows SDK is installed • Running the build from "x64 Native Tools Command Prompt for VS 2026" • Environment variables (LIB, INCLUDE, WindowsSdkDir) are set correctly • rc.exe and link.exe are in PATH and working
Root cause: It appears that Microsoft.DotNet.ILCompiler (version 9.0.11) doesn't recognize Visual Studio 2026 (version 18). It searches for VS versions in the range [16,18) (not including 18). Adding IlcUseEnvironmentalTools=true allows it to find the linker, but then hundreds of LNK2001/LNK2019 errors appear for missing symbols like imp_GetLastError, security_cookie, wmainCRTStartup, etc. Note: A simple console application (Hello World) with PublishAot=true compiles successfully with the same setup, so the basic AOT toolchain is working.
Question: Has anyone successfully compiled Native AOT with Visual Studio 2026? Is there a workaround or do I need to downgrade to VS 2022?