【发布时间】:2010-03-12 17:27:24
【问题描述】:
我有一个混合 Java / C# 项目,并使用一个包含 csc 任务的 ant 脚本来编译 dll。这可行,但我收到警告
[csc] This task is deprecated and will be removed in a future version
[csc] of Ant. It is now part of the .NET Antlib:
[csc] http://ant.apache.org/antlibs/dotnet/index.html
如何替换 csc 任务?我当然可以使用 project.build 文件创建一个调用 nant 的 exec 任务,但感觉完全错误。
编辑澄清一下:我主要是在Linux上使用这个,编写Nant脚本来编译项目的C#部分是没有问题的。目前我从 Ant 脚本中调用它
<target name="build-mono-stuff">
<exec executable="nant">
<arg value="build-stuff"/>
</exec>
</target>
但我希望找到比调用 exec 更好的解决方案。
EDIT 2 所以我尝试让 .NET AntLib 中的 nant 工作。这是我走了多远:
<taskdef name="mono-compile" classname="org.apache.ant.dotnet.build.NAntTask">
<classpath location="lib/ant-dotnet-1.0.jar" />
</taskdef>
<target name="build-mono-stuff">
<mono-compile buildfile="mono.build"></mono-compile>
</target>
第一次运行:
[mono-compile] Cannot open assembly 'NAnt.exe': No such file or directory.
然后我将 Ubuntu nant 包中的 NAnt.exe 放入 PATH 中,我得到了
[mono-compile] The "nant" section in the NAnt configuration file (/bin/NAnt.exe.config) is not available.
有什么想法吗?
【问题讨论】:
-
而你指向的.NET Antlib 不适合?
-
我不确定,这是如何工作的。如果你能给我一个调用这个 .NET Antlib 任务的例子(如果可能的话,来自我的 ant 脚本),我会很高兴。