南特和ASP.NET编译 [英] NAnt and ASP.NET Compiler
问题描述
我有一个生成脚本成功运行,但我有aspnet_compiler完成后运行的任何一个困难时期。我想使用的Robocopy的项目复制到另一个文件夹。如果我把复制任务编译以上(如下图所示),我得到消息到控制台,但如果我编译后把它放在它没见过。我缺少的东西吗?我是否需要检查从编译器返回code竣工后打电话到任务?
I have a build script running successfully, but I am having a hard time running anything after aspnet_compiler completes. I want to use robocopy to copy the project to another folder. If I put the copy task above the compile (as shown below) I get the message to the console, but if I place it after the compile it is not seen. Am I missing something? Do I need to check for a return code from the compiler to call tasks after its completion?
<target name="copy" depends="init">
<echo message="This is my message for robocopy..."/>
</target>
<target name="compile" depends="copy">
<exec program="${msbuild.exe}"
commandline='MySolution.sln /p:Configuration=${Configuration};OutDir="${build.dir}\\"' />
</target>
<target name="precompile-web" depends="compile">
<exec program="${aspnet_compiler.exe}"
commandline='-v /MyProj-p "${build.dir}"\_PublishedWebsites\MyProj.Web'
/>
是的,当/如果我谨低于precompile的Web副本任务,我改变取决于=precompile-网和编译任务依赖于初始化。
And yes, when/if I move the copy task below precompile-web I change the depends="precompile-web" and the compile task depends to "init".
推荐答案
如果我理解正确这里,你想:
If I understand you correctly here, you want to:
- 复制文件
- 使用的MSBuild编译它们
- precompile他们的网络
是吗?我本来以为你会想围绕做这种方式:
Is that right? I would have thought you'd want to do it this way around:
- 编译使用的MSBuild文件
- precompile他们的网络
- (由IIS等使用)其他地方复制文件
如果我的方式是正确的,那么我猜你会想你的目标,相互引用这样?
If my way is correct, then I'd guess you'd want your targets to reference each other like this?
<target name="compile-and-publish" depends="compile,precompile-web,copy" />
<target name="compile">
<exec program="${msbuild.exe}" commandline='MySolution.sln /p:Configuration=${Configuration};OutDir="${build.dir}\\"' />
</target>
<target name="precompile-web">
<exec program="${aspnet_compiler.exe}" commandline='-v /MyProj-p "${build.dir}"\_PublishedWebsites\MyProj.Web' />
</target>
<target name="copy" depends="init">
<echo message="This is my message for robocopy..."/>
</target>
这样,你不寄希望于你的每一个目标到依赖于其他目标(再利用),但你得到你需要实现手头的工作秩序。
This way, you're not pinning each of your targets down to relying upon other targets (for re-use) but you get the order that you need to achieve the job at hand.
什么好处吗?
这篇关于南特和ASP.NET编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!