in

ASPXWizard.net

.net and Ajax Community

Mina Labib

Adding double quote in NAnt task

I was struggling this morning with issue in simple NAnt script, I was trying to uses <exec> task to call msbuild tool.

Ok quick brief on the issue, NAnt 0.86 Beta 1 does not able to run its " href="http://nant.sourceforge.net/release/0.86-beta1/help/tasks/solution.html" target=_blank>" href="http://nant.sourceforge.net/release/0.86-beta1/help/tasks/solution.html" target=_blank><solution> task to build Microsoft Visual Studio solutions against Visual Studio 2008 solution files, however it can build solution for .NET 3.5 Framework. so I found two solutions –till now-, both of them are using MSBuild tool to build my solution with two different ways; first one is to use NAntContrib as extension for NAnt and use its " href="http://nantcontrib.sourceforge.net/release/0.85-rc4/help/tasks/msbuild.html" target=_blank>" href="http://nantcontrib.sourceforge.net/release/0.85-rc4/help/tasks/msbuild.html" target=_blank><msbuild> task to fire msbuild tool – I did not try that yet –, and the other one is to use NAnt " href="http://nant.sourceforge.net/release/latest/help/tasks/exec.html" target=_blank>" href="http://nant.sourceforge.net/release/latest/help/tasks/exec.html" target=_blank><exec> task to call msbuild tool and throw to it my solution file as parameter; and while I am try that I found issue, I need to add /p:Platform=”Any CPU” as msbuild command switch but how to add double quote to task attributes, it fails if I wrote:

<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" commandline="mysolution.sln /p:Platform=”Any CPU”"/>

Fortunately, I found nice simple post to solve this issue by adding property to NAnt script with double quote as value and use it in my command as following:

<property name="dbl_quote" value='"'/>
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" commandline="mysolution.sln /p:Platform=”${dbl_quote}Any CPU${dbl_quote}"/>
It is nice and quick solution.
Published Dec 18 2009, 04:49 AM by minalabib
Filed under: ,

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
ASPXWizard.net some rights reserved 2005-2007
Powered by Community Server (Non-Commercial Edition), by Telligent Systems