Fix intermitent failures in light.exe (dotnet/core-setup#6562)
authorVitek Karas <vitek.karas@microsoft.com>
Wed, 29 May 2019 14:46:43 +0000 (07:46 -0700)
committerDavis Goodin <dagood@users.noreply.github.com>
Wed, 29 May 2019 14:46:43 +0000 (07:46 -0700)
commit289e08b5c80c1c6e6674b8c49ea21c5113f01113
treebb1c846470ab47d617b563780da4a46fddf7b340
parent48057813e3943c9e54ff0cfdd826a16e1ad66d1b
Fix intermitent failures in light.exe (dotnet/core-setup#6562)

This is a workaround for an issue I recently started to see locally. The light.exe would fail with "The process cannot access the file because it is being used by another process". Debugging into it, it fails to move a file from temp to the output (the final exe output file).

There are two issues here:
* It uses the OS temp folder (TMP variable) which people typically don't have excluded from antivirus and thus the antivirus can lock the file for a bit. This is fixed by setting the `WIX_TEMP` env. variable to a location in the obj tree.
* Even with the above it still sometimes fails. The only workaround I found is simply  wait for a bit before running light. I don't know why this happens, but the simple sleep 1 second fixes it. It's probably not worth the effort to try to figure out why.

Commit migrated from https://github.com/dotnet/core-setup/commit/a66a41f693a048341cf6b6a99f74e6312200240d
src/installer/pkg/packaging/windows/sharedframework/generatebundle.ps1