dotnet / dotnet/sdk

add `NATIVEAOT` constant when publish aot

Open
#44,459 0 comments 0 reactions 0 assignees View on GitHub
Area-NativeAOT untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem? Please describe.

When publish with AOT, add a constant `NATIVEAOT` so that we could do aot-specific operation likes

```c#
#if NATIVEAOT
// .. aot-only
#endif
```

### Describe the solution you'd like

When `PublishAot` is `true`, define additional constant

```xml

$(DefineConstants);NATIVEAOT

```

### Additional context

see comment:
https://github.com/dotnet/runtime/discussions/109005#discussioncomment-10980398

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.