Error LGHT0301: Failed to open the database

安稳与你 提交于 2019-11-29 07:33:01

问题


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


回答1:


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




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


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.




回答7:


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.



来源:https://stackoverflow.com/questions/14840233/error-lght0301-failed-to-open-the-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!