1

We are using WCF service to get the operation. I know, how to programmatically generate metadata of WCF service using svutil.exe tool. I dont know how to do it with SLsvcutil.exe tool. I need to create auto generated code by slsvcutil.exe programmatically in C#.

Plz any body know this ?

  • With or without SLsvcutil? You seem to contradict yourself. – H H Jul 18 '12 at 07:49
  • And since it's about SL, what trust-level is available? – H H Jul 18 '12 at 07:56
  • Without slsvcutil, but programmatically. No need to open slsvcutil tool, create code by C# .NET . – PRABAKAR GOVIND Jul 18 '12 at 09:10
  • Usually, we will open Visual stdio command prompt 2010 (svcutil.exe) tool for download service metadata and auto generated code will create by this tool. [ svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service ] by this command code. System.CodeDom.Compiler.CodeGenerator namespace is used to create auto generate code programmatically. I need, How to do it using slsvcutil.exe tool for silverlight 4.0 applications programmatically ?. How to create auto generate code using C# source code for slsvcutil.exe tool ? – PRABAKAR GOVIND Jul 18 '12 at 13:30
  • Ï don´t know SL very well, in the normal Fx you can use `System.Disagnostics.Process.Start()`. But it may be missing in SL or your app may not be allowed to run any program... – H H Jul 18 '12 at 15:40
  • Hmmm..Ok. Is there any alternative solution for this ? – PRABAKAR GOVIND Jul 19 '12 at 06:12
  • rethink what you are actually looking for, then google first. – H H Jul 19 '12 at 06:57
  • Thank you for your response, I got output using System.Disagnostics.Process namespace for silverlight4.0 application by slsvcutil.exe tool – PRABAKAR GOVIND Jul 19 '12 at 11:52
  • System.Disagnostics.Process namespace for svcutil tool, wht is the namespace for slsvcutil tool of silverlight application ? Need it plz. – PRABAKAR GOVIND Jul 20 '12 at 09:14
  • Don't ask questions in the comments. – H H Jul 20 '12 at 10:41

1 Answers1

2

Finally, I got output to generate Silverlight client proxies from service metadata documents using the Silverlight Service Model Proxy Generation Tool (SLsvcUtil.exe) dynamically or using C# code only without open and type the commands on that tool.

Here is the simple C#.NET source code for slsvcutil.exe :

        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();

Using System.Disagnostics.Process namespace we can call slsvcutil.exe file and run the arguments to generate silverlight service model code of any(WCF) service file.

Thanks, PRABAKARAN G.