bala_88
bala_88

Reputation: 391

Parametrizing external xml file in NAnt

In my build file, one of the build steps that I'm using is as follows:

  <target name="BuildMsDeployPackage" depends="StageForMsDeployPackaging">
    <exec program="${msdeploy.exe}"
          workingdir="${buildDirectory}"
          verbose="true"
          commandline="
           -verb:sync 
           -source:manifest=${currentWorkingDirectory}\${sourceManifest} 
           -dest:package=${publishDirectory}\${webapp.artifact.zip}"/>

Here, I'm using MSDeploy to create a package which can later be deployed. The source is in the form of a manifest file. The contents of the manifest file are as follows:

<MSDeploy.iisApp> 
    <iisapp path="C:\test" />
    <setAcl path="C:\test\dirOne" setAclAccess="Write" setAclUser="xyz"/>
    <setAcl path="C:\test\dirTwo" setAclAccess="Write" setAclUser="abc"/>
</MSDeploy.iisApp>

The paths that I'm using for iisapp and setAcl are hard coded as is evident. I want to be able to specify these in terms the directory where my build file is located (the current working directory).

Is it possible to do this through NAnt?

Upvotes: 1

Views: 124

Answers (1)

The Chairman
The Chairman

Reputation: 7187

As far as I understood your question, you would like to edit the manifest file. Since it is plain XML you could use NAnt's <xmlpoke> task for that. Specify the appropriate path attribute via XPath and set it to your build path. You can retrieve the path of your build file with NAnt function project::get-buildfile-path.

Upvotes: 2

Related Questions