views:

45

answers:

2

I'm trying to post-process the documentation XML file as a post-build XSLT transformation (using the new XSLTransformation step), but the build fails with error Unable to execute transformation. Could not find file 'C:\...\documentation.XML'. The documentation XML file shows up fine on disk after the build is complete, but during the AfterBuild step is simply not there: <Exec Command="dir $(ProjectDir)$(DocumentationFile)"/> does not find the file, neither does <Exec Command="$(ProjectDir)$(DocumentationFile)"/>.

The XslTransformation step is run from a task named AfterBuild and declared as depending of the Compile step. Apprently I'm missing something in the way this task is declared so that it does not run before the documentation XML file is complete, but I can't figure out what.

A: 

It works fine for me, with this target declaration :

<Target Name="AfterBuild">
  <Copy SourceFiles="$(ProjectDir)$(DocumentationFile)"
        DestinationFolder="C:\..\CopyDirectory"/>
</Target>

You should try to remove the dependency on Compile step.

madgnome
That actually doesn't work for me. Or, to be correct, it always works *once* right after I open the project. The build completes and the files gets copied. But when I build again, I get error `Unabled to copy file... Could not find file...`
Remus Rusanu
+1  A: 

This seems to be a bug in the IDE build system, as per http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/8a2f4af8-7a57-454f-aa7d-684f3f89acf3: the IDE build renames the $(DocumentationFile) to .tmp file during the build, and renames it to the proper documentation XML file after the build is complete. I can't imagine why would they do that, other than for the personal gratification of an evil project manager who must have now laugh diabolically as it reads this...

Remus Rusanu