0
votes

I'm publishing a website by copying a fileset which should exclude .cs and other files. I've tested my NAnt script from the command line and it works fine but when it is called from CCNet, it copies all files, completely ignoring the excludes on my fileset. Any ideas what's going wrong here?

Calling my NAnt build file from from CruiseControl.Net.

<tasks>
  <nant>
    <executable>$(nant.exe)</executable>
    <baseDirectory>$(build-dir)\$(project-dir)</baseDirectory>
    <buildArgs></buildArgs>
    <nologo>true</nologo>
    <buildFile>aview-dev.build.xml</buildFile>
    <targetList>
      <target>go</target>
    </targetList>
    <buildTimeoutSeconds>300</buildTimeoutSeconds>
  </nant>
</tasks>

The chunk of the NAnt build file that doesn't seem to work (part of my 'publish' step).

<copy todir="${publish.path}" includeemptydirs="false">
  <fileset basedir="${src.path}" defaultexcludes="true">
    <include name="**/**" />
    <exclude name="**.csproj*"/>
    <exclude name="**.cs"/>
    <exclude name="**.vb"/>
    <exclude name="**.sln"/>
    <exclude name="**/obj/**"/>
  </fileset>
</copy>

The same NAnt file works fine when run directly from the command prompt.

nant -buildfile:test.build.xml -debug

I'm using NAnt 0.91 and CCNet 1.6.7981.1

1
I recommend outputting the values of ${publish.path} and ${src.path} to see if they are the same in both instances.Rami A.
Thanks Rami. I output the paths and they are the same in both cases: "src\" and "published\". The batch file is in the same directory as the Nant script. I'm pretty sure I've already tried using complete paths already but I'll try that again.Ben F
Full paths didn't make a difference. I checked the build log after adding -debug to the buildArgs. It tells me every file that was deleted and copied and there isn't a single mention of .vb files. However, when I look at the 'published' directory, every one of the .vb files is there. The same thing happens even when I delete/recreate the "published" directory in the NAnt task. I can't understand how teh .vb files are sneaking in there. Even the .svn folder is getting copied which should be blocked by defaultexcludes="true".Ben F
Try using <include name="*/" /> instead. You can also try removing the trailing backslash from src.path and publish.path to see if that makes a difference.Rami A.

1 Answers

0
votes

After running the NAnt script in debug mode and checking that the .vb files were not actually getting copied by NAnt, I went back to my CCNet configuration. I realized that I had defined a buildpublisher block in my ccnet.config and was using that in my ccnet project file. After the NAnt task correctly copied the files, the buildpublisher task re-copied everything without any filter (including .vb files, the .svn directory, etc).

<buildpublisher>
  <sourceDir>C:\myprojects\project1\src</sourceDir>
  <publishDir>C:\myprojects\project1\src\published</publishDir>
  <useLabelSubDirectory>false</useLabelSubDirectory>
  <alwaysPublish>false</alwaysPublish>
</buildpublisher>

Removing the buildpublisher task fixed the problem.