With 1.7, multi-core builds still fail with "package restore" feature

Apr 5, 2012 at 6:21 PM

Before I try to re-open issue #1974, I thought I'd start a discussion to see if maybe it's something I'm doing.

I've removed all the packages within the packages directory, and then rebuilt:


msbuild.exe /v:m /p:Configuration=Debug /nologo /t:Build dev\backend\server.sln /m


The build will fail with multiple errors like this:

C:\Users\Matt\projects\MyProject\dev\backend\.nuget\NuGet.targets(43,9): error : The process cannot access the file 'C:\Users\Matt\projects\MyProject\dev\backend\packages\log4net.1.2.11\lib\net35-client\log4net.dll' because it is being used by another process. [C:\Users\Matt\projects\MyProject\dev\backend\Games\MyGame\MyGame.csproj]

However, immediately running a second build will succeed because the previous, failing build did manage to install all of the packages.

Can anyone help me out with this? I'm not sure what else I could be doing.

Apr 5, 2012 at 6:51 PM

Are you running the 1.7 build of NuGet.exe? If so, my guess is the fix didn't quite work. Since msbuild doesn't have a way to perform synchronization across parallely built projects, we were trying to use a mutex to sync the install operation from inside the executable so there's at most one instance of the exe installing a package.

Could you reopen the bug and talk to us on Jabbr? (http://jabbr.net/#/rooms/nuget). The fix worked for us but it would be easy to diagnose it if we can debug it on your box with your specific config.


Apr 5, 2012 at 8:13 PM

I don't see an option for reopening the bug, but I joined the chatroom. Just ping me whenever.

Apr 9, 2012 at 4:36 PM

pranavkm, I think I've solved the problem. I've sent a pull request.

There were two issues: as we discovered in chat, the version tagged 1.7 didn't actually include ExecuteLocked, and also if the mutex acquired the lock it would fail to release the mutex afterwards.

I put it on the tip of the 1.8 branch, but if you'd like me to move it to default, I'll take care of that and then send a new request.