简体   繁体   中英

Mono: Using nant 0.92 to compile c#

I had problem to run nant script in Mono framework.

I got this error when I run nant scipt with mono-3.5.

在此处输入图片说明

This is my nant scipt.

<target name="compile-libs" depends="prepare" description="Compile the libraries">
        <csc target ="library" output="${bin.lib.1}/lib.dll" debug="false">
        <sources>
                <include name="${src.lib.1}/${arg}/*"/>
        </sources>
      </csc>
</target>

what is wrong with it?

Then, I change to use bat file to compile c#. It works. However, It only executes the first command, then stoped.

echo compile lib1:
mcs /target:library /out:build\bin-lib-v1.0\lib.dll src-lib-v1.0\lib\%1\foo.cs
echo compile lib2:
mcs /target:library /out:build\bin-lib-v2.0\lib.dll src-lib-v2.0\lib\%1\foo.cs

The bat file only produced the first library. It did not echo "compile lib2".

Thanks in advanced!

if mcs is a bat file ( do where mcs to check if is mcs.bat ), in a bat file when you call another bat like

mcs /target:library /out:build\bin-lib-v1.0\lib.dll src-lib-v1.0\lib\%1\foo.cs

the execution of current bat stop, and pass to mcs.bat without returning back

you should do:

call mcs /target:library /out:build\bin-lib-v1.0\lib.dll src-lib-v1.0\lib\%1\foo.cs

instead of nant (if you prefer xml), just use msbuild ( xbuild on mono ), there is a similar CSC task, see http://msdn.microsoft.com/en-us/library/ms171479(v=vs.90).aspx

Best (IMHO) for more complex scenario, FAKE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM