Captain0
Captain0

Reputation: 2623

web.config transforms - appSettings node does not transform

I have got appSettings that i would like to share between multiple web applications. So at my root level for my solution, i created a folder "Common ConfigSettings". In here i have all the common appSettings that gets shared. Then in the different web projects, i add a link to this file and reference the common settings like..

<appSettings file="../../Common ConfigSettings/sharedAppSettings.config">

This is working well while debugging. Now when I need to publish, the "linked" file is copied to the directory for the relevant web project, so the file path needs to change now, to point to same directory as the projects web.config . But i can't get the transform to work.

I am trying to transform the "file" attribute on the appSettings in my web.Config. But id does not seem to work.

original web.config

 <appSettings file="../../Common ConfigSettings/sharedAppSettings.config">
 </appSettings>

transform

<appSettings  file="sharedAppSettings.config"  xdt:Transform="SetAttributes(file)"   
</appSettings>

then when i click preview transform

 <appSettings file="../../Common ConfigSettings/sharedAppSettings.config">
 </appSettings>

Upvotes: 2

Views: 1586

Answers (1)

Captain0
Captain0

Reputation: 2623

Got this working now. Just removed the "(file)" from the xdt:transform

transform

<appSettings file="sharedAppSettings.config"  xdt:Transform="SetAttributes">
</appSettings>

result

<appSettings file="sharedAppSettings.config">
</appSettings>

thanks

Upvotes: 4

Related Questions