Disable Dll Culture Folders on Compile
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
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
Related reading
- Disable HttpClient logging
- Disable JavaScript error in WebBrowser control
- Disable SSL fallback and use only TLS for outbound connections in .NET? Poodle mitigation
- Disable Visual Studio devenv solution save dialog
- Dispatcher.CurrentDispatcher vs. Application.Current.Dispatcher
- DispatcherTimer vs a regular Timer in WPF app for a task scheduler
- Display a tooltip over a button using Windows Forms
- Display lines number in Stack Trace for .NET assembly in Release mode

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.