The only way to do this is to run the ASMX through ASP.NET.
There are 2 approaches. One is to actually deploy the ASMX file into a
running IIS with ASP.NET installed, then just httpget the URL for thew WSDL,
eg
http://yourserver/vroot/Service1.asmx?WSDL
To get the WSDL in a build, you can use any command-line httpgetter utility,
even something as simple as this javascript:
// getWSDL.js a simple command-line WSDL getter.
// Call it like this:
// cscript getwsdl.js <url>
//
// output goes to stdout.
//
var XMLDoc, XSLDoc ;
XMLDoc = WScript.CreateObject("MSXML2.DOMDocument") ;
XMLDoc.async= false;
XMLDoc.load(WScript.Arguments(0)); // exception here if the ASMX does not
compile successfully. The result is not XML, it is HTML !!
WScript.Echo(XMLDoc.xml);
WScript.Echo("");
Option 2 is to build a utility to host ASP.NET, and compile the ASMX, and
produce the WSDL. In this case you wouldn't need IIS, but you'd need to
build this util yourself. This is attractive, because you do not need to
deploy to IIS. However, the catch is that since you are not deploying to
your server, you have to be concerned about the availability of libraries
that may be referenced by the ASMX.
Search for articles on "hosting the ASP.NET runtime" to explore this.
eg,
http://www.neward.net/ted/Papers/HostingASPNET/HostingASPNET.html
Here is an simplistic example console utility that hosts the ASP.NET
runtime, compiles an ASMX and produces the WSDL on the console.
http://www.winisp.net/cheeso/srcview.aspx?file=asmx2wsdl.cs
Cassini is an example of a pre-built server that hosts ASP.NET (and source
code is available). Using a server might be more attractive because the
startup time of an ASP.NET host is significant. A server that runs
continuously only incurs this cost once (at startup). A command line util
that hosts ASP.NET must incur the cost with every invocation.
Using Cassini to produce WSDL from ASMX is very much like using IIS to do
the same, except, it is not the full IIS. This may be a good thing or a bad
thing depending on your requirements.
Find more about cassini on
http://www.asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1
-Dino