I have been trying to build this setup for a project I made, using WiX, the new Microsoft paradigm for setup packages. So I did what any programmer would do: copy paste from a previously working setup! :) However, there was a small change I needed to implement, as it was a .NET4.0 project. I built the setup, compiled it, ran the MSI and kaboom!

Here is a piece of the log file:
Action 15:34:48: FetchDatabasesAction. 
Action start 15:34:48: FetchDatabasesAction.
MSI (c) (A0:14) [15:34:48:172]: Invoking remote custom action. DLL: C:\DOCUME~1\siderite\LOCALS~1\Temp\MSI21CF.tmp, Entrypoint: FetchDatabases
MSI (c) (A0:68) [15:34:48:204]: Cloaking enabled.
MSI (c) (A0:68) [15:34:48:219]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (A0:68) [15:34:48:251]: Connected to service for CA interface.
Action ended 15:34:48: FetchDatabasesAction. Return value 3.
DEBUG: Error 2896: Executing action FetchDatabasesAction failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: FetchDatabasesAction, ,
Action ended 15:34:48: WelcomeDlg. Return value 3.
MSI (c) (A0:3C) [15:34:48:516]: Doing action: FatalError

In order to get the log of an MSI installation use this syntax:
msiexec /i YourSetup.msi /l*vvv! msiexec.log
vvv is used to specify verbosity, the ! sign is used to specify that the log should be flushed after each line.

As you can notice, the error is a numeric error (2896) and nothing else. Googling it you get to a lot of people having security issues with it on Vista and Windows 7, but I have Windows XP on my computer. The error message descriptions pretty much says what the log does: Custom action failed. Adding message boxes and System.Diagnostics.Debugger.Launch(); didn't have any effect at all. It seemed the custom action was not even executed!

After hours of dispair, I found what the problem was: A custom action is specified in a DLL which has a config file containing this:

<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
which specifies for the MSI installer which version of the .NET framework to use for the custom action. Not specifying it leads to a kind of version autodetect, which takes into account the version of the msiexec tool rather than the custom action dll. It is highly recommended to not omit it. The problem I had was that I had changed the target of the custom action to .NET 4.0 and had also changed the config file to:

<startup>
<!--<supportedRuntime version="v2.0.50727"/>-->
<supportedRuntime version="v4.0.30319.1"/>
</startup>


Changing the version to NET3.5 and adding the original config string fixed it. However, I am still unsure on what are the steps to take in order to make the 4.0 Custom Action work. I have tried both 4.0.30319 and 4.0.30319.1 versions (the framework version folder name and the version of the mscorlib.dll file in the .NET 4.0 framework). I have tried v4.0 only and even removed the version altogether, to no avail.

In the end, I opened the WiX3.5 sources and looked for a config file. I found one that had this:

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
<supportedRuntime version="v2.0.50727" />
</startup>
As you can see, there is an extended supportedRuntime syntax in the 4.0 case, but that is not really relevant. The thing that makes it all work is useLegacyV2RuntimeActivationPolicy="true"!

So shame on whoever wrote msiexec for not specifying the actual problems that make a setup fail, and a curse on whoever decided to display a numeric code for an error, rather than trying to write an as verbose a description as possible. I hope people will find this post when facing the same problem and not waste three hours or more on a simple and idiotic problem.

Comments

Siderite

<p>I am sorry the post could not help you. There is a part of it that says "<i>the error is a numeric error (2896) and nothing else. Googling it you get to a lot of people having security issues with it on Vista and Windows 7, but I have Windows XP on my computer.</i>". Are you sure you have the same problem I had and not one of these other ones?</p>

Siderite

Siderite

I am sorry the post could not help you. There is a part of it that says &quot;<i>the error is a numeric error (2896) and nothing else. Googling it you get to a lot of people having security issues with it on Vista and Windows 7, but I have Windows XP on my computer.</i>&quot;. Are you sure you have the same problem I had and not one of these other ones?

Siderite

Anonymous

<p>...I found it in: WixUnit.exe.config and in my case, it's already set to true and I'm still getting the bloody error!!! augghhhh!!!!</p>

Anonymous

Anonymous

<p>this is great, but what is the @#$$^%&amp; config file that needs to be modified? ;-)</p>

Anonymous

Anonymous

...I found it in: WixUnit.exe.config and in my case, it&#39;s already set to true and I&#39;m still getting the bloody error!!! augghhhh!!!!

Anonymous

Anonymous

this is great, but what is the @#$$^%&amp; config file that needs to be modified? ;-)

Anonymous

Unknown

<p>Thank you!!!!!! This was driving me batty.<br><br>Cheers,<br>Brian from over and to the left</p>

Unknown

Unknown

Thank you!!!!!! This was driving me batty.<br><br>Cheers,<br>Brian from over and to the left

Unknown

Siderite

<p>Thanks, mate! I have been neglecting the technical part of the blog for a while and comments like yours keep me motivated to continue sharing my solutions.</p>

Siderite

Siderite

Thanks, mate! I have been neglecting the technical part of the blog for a while and comments like yours keep me motivated to continue sharing my solutions.

Siderite

Anonymous

<p>I had exactly the same problem and I was messing around for hours, until I found this post.<br><br>Things are now working fine.<br>The key to the solution is: useLegacyV2RuntimeActivationPolicy="true"<br><br>Siderite, you're a legend!<br><br>Rob from DownUnder</p>

Anonymous

Anonymous

I had exactly the same problem and I was messing around for hours, until I found this post.<br><br>Things are now working fine.<br>The key to the solution is: useLegacyV2RuntimeActivationPolicy=&quot;true&quot;<br><br>Siderite, you&#39;re a legend!<br><br>Rob from DownUnder

Anonymous

Post a comment