# IL2CPP error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Build\Temp\StagingArea\Data\Managed\System.dll'

- **ID:** `unity/il2cpp-error-marshal-directorynotfound`
- **Domain:** unity
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

The IL2CPP build process cannot find a required managed assembly (e.g., System.dll) in the staging area, often due to incomplete build cache or missing .NET backend files.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2022.3.30f1 | active | — | — |
| Unity 2023.2.5f1 | active | — | — |
| Unity 6000.0.0a20 | active | — | — |

## Workarounds

1. **Delete the 'Library' and 'Temp' folders in the project directory, then rebuild from scratch. This clears the corrupted build cache.** (80% success)
   ```
   Delete the 'Library' and 'Temp' folders in the project directory, then rebuild from scratch. This clears the corrupted build cache.
   ```
2. **In Project Settings > Player > Configuration, set 'Scripting Backend' to 'IL2CPP' and 'Api Compatibility Level' to '.NET Standard 2.1' (or '.NET Framework' if available). Then perform a clean build via Build Settings > Clean Build.** (70% success)
   ```
   In Project Settings > Player > Configuration, set 'Scripting Backend' to 'IL2CPP' and 'Api Compatibility Level' to '.NET Standard 2.1' (or '.NET Framework' if available). Then perform a clean build via Build Settings > Clean Build.
   ```

## Dead Ends

- **** — The issue is a corrupted build cache, not missing Unity components. (80% fail)
- **** — The staging area is regenerated each build; manual copies are overwritten or cause version mismatches. (95% fail)
- **** — This avoids the error but changes the runtime behavior and may not be acceptable for platforms requiring IL2CPP (e.g., iOS, WebGL). (50% fail)
