I'm aware of the drawbacks of simply adding WCF service references (later I intend to create client proxies another way), but for开发者_JS百科 now I need to add a service reference to a Silverlight assembly but the config to the main UI assembly so that it will be packaged into the .xap
file. Is there an easy way to do this?
vorrtex in the comments turns out to be right. I lost sight of that solution after a bit of experimentation. I had also forgotten to mention that I was using the xml transformation tasks in the .csproj
file.
My final solution is this:
- In Silverlight service client assembly, add WCF references as usual.
- Add a ServicesReferences.Configuration.ClientConfig for each build configuration
- Add before/after build transform targets in the .csproj
- Add as Link in the main Silverlight UI assembly.
- Build. The Silverlight Web assembly creates the .xap for that configuration with the right ServiceReferences.ClientConfig file.
精彩评论