.NET MAUI › Native Interop & Libraries
How do you share code between a MAUI app and other .NET projects (web/API)?
IntermediateAnswer
Put shared models, DTOs, validation, and business logic in a plain .NET class library referenced by both the MAUI app and the server. Keep platform and UI concerns out of it. This maximizes reuse and keeps a single source of truth for contracts.
// Shared.csproj referenced by MyApp.Maui and MyApp.Api
public record ProductDto(int Id, string Name, decimal Price);Real-world example The same DTOs and validation rules compile into both the API and the MAUI client, preventing contract drift.