dotnet / dotnet/docs

.NET 9.0 or earlier requires VS2022 for PublishAot

Open
#50,829 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Type of issue

Missing information

### Description

An user in the C# Discord had the problem that they couldn't publish a .NET 9.0 project with VS2026. It gave the following error:

> C:\Users\...\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.11\build\Microsoft.NETCore.Native.Windows.targets(138,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.

In the link it's saying:

> **Prerequisites**
> \[Windows\]
> [Visual Studio 2022 or later](https://visualstudio.microsoft.com/vs/), including the Desktop development with C++ workload with all default components.

The user did in fact install a later version; VS2026, however, there is a VS version check in the AOT compiler that checks for VS2022.

Issue in the Developer Community: https://developercommunity.visualstudio.com/t/AOT-Publish-Issue-while-target-NET-9-an/11000135

This has been fixed in dotnet/runtime in:
- https://github.com/dotnet/runtime/pull/120913 (.NET 9.0)
- https://github.com/dotnet/runtime/pull/120914 (.NET 8.0)

However:
- At the time of writing the fixes are not yet released in a new SDK;
- Users that have older SDKs installed will still have this issue;
- This won't be fixed for .NET versions that are EOL (e.g. .NET 6.0).

Should this information be included on this page that the SDK should be updated, and that VS2022 should be installed/used for older SDK versions?

### Page URL

https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8#prerequisites

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/deploying/native-aot/index.md

### Document Version Independent Id

54aa95cb-2d5b-85c9-6c34-1fc0348f7cb1

### Platform Id

9b2082cc-ea88-5fa5-ebe1-07b81f70a58a

### Article author

@LakshanF

### Metadata

* ID: 63476200-2ede-1779-9cc9-1503efec1b36
* PlatformId: 9b2082cc-ea88-5fa5-ebe1-07b81f70a58a
* Service: **dotnet-fundamentals**

[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+54aa95cb-2d5b-85c9-6c34-1fc0348f7cb1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.