installationwindows-installervisual-studio-2019failed-installationpackagereference

VS2019 MSI Installer error 2727 after migration from packages.config to PackageReference


I have a console application running on .NET Framework 4.7.1 in Visual Studio 2019 with a Microsoft Visual Studio Installer Project (MSI Installer).

After migrating from packages.config to PackageReference, the .msi installer returns the following error once it collects all installer inputs and begins the install.

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727.

.msi installer created before the migration works fine. The executable and project work fine after the migration. The problem is only with the installer. The problem can be reproduced when installing from the VS 2019 project and from the generated .msi file.

There is an error in the Windows Event Viewer and the installer log:

Event Viewer on remote machine

Product: XXXXX -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727. The arguments are: _0024F16DE39F4B7D9BF184AC802A7310, ,

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="MsiInstaller" /> 
  <EventID Qualifiers="0">10005</EventID> 
  <Level>2</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2021-10-21T19:14:41.779642800Z" /> 
  <EventRecordID>18270804</EventRecordID> 
  <Channel>Application</Channel> 
  <Computer>XXXXXX.com</Computer> 
  <Security UserID="S-1-5-21-3296303954-3414968290-1573956784-1136" /> 
  </System>
- <EventData>
  <Data>Product: XXXXXX -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727. The arguments are: _0024F16DE39F4B7D9BF184AC802A7310, ,</Data> 
  <Data>(NULL)</Data> 
  <Data>(NULL)</Data> 
  <Data>(NULL)</Data> 
  <Data>(NULL)</Data> 
  <Data>(NULL)</Data> 
  <Data /> 
  <Binary>7B41433031463831372D434435302D343530332D423239342D3844334438453538323844417D</Binary> 
  </EventData>
  </Event>

MSI Installer Log on local machine

MSI (c) (4C:5C) [16:58:07:070]: PROPERTY CHANGE: Adding INSTALLLEVEL property. Its value is '1'.
MSI (c) (4C:5C) [16:58:07:070]: Note: 1: 2727 2: _7F06229DCDB74690AC0D18DBD0357B3B 
DEBUG: Error 2727:  The directory entry '_7F06229DCDB74690AC0D18DBD0357B3B' does not exist in the Directory table
DEBUG: Error 2835:  The control ErrorIcon was not found on dialog ErrorDialog
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDialog, 
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727. The arguments are: _7F06229DCDB74690AC0D18DBD0357B3B, , 
MSI (c) (4C:5C) [16:58:08:457]: Product: XXXXX -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727. The arguments are: _7F06229DCDB74690AC0D18DBD0357B3B, , 

Nothing else in the log has the value _7F06229DCDB74690AC0D18DBD0357B3B. This value is the same between installs. This is not the ProductCode or the UpgradeCode in the installer properties.

Setup

What I tried:

All code is backed up so I can go back to package.config but would prefer not to do so unless no solution could be found.

Note: for whatever reason, the .msi after the migration is almost twice as large as the .msi before migration.

Update

The installer fails right before the Select Installation Folder dialog (which is not shown when the failure occurs).

This is the screen before which the installer fails. This is the screen before which the installer fails.

I also tried to revert the branch to before the migration but the revert is not working as the migration changes remain and prevent the installer from working. I had to delete all files and restore them from Git to finally remove the migrated packages and get the installer working.


Solution

  • The solution ended up being to delete the old installer project, migrate to PackageReference, and create a new installer project.

    Based on Git, the only differences ended up being the references in the .vdproj file. The new installer was larger than the first but everything else was the same.

    Problem

    Installer stops working after After migrating from packages.config to PackageReference.

    Solution

    1. Delete the installer project (make sure you have a backup).
    2. Do the migration.
    3. Create a new installer project.

    Cause

    Auto-migration does not update the .dll references in the Installer project.