NAnt 和 ASP.NET 编译器
我有一个构建脚本成功运行,但在 aspnet_compiler 完成后我很难运行任何东西。我想使用 robocopy 将项目复制到另一个文件夹。如果我将复制任务放在编译之上(如下所示),我会将消息发送到控制台,但如果我将其放在编译之后,则看不到该消息。我错过了什么吗?我是否需要检查编译器的返回代码才能在完成后调用任务?
<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 下面时,我会更改 dependent="precompile-web" 并且编译任务取决于“init”。
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'
/>
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".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我在这里理解正确的话,您想要:
是这样吗?我本以为你会想这样做:
如果我的方法是正确的,那么我猜你想要你的目标像这样互相引用吗?
这样,您就不会将每个目标都依赖于其他目标(以便重复使用),而是获得完成手头工作所需的命令。
对你有什么好处吗?
If I understand you correctly here, you want to:
Is that right? I would have thought you'd want to do it this way around:
If my way is correct, then I'd guess you'd want your targets to reference each other like this?
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.
Any good to you?