Disable Dll Culture Folders on Compile
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When building .NET applications, satellite assemblies for localized resources (e.g., fr/, de/, es/ folders) are created in the output directory. To disable these culture folders, exclude unwanted resource assemblies from NuGet packages in your .csproj file using <ExcludeAssets> or <SatelliteResourceLanguages>. This reduces deployment size and simplifies the output directory for applications that do not need multi-language support.
The Problem
After building a .NET project, the output directory contains folders like:
These folders contain satellite assemblies — localized resource DLLs for NuGet packages. Most applications only need one or two languages.
Fix 1: SatelliteResourceLanguages (Recommended)
Add <SatelliteResourceLanguages> to your .csproj to keep only specific languages:
This removes all culture folders except the specified languages. Setting it to en effectively removes all folders since English is the default embedded in the main assembly.
Fix 2: ExcludeAssets on Specific Packages
If only certain NuGet packages produce unwanted culture folders:
Or exclude only satellite assemblies from specific packages:
Fix 3: Delete in Post-Build Event
For cases where MSBuild properties do not work:
Or use a simpler post-build command:
Fix 4: Directory.Build.props (Solution-Wide)
Apply to all projects in a solution by creating a Directory.Build.props file at the solution root:
Every project in the directory tree inherits this setting automatically.
Fix 5: Publish with Trimming
When publishing, you can control which resources are included:
Verifying the Fix
When You Need Culture Folders
If your application supports multiple languages, keep the culture folders for those languages:
Common Pitfalls
- Removing all languages when localization is needed: Setting
SatelliteResourceLanguages=enremoves all non-English resources. If your app displays localized text from NuGet packages (e.g., validation messages from ASP.NET), users see English regardless of their locale. - Culture folders reappearing after
dotnet restore: NuGet restores satellite assemblies on every restore. MSBuild properties likeSatelliteResourceLanguagesare the correct fix because they filter during build, not by deleting files afterward. - Post-build scripts not running in CI: Post-build events may use Windows-specific commands (
for /d,rd) that fail on Linux CI agents. Use MSBuild targets with<Delete>and<RemoveDir>tasks for cross-platform compatibility. - Confusing satellite assemblies with your own resources:
SatelliteResourceLanguagesaffects both your project's resource files (.resx) and NuGet package satellite assemblies. If you have your own French resources, settingSatelliteResourceLanguages=enremoves them too. - Breaking runtime behavior silently: Removing satellite assemblies does not cause exceptions. Instead, the application silently falls back to the default (invariant/English) culture. This can be hard to detect in testing if you do not explicitly test with non-English locales.
Summary
- Add
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>to.csprojto remove all culture folders - Use
Directory.Build.propsto apply the setting across all projects in a solution - Specify multiple languages (
en;fr;de) if your app needs localization for those cultures - Avoid post-build delete scripts — use MSBuild properties for reliable cross-platform behavior
- Verify the output with
dotnet buildand check the output directory for remaining culture folders

