通过命令行或以编程方式检索并生成WCF Reference.svcmap?

时间:2013-09-11 20:35:19

标签: c# wcf visual-studio-2012

通常当我更新/添加新服务引用时,我会在Visual Studio的解决方案资源管理器中执行此操作(更新服务引用/添加服务引用),但是对于需求,我必须立即使用命令行或以编程方式执行此操作

我读到了这个:http://msdn.microsoft.com/en-us/library/ms729834.aspx

它允许我检索元数据,但它不像我们在Visual Studio中那样生成Reference.svcmap

是否有任何工具或库可以做到这一点?

1 个答案:

答案 0 :(得分:0)

使用开发人员命令提示符:

" C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ Tools \ VsDevCmd.bat"

svcutil http://www.webservicex.net/sendsmsworld.asmx

svcutil /t:metadata http://www.webservicex.net/sendsmsworld.asmx

这将产生:

output.config  
SendSMSWorld.cs  
www.webservicex.net.wsdl  

我不确定svcmap,这似乎是来自Visual Studio的东西

                   -= EXAMPLES =-

 svcutil http://service/metadataEndpoint
    - Generate client code from a running service or online metadata documents.

 svcutil *.wsdl *.xsd /language:C#
    - Generate client code from local metadata documents.

 svcutil /dconly *.xsd /language:VB
    - Generate Data Contract types in VisualBasic from local schema documents.

 svcutil /t:metadata http://service/metadataEndpoint
    - Download metadata documents from running services

 svcutil myAssembly.dll
    - Generate metadata documents for Service Contracts and associated types in
    an assembly

 svcutil myServiceHost.exe /serviceName:myServiceName
    - Generate metadata documents for a service, and all associated Service
    Contracts and data types in an assembly

 svcutil myServiceHost.exe /dconly
    - Generate metadata documents for data types in an assembly

 svcutil /validate /serviceName:myServiceName myServiceHost.exe
    - Verify service hosting

 svcutil /t:xmlserializer myContractLibrary.exe
    - Generate serialization types for XmlSerializer types used by any Service
    Contracts in the assembly