3

ビルドプロセスを自動化しようとしています。これを行うには、asp.Net Web サイトの app_code を dll にコンパイルして、コードに対して NUnit テストを実行できるようにする必要があります。クラス ライブラリのみを使用することを提案する前に、私はあなたに同意しますが、私の上司は別の見方をしており、当社の Web サイトでの dll の使用を拒否しました。

私が抱えている問題は、app_code クラスが Web サービスを参照することです。コードをクラス ライブラリにコンパイルするときに、csc タスクにこれらを含めるにはどうすればよいですか? 私がこれまでに持っているナントターゲットは次のとおりです。

<target name="Compile">
    <property name="nant.settings.currentframework" value="net-3.5" />
    <csc target="library" output="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>

私の目標を達成する別の方法があれば、教えてください。

アル

4

1 に答える 1

1

最も可能性が高いのは、Web サービス プロキシ クラスを生成し、それをプロジェクトにコンパイルすることです。これを行うには、 NantContribの一部であるwsdlタスクを見てください。

次のようなことができるようになります。

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

その後、そのタスク (MyProxy.cs) の出力を取得して、プロジェクトにコンパイルできます。

<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>
于 2010-11-24T19:37:06.703 に答える