2

Some of my NuGet packages required Microsoft.CodeAnalysis.resources.dll and Microsoft.CodeAnalysis.CSharp.resources.dll so I installed them.

However, when I build the project, in the Debug folder comes many folders.

And in each of the folders, there was

I don't need them, because I only want to display the English language, I want all other folders to be cleared.

I manually deleted them and ran the application, it worked fine but I'm afraid if I am running it on a France language Win system, it will pop up an error because the "fr" folder is missing.


Also tried adding [assembly: NeutralResourcesLanguage("en")] in AssemblyInfo.cs, adding <SatelliteResourceLanguages>en</SatelliteResourceLanguages> under <PropertyGroup>. But those folders were still created at the build time.

I am using Visual Studio 2019.

Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66

1 Answers1

5

Try to add the following target to csproj file, where the Nuget package is used

<Target Name="RemoveSatelliteAssemblies" AfterTargets="ResolveAssemblyReferences">
  <ItemGroup>
    <ReferenceCopyLocalPaths Remove="@(ReferenceSatellitePaths)" />
  </ItemGroup>
</Target>

It'll remove all unnecessary satellite assemblies. If there is a problem with French language, you should leave the target language assemblies

Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66