开发者

How do i include references to web services in NANT or csc.exe?

Im trying to automate our build process. To do this i need to compile the app_code in a asp.Net website to a dll so i can run NUnit test against the code. Before you suggest that i just use a class library, i will say that i agree with you, my superiors however, take a different view and have vetoed the use of dlls in our web sites.

The problem i have is that the app_code classes reference web services. How do i get the csc task to include these when compiling the code into a class library? The nant target i have so far is:

<target name="Compile">
    <property name="nant.settings.currentframework" value="net-3.5" />
    <csc target="library" out开发者_StackOverflowput="DocSysAppCode.dll" debug="true">
      <sources>
        <include name="D:\Inetpub\DocSys\App_Code\Common\*.cs" />
        <include name="D:\Inetpub\DocSys\App_Code\DocSys\SiteLegislation.generated.cs" />
      </sources>
      <resources>
        <include name="D:\DocSysQueue\Web References\WS_DocSys\*.*" />
        <include name="D:\DocSysQueue\app.config" />
      </resources>
    </csc>
</target>

If there is another way of achieving my goals then please let me know.

Al


What you're most likely after is generating the web service proxy class and compiling that into into your project. To do this, have a look at the wsdl task that is part of NantContrib.

You'll be able to do something like the following:

<target name="generate-proxy"/>
    <wsdl path="${wsdl.url}" language="CS" namespace="svc" outfile="MyProxy.cs" verbose="true" />
</target>

You can then take the output of that task (MyProxy.cs) and compile it into your project.

<target name="Compile" depends="generate-proxy">
    <property name="nant.settings.currentframework" value="net-3.5" />
    <csc target="library" output="DocSysAppCode.dll" debug="true">
      <sources>
        <include name="MyProxy.cs" />
        <include name="D:\Inetpub\DocSys\App_Code\Common\*.cs" />
        <include name="D:\Inetpub\DocSys\App_Code\DocSys\SiteLegislation.generated.cs" />
      </sources>
    </csc>
</target>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜