From the build log - on this occasion I happen to be trying to execute a batch file in this example, but it fails with the same error on other tasks. I'm using version 3.5
Am I the only one with this issue ?
Using "MSBuild.ExtensionPack.Framework.AsyncExec" task from assembly "E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\MSBuild.ExtensionPack.dll".
Task "MSBuild.ExtensionPack.Framework.AsyncExec"
Command: E:\Source\PsTools\psexec.exe -accepteula \\NWPAPPFSTU10 -u nwp-biz\svc-nwptfssrv -p ?3x0du10 -i -high cmd /c "E:\BatchScripts\BuildScripts\42\CleanFASTCollections.bat" RUSSIAC AUSTRIAC RXRUC IBERIAC ITALYC
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: The "MSBuild.ExtensionPack.Framework.AsyncExec" task failed unexpectedly. [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: System.IO.IOException: Cannot create a file when that file already exists. [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at System.IO.__Error.WinIOError() [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at System.IO.File.Move(String sourceFileName, String destFileName) [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at MSBuild.ExtensionPack.Framework.AsyncExec.CreateBatchProgram(String command) in D:\Projects\MSBuildExtensionPack\Releases\4.0.3.0\Main\Framework\Framework\AsyncExec.cs:line 107 [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at MSBuild.ExtensionPack.Framework.AsyncExec.<Execute>b__2(String command) in D:\Projects\MSBuildExtensionPack\Releases\4.0.3.0\Main\Framework\Framework\AsyncExec.cs:line 70 [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at MSBuild.ExtensionPack.Framework.AsyncExec.Execute() in D:\Projects\MSBuildExtensionPack\Releases\4.0.3.0\Main\Framework\Framework\AsyncExec.cs:line 70 [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\CleanFASTCollections.targets(29,5): warning MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [E:\Builds\42\NOVA Platform\v2.10.2-Demo\BuildType\TFSBuild.proj]
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "MSBuild.ExtensionPack.Framework.AsyncExec" is set to "true".
Done executing task "MSBuild.ExtensionPack.Framework.AsyncExec" -- FAILED.
Comments: ** Comment from web user: BrianButler **
This is a bug in AsyncExec. Specifically in CreateBatchProgram. The file created by GetTempFileName() is guaranteed to be unique at the time of creation. However, by renaming the file to .bat the old filename can be reused without violating this contract. When you go to rename again (with Move) there is a conflict, and the error reported here.
For example...
AsyncExec #1
GetTempFileName picks file0001.tmp. It's unused so it returns this file.
Move renames to file0001.tmp.bat
AsyncExec #2
GetTempFileName picks file0001.tmp. It's unused so it returns this file.
Move tries to rename to file0001.tmp.bat and FAILS.
Without the rename in AsyncExec #1, AsyncExec #2 looks like this:
GetTempFileName picks file0001.tmp. It's used, so increment to file0002.tmp. That one is unused so it returns this file.