开发者

Why isn't @(DocFileItem) found during MSBuild AfterBuild task?

I'm t开发者_StackOverflow社区rying 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.


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...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜