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 config file to keep my web.config clean and small. I included the custom section to my web as below:
<mySection configSource="myConfig.config" />
I works perfectly fine.
But the problem of transformation appears during the deployment of the project to different environments. I have three web.config files:
Web.config
Web.Uat.config
Web.Release.config
While the transformation web.config works, the transformations for custom config files fails at deployment.
Is there an way I can transform the custom config file during deployment?
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
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:
<services xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<service name="WebApplication1.Services.Service2" xdt:Transform="Replace" xdt:Locator="Match(name)" >
<endpoint address="http://localhost:57939/Services/DebugService" behaviorConfiguration="WebApplication1.Services.Service2AspNetAjaxBehavior"
binding="webHttpBinding" contract="WebApplication1.Services.Service2" />
</service>
</services>
Hope it was helpful