15

I'm using WiX 3.5. Recently, the following WiX error started occurring frequently on the build server:

light.exe (,): error LGHT0301: Failed to open the database. During validation, this most commonly happens when attempting to open a database using an unsupported code page or a file that is not a valid Windows Installer database. Please use a different code page in Module/@Codepage, Package/@SummaryCodepage, Product/@Codepage, or WixLocalization/@Codepage; or make sure you provide the path to a valid Windows Installer database.

Which "database" does the error refer to? (None of the WiX source files have changed in a long time, so I doubt it's a code page problem.)

Other people have reported that this error may be caused by Trend Micro Office Scan, which is indeed installed on the build server. I asked the system administrator to exclude the build directories from the scan, but this error still occurs. How can I determine whether the virus scanner is the culprit? (The error doesn't always occur, so if I disable the virus scanner and the next build succeeds, I still don't know whether the error has gone away permanently.)

Community
  • 1
  • 1
Michael Liu
  • 52,147
  • 13
  • 117
  • 150

7 Answers7

15

The "Disable the ICE validation" worked for me - just a setting through Visual Studio 2012 in the .Setup.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user2855030
  • 159
  • 1
  • 2
  • 3
    This solved the same problem for me. Goto the wix Project Properties, Tool Settings, then checked "Suppress ICE validation" – Contisma Apr 02 '14 at 03:05
  • I also encountered this issue working with version 3.8. The steps above solved the issue. – estebro Jun 24 '14 at 12:42
  • for me it wasn't enough to Suppress ICE validation for just Active (debug) Configuration, I had to Suppress ICE validation for all configurations and that did the trick. – nlv Aug 18 '14 at 14:50
  • I would try this first before putting yourself at risk with the AV exclusion route. – cory.todd Dec 12 '14 at 21:03
13

After studying the WiX source code and running Process Monitor, I found that excluding the build directories from the virus scan is insufficient.

Explanation: When light.exe runs, it creates the target MSI file in a temporary directory. (This file is the database that the LGHT0301 error message refers to.) After light.exe closes the MSI file, ntrtscan.exe opens the MSI file for read access and read-only sharing. Later, in the database validation step, light.exe tries to reopen the MSI file for read/write access, and a sharing violation occurs.

Solution: Exclude the temporary directory from the real-time virus scan. On Windows Server 2008, for example, this directory is C:\Users\«username»\AppData\Local\Temp.

Michael Liu
  • 52,147
  • 13
  • 117
  • 150
  • 4
    Excluding the temp directory from virus scanning is very counter productive and a nightmare from a security standpoint. After all, the temp directory is usually writable by any process. Furthermore, disabling the virus scanner or editing its settings might not be easily possible (for instance in a corporate environment) – knittl Mar 26 '14 at 12:28
  • 1
    Note you can use the WIX_TEMP environment variable to specify a custom temporary directory which you may be happier to exclude from real-time virus scanning. – Alex Humphrey May 01 '15 at 09:16
4

This is a common problem with build processes and antivirus. The scanner will detect the new MSI package and try to scan it. Meanwhile the build process also tries to validate it by running the Internal Consistency Evaluators (ICE) suite and you get a failure because the database has a mutex on it.

You should just remove the virus scan from your build output folders. Alternatively decouple the validation from the Light command so that the antivirus scan relinquishes the MSI handle before you run the ICE validation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Stephen Connolly
  • 1,639
  • 10
  • 15
  • 1
    The build folders are already being excluded from the scan (presumably). – Michael Liu Feb 12 '13 at 20:56
  • 1
    Good point - AV often also scans the temp folder. It might be worth checking the parameters you pass to the light command. IIRC it is possible to specify the folder it uses for temporary artifacts. I wouldn't recommend blanket disabling AV on your temp folder as it could be a security risk. Might also be worth suggesting to the Wix team that they put a retry loop into the validation step to cater for situations where AV grabs hold of the file for a short time, which is not at all unusual. – Stephen Connolly Feb 13 '13 at 10:34
3

I had the same problem which was actually really related to codepages and language settings of my system.

Adding English input language in Windows' regional settings solved the problem on my German Windows installation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
2

The real cause was Trend Micro real time scanning!

(The following is only for historical reference)

I followed @Michael Liu answer and solved the problem


I had the same problem.

I am not referring to Codepage (or SummaryCodepage) in any of those tags, or in fact anywhere in the WXS. Putting Codepage="1252" didn't change anything.

Finally, I tried adding

encoding="utf-8"

to the XML tag which previously only had a version='1.0' attribute. This fixed the problem, as described in "Failed to open the database" error. - SOLVED

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ari
  • 331
  • 1
  • 4
  • 19
1

It was also the antivirus program for me.

An easy way to check if the problem is related to the anti-virus program is to disable the ICE validation in the WiX project setting (using version 3.7). This worked for me, and is a permanent setting now, since in our company you can't change the setting of the antivirus software.

-2

This is the most common error I found while using WiX. The easiest solution for this is go to Properties of your project → Tool Settings → (Check) Suppress ICE Validation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131