是否有一种简单的方法可以将服务引用添加到一个程序集中,但将客户端配置保留在另一个程序集中?

发布于 2024-11-29 01:42:28 字数 141 浏览 0 评论 0原文

我知道简单添加 WCF 服务引用的缺点(稍后我打算以另一种方式创建客户端代理),但现在我需要添加对 Silverlight 程序集的服务引用,但将配置添加到主 UI 程序集,以便它将被打包到 .xap 文件中。有没有简单的方法可以做到这一点?

I'm aware of the drawbacks of simply adding WCF service references (later I intend to create client proxies another way), but for 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人九事 2024-12-06 01:42:29

事实证明评论中的漩涡是正确的。经过一番实验后,我失去了这个解决方案。我还忘记提及我正在使用 .csproj 文件中的 xml 转换任务。

我的最终解决方案是这样的:

  1. 在Silverlight服务客户端程序集中,照常添加WCF引用。
  2. 为每个构建配置添加 ServicesReferences.Configuration.ClientConfig
  3. 在 .csproj
  4. 主 Silverlight UI 程序集中添加为链接之前/之后添加构建转换目标。
  5. 建造。 Silverlight Web 程序集使用正确的 ServiceReferences.ClientConfig 文件为该配置创建 .xap。

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:

  1. In Silverlight service client assembly, add WCF references as usual.
  2. Add a ServicesReferences.Configuration.ClientConfig for each build configuration
  3. Add before/after build transform targets in the .csproj
  4. Add as Link in the main Silverlight UI assembly.
  5. Build. The Silverlight Web assembly creates the .xap for that configuration with the right ServiceReferences.ClientConfig file.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文