Saturday, November 13, 2010

NANT: Exec a Target with Arguments

Recently I encountered an minor issue when I tried to use NANT to build a Visual Studio solution. Finally I narrowed down to the problem. It was the Exec target failure when one of its parameter argument contains a space. I thought that I could use a function or tool to convert the argument (a path) from a long name to DOS short name. Unfortunately, there is not such function in NANT for Windows build.

I posted a question to SO. I soon got a answer. In addition to that, I also figured out a way to resolve the issue. See my answer for detail explanation with a simple test case.

By the way, I used NANT extensively long time ago when I was a system analyst in a company's RTD, about 10 years ago. I created a NANT project to build an open source project by using Microsoft .Net Framework SDK (1.0) without using Visual Studio. Later I also used NANT in an Agile environment as a way to test UNIT tests, and to deploy the project. I really enjoy this great tool.