Search code examples
c#buildnantcsproj

C# nant build using .csproj files


Typically when doing a build script for C# I just include **/*.cs for each project/dll to build. However I now have a situation where I have some .cs files which are not part of the project but live in that directory (they are there for reference purposes from another library). There are not linked in the .csproj file so the VS build works fine but the nant build does not.

Does anyone know if there's a nice easy way of pulling the .cs entries out of the relevant .csproj file and using that as the list of source files to build rather than using a general wildcard match.

Thanks in advance.


Solution

  • Any particular reason you don't want to use msbuild just for the C# build bit? That's what I do for my Protocol Buffers port, and it works well. It does require nant-contrib, but that's not much of a hardship.

    That way you know you only need to get one thing working, and know it'll be built the same way.

    You can have a look at my ProtoBuf port build file here, for inspiration. The obvious downside is Mono support, but I believe xBuild is improving...