我正在尝试自动化我们的构建过程。为此,我需要将asp.Net网站中的app_code编译为动态链接库,以便对代码运行NUnit测试。在你建议我只使用一个类库之前,我会说我同意你,我的上级,持不同的观点,并在我们的网站上否决了dll的使用。
我遇到的问题是app_code类引用了web服务。在将代码编译到类库中时,如何让csc任务包含这些内容?到目前为止,我的nant目标是:
<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>如果有其他方法来实现我的目标,请让我知道。
阿尔
发布于 2010-11-25 03:37:07
您最可能需要的是生成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>https://stackoverflow.com/questions/4257397
复制相似问题