【发布时间】:2019-08-02 15:58:27
【问题描述】:
我已经制作了我的第一个概念验证 ASP.NET Core 应用程序,我有 5 个 appsettings 文件:
- appsettings.json
- appsettings.Development.json
- appsettings.Test.json
- appsettings.Staging.json
- appsettings.Production.json
我在 IIS 中运行应用程序,所以我实际上有 web.config 文件,这样我就可以为每个应用程序设置 ASPNETCORE_ENVIRONMENT 环境变量:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<aspNetCore processPath="dotnet" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development"></environmentVariable>
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
我有 4 个 web.config 转换,因此我可以从 Visual Studio 发布,它会为每个环境设置正确的环境变量值。
当我发布到每个环境时,虽然它发布了所有 appsettings 文件。是否可以在根 appsettings.json 和适用环境特定的一个上发布它,但忽略其他?
【问题讨论】:
标签: asp.net-core web-deployment msdeploy