What I'm trying to do
Currently we have duplicate WCF config settings in several projects in our solution. I want to store the WCF config values in one file which can be then referenced from as many projects as necessary. The config file must transformable to allow for different values in different enviroments.
What I've tried
I've done some research other people have tried something similar with SlowCheetah and linked files. So this is what I've tried to do. It's worth noting that our solution contains a lot of projects, some MVC3, some console apps and some class libraries.
- I've created a Wcf.Client.config file, added it to a common class library and added transforms to it using SlowCheetah
- I want to reference this file in an MVC3 project so I've created a link to the config file
- In the web.config file of the MVC3 project I've added a group containing a client element with the configSource attribute set to "Wcf.Client.config"
- I've set the "Copy to output directory" property of the linked config file to "Copy if newer"
- I also added a transform to the linked file (I wasn't sure this would work but it succesfully linked the files)
The problem
I have transforms for local and development environments. Unfortunately when I run the web application (or publish it) in the developer configuration the transforms are not picked up. Looking at the pubished files I can see that the linked file that I placed in the root of the web project has been successfully transformed, but, it is read from the bin folder, and the file in the bin folder is not tranformed.
What am I actually asking?
What I really want to know is, what am I doing wrong? Has anyone tried what I've described above and made it work? Or failing that has anyone found another way to share transformed config files?
Some code
I've created a very simple test project which hopefully will explain what I'm trying to do better than my rambling explanation. Feel free to have a look. If you build or publish it you'll see the Wcf.Client.config file in the bin folder of the MVC3 project has not been transformed.