© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2mo ago•
46 replies
Podreju

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

Environment:
• OS: Windows 11
• Visual Studio: 2026 (Latest)
• .NET: 9.0
• Framework: Avalonia 11.3.8

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

csproj configuration:
OutputType: WinExe
TargetFramework: net9.0
PublishAot: true
IlcUseEnvironmentalTools: true

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?
Native AOT deployment overview - .NET
Learn what Native AOT deployments are and why you should consider using it as part of the publishing your app with .NET 7 and later.
Native AOT deployment overview - .NET
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Visual Studio doesn't work as expected with source generators [Answered]
C#CC# / help
4y ago
Visual studio doesn't generate commands automatically
C#CC# / help
4y ago
Migrate Visual Studio Extension to VS 2026
C#CC# / help
3mo ago
✅ Visual Studio c# doesn't save the apperance
C#CC# / help
3y ago