Deploy different WCF .svc files based on configuration
I have a Service1.svc
file that is a normal WCF service. If I deploy the WCF project it will happily copy the Service1.svc
file along with the binaries and the other files. So far, so good. What I want is, based on the selected build configuration, or some other trick, to publ开发者_运维知识库ish different contents for the Service1.svc
file.
Let's say I have a Service1.Conf1.svc
file and a Service1.Conf2.svc
file and two configurations (like Debug
or Release
) that are named Conf1
and Conf2
. When I click publish and have the Conf1
configuration selected, I want the publish folder to have a virtually created Service1.svc
file whose contents are from Service1.Conf1.svc
. When I click publish and have the Conf2
configuration selected, I want the publish folder to have a virtually created Service1.svc
file whose contents are from Service1.Conf2.svc
.
I would like to have this for the publish action, not the build action (which could be achievable by a post-build or pre-build event). The main purpose is to adjust the contents of the Service1.svc
file according to the publish environment.
Any ideas?
We took a different approach and generate all required config/svc files for all possible installs (using TT file generation) and let the installer copy the correct configs/svc files (based on user selection during install).
The names of the files are constructed by inserting the target platform name into the standard name e.g web.local.config, web.dev.config, web.test.config etc
This way you can give one installer to anyone from any department. They just choose the platform.
精彩评论