我们正在使用WCF服务来获取操作。我知道如何使用svutil.exe工具以编程方式生成WCF服务的元数据。我不知道怎么用SLsvcutil.exe工具来做。我需要在C#中以编程方式创建由slsvcutil.exe自动生成的代码。
有没有人知道这个?
发布于 2012-07-19 20:54:31
最后,我获得了使用Silverlight service Model Proxy Generation tool (SLsvcUtil.exe)从服务元数据文档生成Silverlight客户端代理的输出,或者只使用C#代码而不打开该工具,并在该工具上键入命令。
下面是slsvcutil.exe的简单C#.NET源代码:
string arguments = string.Empty;
string SvcUtilPath = string.Empty;
SvcUtilPath = @"C:\Program Files\Microsoft SDKs\Silverlight\v5.0\Tools\SlSvcUtil.exe";
arguments += @"http://localhost:3628/WCFservices/CompilerHelper.svc?wsdl ";
arguments += @"/out:C:\Clients_FIles\ClientProxy.cs ";
arguments += @"/edb /namespace:*,ClientProxy ";
arguments += @"/ct:System.Collections.ObjectModel.ObservableCollection`1 ";
arguments += @"/r:""C:\Program Files\Microsoft Silverlight\5.1.10411.0\System.Windows.dll"" ";
Process process_ = new Process();
process_.StartInfo.FileName = SvcUtilPath;
process_.StartInfo.Arguments = arguments;
process_.StartInfo.ErrorDialog = true;
process_.StartInfo.UseShellExecute = false;
process_.Start();
process_.WaitForExit();使用System.Disagnostics.Process命名空间,我们可以调用slsvcutil.exe文件并运行参数来生成任何服务文件的silverlight服务模型代码。
谢谢,普拉巴卡兰G。
https://stackoverflow.com/questions/11536582
复制相似问题