Warm tip: This article is reproduced from serverfault.com, please click

ASP.Net Core exclude published language directories other than english

发布于 2020-02-21 00:43:47

I publish my ASP.Net Core 3.1 Server like this:

dotnet publish --configuration Release --runtime win7-x64 -p:PublishTrimmed=true --output c:\MyServer

What I get in c:\MyServer is a lot of international language directories: cs, de, es, fr, zh-hans etc

How can I publish with only the English version ?

I tried using ExcludeFoldersFromDeployment in my csproj:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>    
    <AspNetCoreHostingModel>inprocess</AspNetCoreHostingModel>
    <Nullable>enable</Nullable>
    <ExcludeFoldersFromDeployment>cs;de;es;fr;he;hi;it;ja;ko;nl;pl;pt;ru;tr-TR;zh-Hans;zh-Hant</ExcludeFoldersFromDeployment>
  </PropertyGroup>

But that didn't help

Any help ?

Questioner
kofifus
Viewed
0
RenanStr 2020-11-28 19:50:41

Edit your .csproj and add the following line to a PropertyGroup:

<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

It should publish only the selected language resource folder.