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

1

8 Answers 8

15

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

Sign up to request clarification or add additional context in comments.

4 Comments

This solved the same problem for me. Goto the wix Project Properties, Tool Settings, then checked "Suppress ICE validation"
I also encountered this issue working with version 3.8. The steps above solved the issue.
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.
I would try this first before putting yourself at risk with the AV exclusion route.
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.

2 Comments

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

2 Comments

The build folders are already being excluded from the scan (presumably).
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.
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.

Comments

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

Comments

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.

Comments

0

In my case, it wasn't the virus scanner blocking file access, but rather a file name that was too long. By using GitVersion.MsBuild, the file name is replaced by the branch name.

Shortening the branch and the resulting shorter file name solved the problem.

I would also like to mention the WIX0001 error here, as this is also due to a file name that is too long.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.