I am writing an ASP.NET web application using Visual Studio 2008. The project is mostly unchanged from the default empty project that Visual Studio provides, except for:
- In Properties->Build->Output, "XML documentation file" is checked and set to "bin\MyProject.XML"
- In Properties->Build Events, "Post-build event command line:" is set to
copy /y "$(TargetDir)$(TargetName).XML" "C:\TEMP\"
When I build the project for the first time, or rebuild, the build process completes successfully. If I try to build any time after that, however, the build process fails with this message:
------ Build started: Project: MyProject, Configuration: Debug Any CPU ------
MyProject -> C:\Projects\MyProject\MyProject\bin\MyProject.dll
copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\"
The system cannot find the file specified.
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3397,13): error MSB3073: The command "copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\"" exited with code 1.
Done building project "MyProject.csproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
I'm certain that the syntax is correct, because I can perform the post-build command in a command window:
C:\>copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\"
1 file(s) copied.
The command works when I do it manually, so why does it fail when it is part of the build process?