Windows Installer fails on Vista with 2869 error code.


Omar had a problem: he was using VS 2005 SP1 on Vista to build his Windows Installer setup package for VSTO Outlook Add-In. When he tried to install the package – it was always failing with code 2869. He contacted me with “what is the deal?”, I tracked more folks in VS Setup team and finally got to the bottom of the problem.


His setup has a custom action “SetSecurity” written in managed code (this is because he was following the deployment articles as indicated here). This custom action, which modifies CAS policy, threw the exception but the actuall exception message was never shown to the end user. Since one could not see the actual erro – troubleshooting the CA was nearly impossible.


So, how can you make your Windows Installer show the error messages displayed by the Custom Actions? You would need to manually modify Errors table in the MSI file (use Orca tool to do that) and add the following entry to it – 1001 “Error [1]: [2]”. Additional bonus to the guys who can make it happen automatically as the post build step J


Finally, I should notice that you would not need to do that when final VS 2005 Sercice Pack for Vista comes out.


[Update 3/9/07: Omar posted his side of the story and he also tells how to do the workaround automatically]


Comments (16)

  1. Misha,

    Thanks for the solution. When can we expect to have this issue fixed?

    Kind regards,

    Dennis

  2. Misha Shneerson says:

    I just talked to the guys from the setup team and the issue will not be solved for Visual Studio 2005 – only for the next release codenamed "Orca". But please see Omar’s blog (http://www.shahine.com/omar/VSTOAddinsAndVista.aspx) how to automate this workaround.

  3. Thanks Misha and I have already tested the suggestion workaround with good outcome 🙂

    Kind regards,

    Dennis

  4. yogesh gaur says:

    This soultion works for me on vista – 32 bit. For some reason, this doesn’t work for me on x64. Any insight?

    regards,

    Yogesh

  5. ViniS says:

    I’m trying to deploy a VSTO 2005 Outlook Add-In. My add in includes Custom Configuration Sections in the App.config file.

    If I deploy my add in without the custom configuration section functionality it behaves as expected; however when the custom configuration section was included it stopped working. Any insight?

  6. Kljuka says:

    Hello,

    I have the same problem with already compiled comercial program SYNCING.NET but I’m not a developer so I can’t fix it and I would really like to use it on my Vista. So is there a way for me to somehow install this product on my computer?

    Thanks for the help!

  7. Jonas G. says:

    The other way to deal with this problem for those who are not developers.

    Disable User Account Control in Windows Vista. A number of ways to do this can be found at

    http://www.petri.co.il/disable_uac_in_windows_vista.htm

    Then run the installer. If everything’s OK, you should be able to install the application successfully.

    Do not forget to enable User Account Control after you install the application (for security reasons).

    I hope this will be useful.

    Thank you, Misha, for the solution for developers.

    Best regards,

    Jonas

  8. Steffen says:

    Since I had the same problems, I combined the 2 scripts, Aaron and Misha proposed to 1.

    For those, who are not developers and try to install an existing Msi, just run the script on the msi:

    cscript <path to the script> <path to the msi>

    Here is the script, most of it is taken from Aarons post of setting the NoImpersonate-Flag:

    //prepare MSI-Files for use on Vista-Systems

    //Visual Studio forgot to include 2 things:

    // 1. Mark Custom Actions as NoImpersonate, otherwise an Security-Error results in Error 2869

    // 2. User-Exceptions in CustomActions are not shown. Instead a plain Error 2869 without description occurs.

    //     Therefore Error-Message for this case has to be defined

    // Constant values from Windows Installer

    var msiOpenDatabaseModeTransact = 1;

    var msiViewModifyInsert         = 1;

    var msiViewModifyUpdate         = 2;

    var msiViewModifyAssign         = 3;

    var msiViewModifyReplace        = 4;

    var msiViewModifyDelete         = 6;

    var msidbCustomActionTypeInScript       = 0x00000400;

    var msidbCustomActionTypeNoImpersonate  = 0x00000800;

    if (WScript.Arguments.Length != 1)

    {

    WScript.StdErr.WriteLine(WScript.ScriptName + " file");

    WScript.Quit(1);

    }

    var filespec = WScript.Arguments(0);

    var installer = WScript.CreateObject("WindowsInstaller.Installer");

    var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

    var sqlSelectCustomActions = "SELECT `Action`, `Type`, `Source`, `Target` FROM `CustomAction`";

    var view

    var record

    var view2

    var sqlInsertErrorMsg= "INSERT INTO `Error` (`Error`, `Message`) VALUES (1001, ‘Error [1]: [2]’)";

    try

    {

    // 1. problem: CustomActions in Vista have to run with NoImpersonate

    view = database.OpenView(sqlSelectCustomActions);

    view.Execute();

    record = view.Fetch();

    while (record)

    {

       if (record.IntegerData(2) & msidbCustomActionTypeInScript)

       {

           record.IntegerData(2) = record.IntegerData(2) | msidbCustomActionTypeNoImpersonate;

            view.Modify(msiViewModifyReplace, record);

       }

           record = view.Fetch();

    }

    view.Close();

    //2. problem: explicit format User-Errors, otherwise they are not visible in Vista, the User just sees Error 2869

    view2=database.OpenView(sqlInsertErrorMsg);

    view2.Execute();

    view2.Close();

    database.Commit();

    }

    catch(e)

    {

    WScript.StdErr.WriteLine(e);

    WScript.Quit(1);

    }

  9. Sameera says:

    Thanks Steffen!

    your script saved a lot work for me.

  10. A quick fix to help troubleshoot error 2869 when installing the VBUC 2.0.

  11. Alexey says:

    very easy solution was posted on Paulo Reichert’s Blog

    http://blogs.conchango.com/pauloreichert/archive/2006/11/21/Windows-Installer-MSI-packages-error-code-2869-on-Windows-Vista.aspx

    "…The quick and dirty solution I found to make them install is to create a batch file with the following command:

    msiexec /i "path-to-package.msi"

    Save the file then right-click it and select "Run as Administrator". That makes it work.

    …"

  12. Gustavo says:

    Quick solution: Right click on "setup.exe" file and select "Run as Administrator".

  13. starter says:

    >> Gustavo said:

    >>Quick solution: Right click on "setup.exe" file and >>select "Run as Administrator".

    may i know is this really work without using "msiexec"?

  14. smitty25 says:

    Some helper would be appreciated… similar problem on Windows Server 2008….

    I have an MSI package that has a bunch of custom actions included with it. I applied the NoImpersonate and also the error message fix mentioned here to the MSI and that got it working under Windows Vista.

    My issue now is, the same MSI installer just hangs on Windows Server 2008 64-bit (no error messages at all, not even the 2869 error message). It doesn’t seem like the error message fix I applied from here is giving me any feedback during the hang.

    Are there any other special properties that need set in an MSI for Windows Server 2008 64-bit?

    Anyone else seen this problem?

    I have read that invoking a 64-bit program from a 32-bit application can cause a hang but that doesn’t seem to be the case in my custom actions.

    Chris

  15. Zed says:

    Misha saves the day again