Page 1 of 2

[SOLVED] Problem with install_msi_if_needed and msix file

Published: November 9, 2023 - 3:24 PM
by t.heroult
Good morning
I want to develop a package for the new MS-TEAMS which is provided as msix.

But when I try a simple install_msi_if_needed('MSTeams-x86.msix') in pyscripter, I get this output:

Code: Select all

2023-11-09 15:13:13,714 CRITICAL Fatal error in install script: MSIError: open failed:
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 4083, in install_wapt
    exitstatus = setup.install()
  File "c:\waptdev\ln-msteams-x86_0.0.0_Windows_PROD\setup.py", line 16, in install
    install_msi_if_needed('MSTeams-x86.msix')
  File "C:\Program Files (x86)\wapt\common.py", line 4033, in new_func
    return func(*args, **kwargs)
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 1379, in install_msi_if_needed
    key = get_msi_properties(msi)['ProductCode']
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 2825, in get_msi_properties
    db = msilib.OpenDatabase(msi_filename, msilib.MSIDBOPEN_READONLY)
_msi.MSIError: open failed

FATAL ERROR : MSIError: open failed
Exit code:  3
Any idea what's going on?

Re: Problem with install_msi_if_needed and msix file

Published: November 9, 2023 - 5:50 PM
by dcardon
Hi Thomas,

it seems to me that the msix format has very little to do with the msi format. The msilib library, which is used underlying the install_msi_if_needed function, doesn't apparently handle it.

For now, we'll have to run it with something like run(), I believe...

Denis

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 09:08
by t.heroult
I understand, but what's inconsistent is that from the console, I launched the new package wizard, the first option offering msi, msix, and exe, and after selecting msix, PyScripter opens with the `install_msi_if_needed` line already created.
This needs to be reviewed if the function can't handle msix files.

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 10:54 AM
by t.heroult
So, I don't see how to install MSIX with WAPT.
The simplest way would normally be to use PowerShell with Add-AppxPackage, except that this operation isn't possible with the LOCAL SYSTEM account used by WAPT...

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 11:01 AM
by sfonteneau
Indeed, I just saw that msix is ​​hardcoded in waptconsole

We're going to remove the reference; it's a historical error

In the meantime, you can try something like this:

Code: Select all


def install():
    filecopyto('MyApp.msix','c:\MyApp.msix')

def session_setup():
    run(r'powershell Add-AppPackage -path "c:\MyApp.msix"')

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 11:42 AM
by t.heroult
Hi Simon
, as I mentioned in my previous comment, it's not working.
At least, it works in PyScripter since it's launched with my account, but the WAPT agent runs with the SYSTEM LOCAL account, which doesn't have permission to run "PowerShell Add-AppxPackage". This is forbidden by Windows, and the same applies to Add-AppPackage itself.

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 12:35 PM
by sfonteneau
But in my example it's a session_setup, so not a system, so it doesn't work either?

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 12:41
by t.heroult
I don't know what the result would be in session_setup...
I'll test it and see.

More later!

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 3:04 PM
by t.heroult
Negative feedback, nothing happens.
The command used is: powershell Add-AppPackage -Path "C:\Software\bin\MSTeams-x64.msix"
Launched by session_setup: nothing happens
Launched from a PowerShell window (standard user): it works...

Code: Select all


def session_setup():
    cmd = 'powershell Add-AppPackage -Path "C:\Logiciels\bin\MSTeams-x64.msix"'
    run(cmd)

Re: Problem with install_msi_if_needed and msix file

Published: November 10, 2023 - 3:42 PM
by sfonteneau
Hmm, the 'r' before the string?

Or should I just use the full path:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe