I mentioned a couple days ago that my current project is based on a C# and ASP.NET. I don’t have access to Visual Studio (should I try to get it? is it worth it?) so I’ve been using the Improv C# plugin with Eclipse. The combination works alright, but there are a couple things that need improvement. First, when compiling an assembly in C#, you have to specify each module that it references per class, there isn’t a way to to say that MyProject.dll should be included in the classpath for the entire C# project. Second, there’s no way to say that you want all the compiled assemblies to be placed in ../classes/ instead of ../build (ie: you can’t specify an output folder). But that’s where NAnt comes to the rescue. I downloaded NAnt today and was able to get a build script running within a couple minutes that accomplishes the two things I needed above.

I do have a question for those of you who have done .NET programming before. In Java, you compile .java files to .class files. Using C#, you compile a .cs file to a .dll (or .exe, etc..) which is called an assembly. Then in Java you’d usually package up your class files into a jar file. After using NAnt today, I see that you can compile a bunch of .cs files into a single dll, also called an assembly, which you can then use just like a jar file. Do I have that right? Are there different ways of doing this?

2 thoughts on “NAnt”

  1. Almost never would you want to compile each .cs file to its own assembly. You should consider assemblies to be at the same level of granularity as jar files.

    Also, you really REALLY need to get Visual Studio. At least get Visual C#, it’s only $100. Not that VS is the be-all end-all of IDE’s, but from what I’ve seen the free tools out there are not even close. And besides, VS is so close to a “standard” in the .NET community that you’ll need it if you want to compile code snippets or open-source libraries.

Leave a Reply

Your email address will not be published. Required fields are marked *