ASP.Net Core排除英语以外的已发布语言目录 [英] ASP.Net Core exclude published language directories other than english

查看:251
本文介绍了ASP.Net Core排除英语以外的已发布语言目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样发布我的ASP.Net Core 3.1 Server:

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

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

我在c:\ MyServer中得到的是很多国际语言目录:cs,de,es,fr,zh-hans等

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 ?

我尝试在csproj中使用ExcludeFoldersFromDeployment:

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>

但这没有帮助

有帮助吗?

推荐答案

如果您有对Microsoft.VisualStudio.Web.CodeGeneration.Design的项目引用,则在发布的输出中会得到很多包含CodeAnalysis.dll文件的语言文件夹,这是脚手架控制器所必需的.如果这对于您的项目是正确的,请在您的.csproj文件中更改程序包引用,使其包含ExcludeAssets ="All":

You get a lot of language folders containing CodeAnalysis.dll files in your published output if you have a project reference to Microsoft.VisualStudio.Web.CodeGeneration.Design, which is needed for scaffolding controllers. If that is true for your project, change the package reference in your .csproj file to include ExcludeAssets="All":

<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" ExcludeAssets="All"/>

请参阅 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆