WiX ICE validation errors

Try adding <RunWixToolsOutOfProc>true</RunWixToolsOutOfProc> to your WiX project file.

We've had the same issue for a while, and tried various workarounds including deleting the temporary files and setting the msbuild environment variable. These all appeared to work for a while, but eventually (sometimes after a few days) the problem would come back again.

I noticed that on my machine devenv.exe was the process that was locking the files that light.exe was trying to delete. I also stumbled across an unrelated thread which mentioned this project setting to make the WiX tools run out of process. I thought it could be worth a try and it appears to have cured the problem for us (so far...)


I had this issue as well and solved it in my environment.

Short answer:

Add the environment variable MSBUILDDISABLENODEREUSE=1 and restart Visual Studio

Long answer:

There was a warning during build that I first didn't see since I was too focused on the error:

Failed to delete temporary directory: C:\Users[username]\AppData\Local\Temp\5[uniqueFolderName] light.exe

I tried to remove the folder manually, but it was in use by another process.

It turns out that a lot of MSBuild.exe processes are started during build and then not closed again. You can read more about the reason for that and what you can do to change that behavior in Stack Overflow question msbuild.exe staying open, locking files.

This thread: it and the solution in this thread:

I hope this answer can help someone else.