Thursday, August 13, 2009

Two .bat files for generating WCF proxies using SVCUTIL

I have wrapped my svcutil commands to generate proxies for my services in two .bat files which help me to generate my proxies without entering the syntax for the command every time I want to generate my proxies.

A simple proxy generating command file looks like

@echo off

:: The batch file generates a WCF proxy file based on the parameters passed to it

:: The command generate C# code files be default

:: Usage

:: SvcHelper <> <> <>

:start

if "%1"=="" goto error

if "%2"=="" goto error

if "%3"=="" goto error

svcutil /l:cs /ct:System.Collections.Generic.List`1 /n:*,%3 %1 /out:%2

:error

echo usage "SvcHelper <> <> <>"

Copy the content into a .bat file and name if SvcHelper.bat and use that for proxy generation.

The one used to generate proxies for WPF client with async option turned on looks like.

I have wrapped my svcutil commands to generate proxies for my services in two .bat files which help me to generate my proxies without entering the syntax for the command every time I want to generate my proxies.

A simple proxy generating command file looks like

@echo off

:: The batch file generates a WCF proxy file based on the parameters passed to it

:: The command generate C# code files be default

:: Usage

:: SvcHelper <> <> <>

:start

if "%1"=="" goto error

if "%2"=="" goto error

if "%3"=="" goto error

svcutil /l:cs /ct:System.Collections.Generic.List`1 /n:*,%3 %1 /out:%2

:error

echo usage "SvcHelper <> <> <>"

Copy the content into a .bat file and name if SvcHelper.bat and use that for proxy generation.

The one used to generate proxies for WPF client with async option turned on looks like.

@echo off

:: The batch file generates a WCF proxy file based on the parameters passed to it

:: The command generate C# code files be default

:: Usage

:: SvcHelperWPFAsync <> <> <>

:start

if "%1"=="" goto error

if "%2"=="" goto error

if "%3"=="" goto error

svcutil /t:code %1 /out:%2 /n:*,%3 /async /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"C:\Progra~1\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /l:cs

:error

echo usage "SvcHelperWPFAsync <> <> <>"

No comments: