Salient Solutions

wrasslin ones and nones for fun and profit - Sky Sanders' Blog
Get your own ranked flair here
posts - 92, comments - 103, trackbacks - 0

Visual Studio 2008 Build Event XCopy Bug


Wondering why your post-build xcopy not working?

From Microsoft Connect

Thanks for reporting this bug. Unfortunately, after much investigation, we (MSBuild team) discovered that this is actually a documented bug in xcopy.exe. The owners of xcopy.exe claim that this bug is not worth fixing, and so there's not much we can do at this point.

However, the good news is that there is a fairly simple (though completely non-intuitive and non-discoverable workaround), and that is to append "<NUL:" to the end of your xcopy command. So, in your case, just do this:

    xcopy "$(TargetDir)*.*" "$(SolutionDir)..\bin\" /S /I /F <NUL:

and that should work for you.

If you want additional information about the bug, you can start by referring to the KB article at: http://support.microsoft.com/default.aspx?scid=kb;en-us;152134. Even though this article talks about calling xcopy from SQL server, it is really the same xcopy bug that is afflicting you in your Post-Build event.

Again, thanks for taking the time to report this, and sorry we're unable to fix this.

--MSBuild team (msbuild@microsoft.com)

 

These tasks are usually meant to overwrite files so I add '/Y':

 xcopy "$(TargetDir)*.*" "$(SolutionDir)..\bin\" /S /I /F /Y <nul:

Technorati tags: ,

Print | posted on Saturday, September 05, 2009 4:51 AM | Filed Under [ CodeProject-Tip ]

Feedback

Gravatar

# re: Visual Studio 2008 Build Event XCopy Bug

This is a great tip.
7/1/2010 11:36 PM | Petros
Gravatar

# re: Visual Studio 2008 Build Event XCopy Bug

In our case they have used “xcopy” command to solved the issue, there's lot of macro for execution. they used target listing as output macro, & source listing as solution macro, since its a simple issue they set the relative path of the DLL from solution path. worked all right, when they published the project they found that in publish version also contains the DLL, job done with excellent time & in a nice way
8/9/2010 7:52 AM | watch anime online
Gravatar

# re: Visual Studio 2008 Build Event XCopy Bug

simple issue they set the relative path of the DLL from solution path. worked all right
8/16/2010 8:20 PM | Eid mubarak sms
Gravatar

# re: Visual Studio 2008 Build Event XCopy Bug

I put my xcopy code in a batch file. ... I put the batch file in my ... copied, and the I modifed my post build event to call my dll. ... I am not sure what is going on with Visual Studio 2008, but this is at least ...
8/19/2010 6:50 AM | ANIME

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 6 and 6 and type the answer here:

Powered by: