I'm using MSBuild.exe v4.00. I've got a build target in my project file that copies a file named Parameters.MyEnvironment.xml to Parameters.xml. "MyEnvironment" can vary based on when/where MSBuild.exe is called.
This runs, then the Parameters.xml is used by other processes in the MSDeployPublish target.
Finally, I delete the file Parameters.xml because it's just a copy of one of my environment-specific files.
When running as described above, the MSDeployPublish target behaves as though Parameters.xml is not there but does not report an error.
However, if I remove the delete task so Parameters.xml remains after my project build completes , MSDeployPublish sees it and uses it correctly. Strangely, any change to Parameters.MyEnvironment.xml is immediately reflected in the next build process.
To summarize - copying a file (that wasn't previously there) into my project folder that a subsequent target uses does not work. However, if I leave the original file there and overwrite it with a new version of the source, it works reflecting the new content!
This author has identified a locking/open-file issue with MSBuild, have I got the same thing going on here? http://dotnet.dzone.com/articles/using-custom-webconfig-0