Visual Studio incremental build: XML documentation file created too late

I have a DLL project for Visual Studio 2005 in which an XML documetation XML document file is included. Whenever I perform incremental assembly, during the execution of the event after the assembly, the XML documentation file is missing from the output directory.

If I paused the build during the post-build event (using the sleep utility from GnuWin32 CoreUtils ), I can see a file in the output directory called vs5BB5.tmp. But this file is not renamed to MyLib.xml until the post-build event is completed (and "AfterBuild", as I have some settings).

For a clean build in Studio and for MSBuild launched from the command line, everything works as expected - an XML documentation file is created before the events after the build.

Why is this happening, and how can I fix incremental builds?

+4
source share
3 answers

There was only one problem. This is a known issue with Visual Studio and incremental builds. See this post on connecting to Microsoft .

I solved it with conditional xcopy as below:

if exist "$(TargetDir)$(TargetName).xml" xcopy $(TargetDir)$(TargetName).xml $(ProjectDir)......\bin\ /C /I /R /Y

SF

+3
source

Just with this problem myself ....

I found that the xml file is called a .tmp file, so you can copy this tmp file to wherever you want, its just a little "dirty" work.

I was also very tempted to write myself a command line tool called something like: -

 WaitForThenCopy <source path> <target path> <milliseconds to wait> 

the only problem is that it should not be blocked, and you do not know if it works or not.

+1
source

I use a simple batch file to copy instead of the default copy command, which detects the tmp file and copies / renames it.

 REM There is a bug in VS where the xml documentation is written to a tmp file REM during incremental builds, preventing access during post-build events. REM See http://connect.microsoft.com/VisualStudio/feedback/details/470485/strange-file-not-found-error-xml-documentation-file-renamed-during-incremental-build REM As a work around for following script tries to catch this situation and copys/remanes REM this tmp-file instead. REM .SYNOPSIS REM CopyXmlDocumentation "X:\path\to\source.xml" "Y:\target\dir" if exist "%~1%" ( REM if the file exists, copy it as-is copy /Y "%~1" "%~2" ) else ( REM else we try to copy the .tmp file and rename it to the desired target name REM we assume that the tmp file is named "vsXXXX.tmp" where XXXX is an arbitrary string copy /Y "%~d1\%~p1\vs*.tmp" "%~2\%~n1%~x1" ) 
+1
source

All Articles