microsoft / StoreBroker

A PowerShell module that leverages the Windows Store Submission API to allow easy automation of application submissions to the Windows Store. The master branch is stable and the v2 branch is under active development.
Other
97 stars 40 forks source link

'NamespaceUri' is an empty string #247

Closed szujak closed 7 months ago

szujak commented 7 months ago

Hello, I have problem with uploading bundle to the MS strore using StoreBroker. The github action that I have to do that is

- name: Install StoreBroker and Upload Store Submission
        working-directory: C:\x\.github\windows
        run: |
          // previous install method for StoreBroker
          // Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
          // Install-Module -Name StoreBroker

          git clone https://github.com/microsoft/StoreBroker.git
          Import-Module .\StoreBroker\StoreBroker\StoreBroker.psd1 -Verbose

          $userPassword = ConvertTo-SecureString -String "${{ secrets.AZURE_KEY }}" -AsPlainText -Force
          $cred = New-Object System.Management.Automation.PSCredential ${{ secrets.PSCredential }}, $userPassword
          Set-StoreBrokerAuthentication -TenantId ${{ secrets.TenantId }} -Credential $cred
          New-SubmissionPackage -ConfigPath "C:\x\.github\windows\storeBrokerConfig.json" -AppxPath (Get-ChildItem -Recurse -Path C:\x\windows\x\bin\x64\Release\Upload -Include *.msix).fullname -OutPath ".\" -OutName ".\newSubmission"
          Update-ApplicationFlightSubmission -AppId ${{ secrets.AppId }} -FlightId ${{ secrets.FlightId }} -SubmissionDataPath "C:\x\.github\windows\newSubmission.json" -PackagePath "C:\x\.github\windows\newSubmission.zip" -AutoCommit -Force -ReplacePackages -IsMandatoryUpdate

It worked just fine until last week when the Powershell core was updated in github runners.

The error I got in logs is:

Write-Error: C:\x\.github\windows\StoreBroker\StoreBroker\PackageTool.ps1:3760
Line |
3760 |          Write-Log -Exception $_ -Level Error
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 2024-02-02 13:02:38 : runneradmin : Convert-ListingToObject:
     | C:\x\.github\windows\StoreBroker\StoreBroker\PackageTool.ps1:1390 Line | 1390 |         
     | Convert-ListingToObject -PDPRootPath $PDPRootPath -LanguageEx …      |         
     | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      | Cannot bind argument to parameter
     | 'NamespaceUri' because it is an empty string.
Error: Process completed with exit code 1.

Maybe you have some advice how to handle that?

HowardWolosky commented 7 months ago

@szujak - I have some thoughts:

The error is coming from Get-XsdPath which gets the XSD namespace from the PDP xml file. That's used to help locally validate that the PDP xml file conforms to the expected format.

  1. Make sure that you're running against 1.21.2 which the repo was just updated to about 9 hours ago.
  2. If it's still happening with 1.21.2, please confirm that you have a PdpRootPath value in your config file that is pointing to a folder that has PDP xml files in it. There's no reason that we'd be trying to get the XSD path unless it found one or more PDP XML files, and the PdpRootPath wasn't in your command.
  3. Assuming that's defined in your config file and you have PDP files in that path, please open some up and confirm that they have an xsd namespace defined at the root (it should be: http://schemas.microsoft.com/appx/2012/ProductDescription).
  4. Assuming all of that looks good, then I'd request you provide the entire StoreBroker.log that is generated from the run (not just the last exception) in order to possibly better help debug the issue (the logging in that area is still rather minimal).
szujak commented 7 months ago

So yesterday I double check the PDP.xml file it had the correct namespace. I also used direct import StoreBroker from git:

git clone https://github.com/microsoft/StoreBroker.git
Import-Module .\StoreBroker\StoreBroker\StoreBroker.psd1

And I tried to use -PDPRootPath "C:\x\.github\windows\PDP.xml" parameter to point to the xml file, but in that case I got another error Cannot validate argument on parameter 'PDPRootPath'. C:\x\.github\windows\PDP.xml cannot be found. which is strange because file is there.

This morning I saw that you released new version in PowerShell Gallery and I switched back to use StoreBroker from it, and all looks fine... It use the same config from json as before:

VERBOSE: 2024-02-06 06:52:40 : runneradmin : New-SubmissionPackage invoked with parameters:
VERBOSE: [20](https://github.com/x-ag/react-native-offline-reader/actions/runs/7795391526/job/21258258543#step:20:21)24-02-06 06:52:40 : runneradmin :  ConfigPath = "C:\x\.github\windows\storeBrokerConfig.json"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    AppxPath = "C:\x\windows\x\bin\x64\Release\Upload\x_1.3.3780.0_x64\x_1.3.3780.0_x64.msix"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    OutPath = ".\"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    OutName = ".\newSubmission"
VERBOSE: 20[24](https://github.com/x-ag/react-native-offline-reader/actions/runs/7795391526/job/21258258543#step:20:25)-02-06 06:52:40 : runneradmin :  DisableAutoPackageNameFormatting = "False"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    Using config value: PDPRootPath = ".\"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    Using config value: ImagesRootPath = ".\screenshots"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    Using config value: LanguageExclude = "default"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    Using default value: PDPInclude = "*.xml"
VERBOSE: 2024-02-06 06:52:40 : runneradmin :    Using config value: DisableAutoPackageNameFormatting = "False"
HowardWolosky commented 7 months ago

@szujak - Are you saying that you no longer have this problem?

szujak commented 7 months ago

Yes, I think this issue can be closed. Thank you for your time :)