How to publish environment specific appsettings in .Net core app?

后端 未结 12 2427
刺人心
刺人心 2020-12-04 15:33

I have 3 environment specific appsettings files in my .Net core application

in project.json I have setup publishOptions

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 16:14

            Consider you have multiple appsettings: dev,pre,prod. 
        You can have below configuration in your web project file.
    
             
              
                
                
              
              
                
                
                
              
              
                
                
                
              
    
            This confguration will help during publish. 
        It will not copy the appsettings which is not required for that environment.
    
            EnvironmentName (part of  ) 
    highlighted above should be passed as parameter in below command.
    
            dotnet publish -o ../../published/20191118A -c release /p:EnvironmentName=Development
    

提交回复
热议问题