简体   繁体   中英

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM