Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error LGHT0301: Failed to open the database

Tags:

wix

wix3.5

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.)

like image 278
Michael Liu Avatar asked Feb 12 '13 19:02

Michael Liu


3 Answers

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

like image 146
user2855030 Avatar answered Nov 08 '22 00:11

user2855030


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.

like image 42
Michael Liu Avatar answered Nov 08 '22 01:11

Michael Liu


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.

like image 4
Stephen Connolly Avatar answered Nov 08 '22 02:11

Stephen Connolly