Search code examples
c#.netbuildlocalization.net-assembly

Omit localized versions of assemblies from the build output


In one of my projects, I am using an awesome library called Humanizer. This library comes in many language variations (I counted 38).

When I build my project, I then see all these folders like "af", "ar", "bg", "bn-BD", ..., "zh-Hant" with assemblies containing the localized resources for this library.

My issue is that my project is English-only and I have no interest in having all those localized assemblies in my build output. Is there some good way of omitting them from the build?

I am looking for general solutions to this problem. It happens with libraries other than Humanizer, like DevExpress Controls etc., which are not open-source.


Solution

  • With the latest msbuild you can simply put this into your .csproj file:

    <PropertyGroup>
      <SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
    </PropertyGroup>
    

    See dotnet/sdk/issues/774