是否可以从 VS2010 插件刷新 WCF 服务引用?
我想在 VS2010 插件中“模拟”右键单击/更新服务引用命令。我有一个对包含 (Silverlight...) 项目的引用,我知道服务引用的名称和服务的 url。
我发现了这个: http://dedjo .blogspot.com/2007/03/adding-web-references-to-your-vs.html,但它仅适用于asmx(它使用System.Web.Services而不是System.ServiceModel),不适用于wcf 。 是否有任何选择但是从代码中调用 svcutil ?如果是这样,怎么办? (我使用 svcutil 还是 slsvcutil?如何从插件内部调用它?)
谢谢
I want to "simulate" the Right click/Update service reference command in a VS2010 addin. I have a reference to the containing (Silverlight...) project, I know the name of the service reference and the url of the service.
I've found this: http://dedjo.blogspot.com/2007/03/adding-web-references-to-your-vs.html , but it only works for asmx (it uses System.Web.Services instead of System.ServiceModel), not wcf.
Is there any choice but call svcutil from code? if so, how? (do I use svcutil or slsvcutil? How do I call it from inside the addin?)
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信 Visual Studio 的命令是“
Project.UpdateServiceReference
”。所以我想你可以尝试选择你感兴趣的节点,然后运行这个命令,如下所示:I believe the visual studio command for this is "
Project.UpdateServiceReference
". So I guess you can try to select the node you're interested in, and run this command, like this:如果您正在寻找更具编程性的方法来执行此操作,您可以执行以下操作。此方法不需要使用 DTE 自动化层,该层将更改用户的选择并执行命令。请注意,这是在带有 IServiceProvider 的 VSPackage 上下文中,以便它可以获取核心 Visual Studio 接口的实例等...
您也可以从外接程序中执行此操作,但是 您需要获取 IServiceProvider 并添加对(至少) Microsoft.VisualStudio.Shell.Interop.dll 和 Microsoft.VisualStudio.WCFReference.Interop。这些二进制文件的参考程序集可在 Visual Studio 2010 SDK 中找到。
我还建议查看 Visual Studio 2010 SDK 的 WCF 服务使用工具示例。
If you're looking for the more programmatic way to do this, you can do something like the following. This approach does not require using the DTE automation layer which will change the user's selection and execute a command. Note that this is within the context of a VSPackage with an IServiceProvider so that it can get instances to the core Visual Studio interfaces, etc...
You may also be able to do this from within an Addin, but you'd need to get an IServiceProvider and add references to (at least) Microsoft.VisualStudio.Shell.Interop.dll and Microsoft.VisualStudio.WCFReference.Interop. Reference assemblies for these binaries are available in the Visual Studio 2010 SDK.
I'd also recommend looking at the WCF Service Consumption Tools samples for the Visual Studio 2010 SDK.