Measure and Reduce a .NET iOS Application Package
An iOS package-size comparison is useful only when both measurements describe the same artifact. A simulator build, device app bundle, archive, uploaded IPA and thinned App Store download can have different contents. Establish a repeatable release baseline before removing libraries or changing compilation settings.
This procedure targets an existing .NET 10 iOS application with working signing and a compatible Xcode installation. It also applies to the iOS target of a .NET MAUI application. It provides a measurement workflow rather than a promised minimum size.
Record the baseline
Keep the source revision, .NET SDK, workload, Xcode version, target framework, runtime identifier and configuration with each measurement. Record whether the project uses its default deployment model or Native AOT. Use the same signing and distribution route for comparisons.
From the configured Mac build environment, publish the specific project rather than an entire multi-project solution:
dotnet --info
dotnet workload list
xcodebuild -version
dotnet publish MyApp.csproj -f net10.0-ios -c Release -r ios-arm64 -p:ArchiveOnBuild=true
Replace MyApp.csproj with the real project. The existing project must already contain the required application identity and signing configuration. Do not copy signing credentials into a script or article. The archive property asks the iOS build to produce an Xcode archive.
iOS build properties
Distinguish investigation bytes from delivery size
Inspect the generated .app to locate large resources, but label those measurements as local bundle bytes. The following Python script prints the twenty largest ordinary files and their total. It does not modify the bundle or follow symbolic-link files.
from pathlib import Path
import sys
bundle = Path(sys.argv[1])
if not bundle.is_dir():
raise SystemExit("Pass the path to an existing .app directory.")
files = [p for p in bundle.rglob("*") if p.is_file() and not p.is_symlink()]
sizes = sorted(((p.stat().st_size, p) for p in files), reverse=True)
print(f"Ordinary file bytes: {sum(size for size, _ in sizes)}")
for size, filename in sizes[:20]:
print(f"{size:12d} {filename.relative_to(bundle)}")
For expected download and installation sizes, export the archive using Xcode's app-thinning options for all compatible device variants. Retain App Thinning Size Report.txt. Compare the same device variant across builds. When available, App Store Connect's processed build information is the stronger distribution measurement. An uploaded IPA or local .app size is not a substitute.
Apple size-report workflow
Remove known payload before changing the runtime
Inspect the largest resources and their project inclusion rules. Common candidates include duplicate images, unused fonts, sample datasets and content copied into the output by an overly broad build rule. Remove an item only after establishing that the application does not need it. Rebuild and exercise the affected feature, including localized or offline paths.
Keep a small comparison ledger with the change, local bundle bytes, compressed and uncompressed size for one fixed variant, and regression-test result. Change one mechanism at a time. If native code dominates, an image edit may have little effect. If media dominates, a runtime switch may address the smaller part of the package.
Evaluate trimming deliberately
Inspect the effective trim mode before assuming trimming is disabled. For a compatible .NET MAUI application, full trimming is configured with TrimMode set to full. It removes unused code more aggressively than partial trimming. Resolve trim warnings and test code paths involving reflection, serialization and dynamically located types. Do not condition full trimming only on Release, because trim-related feature switches should remain consistent. Do not override PublishTrimmed simply to imitate a desktop recipe.
MAUI trimming guidance
Native AOT is a separate deployment choice with compatibility requirements, not a guaranteed percentage reduction. For a MAUI project, enable the analyzers and iOS deployment mode as documented:
<PropertyGroup>
<IsAotCompatible>true</IsAotCompatible>
<PublishAot Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">true</PublishAot>
</PropertyGroup>
Publish, resolve trimming and AOT warnings, and test the actual device artifact. Native AOT performs full trimming itself, so do not add a separate TrimMode setting for that deployment. Compare the resulting distribution measurement with the baseline before accepting the change.
Native AOT guidance
This is a newly authored response to Herman Schoenfeld's historical application-size question , recorded under CC BY-SA 3.0 . That question supplies the motivation, not a current benchmark. No application-size improvement or iOS build result is claimed here without running this workflow on the actual application.
Author: Herman Schoenfeld