How to add config transformations for a custom config file in Visual Studio?

后端 未结 5 2031
日久生厌
日久生厌 2020-12-03 06:58

The project I am working on involves reading a lot of service endpoints (url) from a config file. Since the list would be quite large I decided to keep them in a custom conf

5条回答
  •  悲哀的现实
    2020-12-03 07:37

    Visual Studio transforms only web.config files by default.

    If you need custom config file with transformation for DEV, UAT, PROD, etc environments, then try to

    1. Use custom extensions for Visual Studio like SlowCheetah - XML Transforms for Config transformation preview functionality.
    2. Add for the project from Nuget SlowCheetah to provide build in transformation.

    A little bit details:

    Add VS Extension SlowCheetah from Extensions and Updates

    Right click on your myconfig.config and choose add transorm:

    Inside each defined configurations insert your own transormation rulles like that:

    
      
        
      
    
    

    Hope it was helpful

提交回复
热议问题