Set web.config transform in Asp.NET Core

后端 未结 8 1720
遥遥无期
遥遥无期 2021-01-04 10:54

I\'ve just came across with problem of web.config transformation in asp.net core.

There are two files: base web.config and web.prod-zone-a.config. My aim is to use t

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 11:31

    This worked for me:

    1. Add web.release.config file to the project root.
    2. In Visual Studio 2017, Publish using Web Deploy (make sure it is set to Release). Settings will automatically be picked up.

    Sample transformation:

        
        
            
              
                
                  
                
              
            
        
    

    Update: If you want to remove web.config.release file and others on publish, simply edit your .csproj file and add something like this:

      
        
        
      
      
        
        
      
    

提交回复
热议问题