Sociable

Friday, January 23, 2009

Script to Create Web Service Proxy and Assembly

We are working on a project where some developers have the full-blown Visual Studio 2008 Pro, and others are using the C# Express Web edition. Because we are integrating with another .NET project that we do not own, we had to give our Express Edition users the ability to easily create proxies for web service calls. Here is my solution:

The following batch file will create the proxy .cs file, as well as compile it into an assembly. Simple, but useful.

Prerequisites:
Windows SDK for Windows Server 2008 and .NET Framework 3.5:
http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en

Batch File:
set path=C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;%PATH%
wsdl.exe %1 /out:%2
csc.exe /t:library /out:%3 %2

Usage:
mybatchfile url .csFileName assemblyFileName

0 comments: