如何在 NANT 或 csc.exe 中包含对 Web 服务的引用?
我正在尝试自动化我们的构建过程。为此,我需要将 asp.Net 网站中的 app_code 编译为 dll,以便我可以针对代码运行 NUnit 测试。在你建议我只使用类库之前,我会说我同意你的观点,但是我的上级持不同的观点并否决了在我们的网站中使用 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>
如果有其他方法可以实现我的目标,请告诉我。
铝
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" 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>
If there is another way of achieving my goals then please let me know.
Al
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您最有可能要做的是生成 Web 服务代理类并将其编译到您的项目中。为此,请查看 wsdl 任务,该任务是 NantContrib。
您将能够执行如下操作:
然后,您可以获取该任务的输出 (MyProxy.cs) 并将其编译到您的项目中。
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:
You can then take the output of that task (MyProxy.cs) and compile it into your project.