dennisdoomen / dennisdoomen/dotnet-library-starter-kit
[Feature]: Add trimming and Native AOT compatibility checks
- Dominant language
- C#
- Stars
- 77
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
### Background and motivation
Libraries increasingly need to work in trimmed and Native AOT applications. If a library uses reflection carelessly, consumers only find out when their own AOT publish emits warnings — or worse, when it fails at runtime. Library authors should catch that themselves.
Proposal:
* Set `IsAotCompatible` (which implies `IsTrimmable` and `EnableTrimAnalyzer`) on the modern target framework of the generated library.
* Add a small sample console project plus a build target that runs `dotnet publish` with AOT enabled, so trim and AOT warnings surface in CI rather than in a consumer's build.
### Alternative Concerns
* `IsAotCompatible` only applies to the newer target frameworks, so it needs a condition alongside the existing `net10.0` analyzer conditions in `Directory.Build.props`.
* An AOT publish needs native build tooling on the agent, which slows CI and adds a platform dependency. This argues for a separate opt-in target rather than part of the default build.
* Not every library can be AOT compatible. The option should be easy to turn off, with the generated README explaining when to do so.
### Could you help with a pull-request?
No
Contributor guide
Research direction
Start with Directory.Build.props and the existing net10.0 analyzer conditions, then inspect how the generated library and README are assembled. Add the opt-in sample console project and build target that runs dotnet publish with AOT enabled, and verify that the compatibility setting, warnings, and opt-out guidance appear as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, ci-cd
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100