asp.net-mvcweb-configweb.config-transform

ASP.NET MVC config transformations not applying to project.dll.config


I have recently set up a transformation for new configuration profile, named Local, with an output directory of bin\. A new file name Web.Local.config was introduced into the project named Project1.

This file has a transformation of SetAttribute on a connection string as follows:

<add name="DefaultConnection" 
     connectionString="Data Source=potato;Initial Catalog=potato;Integrated Security=false;user Id=potatouser;password=" 
     providerName="System.Data.SqlClient" 
     xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

I'm debugging locally with IISExpress, and can see that during debug time that its sourcing configs from Project1.dll.config, which has the untransformed value. I need the transformed value. Interestingly bin\web.config has the correct attribute for DefaultConnection.

How do I get the transformations to apply to all .config files, and not just the web.config?


Solution

  • Looks like this isn't supported in this scenario by default. Had to add and configure SlowCheetah for this, and then had follow this answer too