For some reason, when I compile projects using MSBuild, it
occassionally fails to copy an assembly to the output directory. No
errors occur, the assembly is built correctly to the obj directory, and
compiling the project a second time using MSBuild seems to work fine.
The MSBuild output seems to indicate that the file was copied without
any problems, however, the file is not in the output directory. I had
the same problems with using VS from the command line (not surprising
of course).
Any suggestions We have over 200 projects. Having to compile multiple
times to get a project to compile correctly is not a realistic
alternative.
I can include the code we use to call MSBuild, the error log, or the
project that's failing (though it seems to randomly pick projects to
fail).

MSBuild is not copying the assembly to the output directory.
Gary Yukish
Alaa_fcis
Will VS 2005 SP1 fix this
We use contextful builds, so a project builds differently depending on if it is the parent or an included build... of course, we want the all the output to go to the same place, so we set a property on the command-line to retarget it...
aprenot
TopTN
Michael_DV
Brian and I discussed this over email, and discovered that this is due to the fact that OutputPath is being overridden during the build, and becuase of a bug in the IncrementalClean logic.
IncrementalClean is a target that is used to ensure that outputs that were produced in the last build, but were not produced in the current build are cleaned out. The list of files that are produced in the last build is stored in a file under obj\debug or obj\release.
So, in this case, what's happening is that between two subsequent builds, a different representation of the same output path is used - for instance, c:\abc\def in one case, and ..\abc\def in another case - and IncrementalClean mistakenly deletes outputs that were just produced.
We have a bug tracking this and will be fixed in a future release - but in case anyone else runs into this issue - the workaround is to use the same string value of the output path (case-insensitive of course) between builds. We believe that this should not be too widespread an issue - especially on developer desktops where you usually don't override the output path - but just useful to be aware of just in case.
Faisal Mohamood | Program Manager | Visual Studio - MSBuild
doomgaze
I double checked that deleting the filelist files did not resolve the issue and that nothing has customized anything regarding OutputPath
JCampos
Brian,
This is the first time I have heard of anything like this. What types of projects are these Do you always see the issue with a specific set of projects, or a specific project type
The build should be reliable. You should not have to build more than once to get the code to compile and build correctly. Sorry for the inconvenience.
Any chance you will be able to generate a diagnostic build log for a failing scenario You can send it to my attention at msbuild@microsoft.com, and refer to this discussion.
Faisal Mohamood | Program Manager - MSBuild