Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure during setup: is not a supported archive file format. .zip is the only supported archive file format. #171

Closed
AnalogJ opened this issue Feb 1, 2024 · 15 comments

Comments

@AnalogJ
Copy link

AnalogJ commented Feb 1, 2024

Hi,
I'm trying to run setup-msstore-cli on a Github Actions Self-hosted runner.
I'm getting the following error message:

Run microsoft/setup-msstore-cli@v1
  with:
    version: latest
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\Windows\System32\actions-runner\_work\_temp\f5318963-a7d1-453a-83de-05c96e4141fc' -DestinationPath 'C:\Users\Administrator\AppData\Local\Temp\tmp\runner\e9531d56-77cb-4ebe-8070-e4d3c167fdbf' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Windows\System32\actions-runner\_work\_temp\f5318963-a7d1-453a-83de-05c96e4141fc', 'C:\Users\Administrator\AppData\Local\Temp\tmp\runner\e9531d56-77cb-4ebe-8070-e4d3c167fdbf', $true) }"
Expand-Archive :  is not a supported archive file format. .zip is the only supported archive file format.
At line:1 char:210
+ ...  Ignore)) { Expand-Archive -LiteralPath 'C:\Windows\System32\actions- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:String) [Expand-Archive], IOException
    + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive
 
Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1

It seems to be failing during package extraction, but I'm not sure which tool is missing in my self-hosted runner image (the extension seems to be blank).

Here's the relevant part of my GH Actions workflow


      - name: 'windows: install msstore-cli'
        if: runner.os == 'windows' && inputs.appstore_publish == 'true'
        uses: microsoft/setup-msstore-cli@v1

      - name: 'windows: appstore release - upload (.msix)'
        run: |
          msstore reconfigure --tenantId ${{ secrets.XXXX_AZURE_AD_TENANT_ID }} --clientId ${{ secrets.XXXXX_AZURE_AD_APPLICATION_CLIENT_ID }} --clientSecret ${{ secrets.XXXXX_AZURE_AD_APPLICATION_SECRET }} --sellerId ${{ secrets.XXXXX_STORE_SELLER_ID }}
          msstore publish -v -i "${{ github.workspace }}\\XXXXX\\build\\bin"


@AnalogJ AnalogJ changed the title Failure during setup: Failure during setup: is not a supported archive file format. .zip is the only supported archive file format. Feb 1, 2024
@azchohfi
Copy link
Contributor

azchohfi commented Feb 1, 2024

Interesting. This doesn't seem to be an issue on the task itself, but rather an issue on PowerShell extraction the task to be run. It seems like it is using PowerShell v1.0, and our tests are running on pwsh v7.
Seems like this:
actions/toolkit#1179
Try installing pwsh 7 and restarting the runner service on the self hosted machine to refresh the Path.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 1, 2024

Could it be related to the fact that I'm using v1 of the task instead of the code from main? It seems like there's been a bunch of commits/changes since v1 was released:

v1...main


I'm also building a new AMI with pwsh v7, so I can try that out as well.

@azchohfi
Copy link
Contributor

azchohfi commented Feb 1, 2024

The changes were minimal, actually. Lots of refactoring to support ADO and share most of the code/logic. We are due to shipping a 1.1, but that would be more on MacOS, so unlikely to be related. Let me know if pwsh7 fixes this.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 1, 2024

updating to pwsh7 seems to have fixed it, but now msstore-cli is failing to run because it needs dotnet 8 installed. Building a new AMI.

@azchohfi
Copy link
Contributor

azchohfi commented Feb 1, 2024

Yes, we are working on getting it AOT compiled, which will remove the .net runtime requirement as it would ship as part of the exe itself.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 1, 2024

hey @azchohfi

I'm seeing the following error message now:



Testing configuration...
Configuration saved!
Awesome! It seems to be working!
09:50:02 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C 
to shut down.
09:50:03 info: Microsoft.Hosting.Lifetime[0] Hosting environment: CLI
09:50:03 info: Microsoft.Hosting.Lifetime[0] Content root path: 
C:\Windows\System32\actions-runner\_work\XXX\XXX
09:50:03 info: MSStore.CLI.Services.EnvironmentInformationService[0] Running on 
CI. CI=true
09:50:03 info: MSStore.CLI.Program[0] Command is publish
We could not find a project publisher for the project at 
'C:\Windows\System32\actions-runner\_work\XXX\XXX'.
09:50:03 info: Microsoft.Hosting.Lifetime[0] Application is shutting down...
Error: Process completed with exit code 1.

What's it looking for when it says We could not find a project publisher for the project at ? There's an msix file in that directory, in addition to a number of other build files.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 2, 2024

sorry for pinging you again @azchohfi do you have any idea whats going on here?

@azchohfi
Copy link
Contributor

azchohfi commented Feb 2, 2024

TLDR: remove "-i":

msstore publish -v "${{ github.workspace }}\\XXXXX\\build\\bin"

@AnalogJ the publish command is the right one, but I see that you are running:

msstore publish -v -i "${{ github.workspace }}\\XXXXX\\build\\bin"

You need to pass the argument, not the option.
"-i": If not provided, the cli will try to find the best candidate based on the 'pathOrUrl' argument.

Since you are not providing one, it is using the current path, which probably doesn't have a project file it can work with, or an MSIX.

I see how the documentation might be confusing. The MSIX publishing scenario was added later, since the publish command's intent is only publish the app, but it is complimentary to the init command, which finds, builds, packs, and publishes your project. We support:
Windows App SDK/WinUI 3
UWP
.NET MAUI
Flutter
Electron
React Native for Windows
PWA

I think the best course of action is to update own documentation, as I agree that it can be clearer. If someone, like you, is looking only for publishing an MSIX, it is misleading into thinking that you need to use the inputDirectory option (which should be used only if you want to change the default output directory to search for the built MSIX, depending on the type of project).

https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/publish-command

@AnalogJ
Copy link
Author

AnalogJ commented Feb 2, 2024

so I tried the following commands:

  msstore reconfigure --tenantId *** --clientId *** --clientSecret *** --sellerId ***
  msstore publish -v "build/bin"

and I got the same error:

 10:42:22 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C 
to shut down.
10:42:22 info: Microsoft.Hosting.Lifetime[0] Hosting environment: CLI
10:42:22 info: Microsoft.Hosting.Lifetime[0] Content root path: 
C:\Windows\System32\actions-runner\_work\fasten-desktop\fasten-desktop
10:42:22 info: MSStore.CLI.Services.EnvironmentInformationService[0] Running on 
CI. CI=true
10:42:22 info: MSStore.CLI.Program[0] Command is publish
We could not find a project publisher for the project at 
'build/bin'.

Then I thought that maybe it would make sense to "cd" into the correct bin director before starting the publish (but note how I left the argument blank):

  cd build/bin
  echo "msstore reconfigure starting...."
  msstore reconfigure --tenantId *** --clientId *** --clientSecret *** --sellerId ***
  echo "msstore publish starting...."
  msstore publish -v

and I got the following output:

 11:25:54 info: Microsoft.Hosting.Lifetime[0] Content root path: 
C:\Windows\System32\actions-runner\_work\fasten-desktop\fasten-desktop\fasten-de
sktop\build\bin
11:25:54 info: MSStore.CLI.Services.EnvironmentInformationService[0] Running on 
CI. CI=true
11:25:54 info: MSStore.CLI.Program[0] Command is publish
We could not find a project publisher for the project at 
'C:\Windows\System32\actions-runner\_work\fasten-desktop\fasten-desktop\fasten-d
esktop\build\bin'.

Now I'm trying with the filename as an argument:

  cd build/bin
  echo "msstore reconfigure starting...."
  msstore reconfigure --tenantId *** --clientId *** --clientSecret *** --sellerId ***
  echo "msstore publish starting...."
msstore publish -v fasten_amd64.msix

but It'll be about 30 minutes before I find out if it works or not :(
if this doesnt work I'll spin up a windows VM and figure out how to get this working in there first

@AnalogJ
Copy link
Author

AnalogJ commented Feb 3, 2024

Nice, got a new error now!

  cd build/bin
  echo "msstore reconfigure starting...."
  msstore reconfigure --tenantId *** --clientId *** --clientSecret *** --sellerId ***
  echo "msstore publish starting...."
msstore publish -v fasten_amd64.msix

results in:

msstore publish starting....
12:02:10 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C 
to shut down.
12:02:10 info: Microsoft.Hosting.Lifetime[0] Hosting environment: CLI
12:02:10 info: Microsoft.Hosting.Lifetime[0] Content root path: 
C:\Windows\System32\actions-runner\_work\fasten-desktop\fasten-desktop\fasten-de
sktop\build\bin
12:02:10 info: MSStore.CLI.Services.EnvironmentInformationService[0] Running on 
CI. CI=true
12:02:10 info: MSStore.CLI.Program[0] Command is publish
12:02:10 info: MSStore.API.StoreAPI[0] Getting DevCenter authorization token
This seems to be a MSIX project.
Unhandled exception: MSStore.API.MSStoreException: Failed to find the AppId.
   at MSStore.CLI.Helpers.IStorePackagedAPIExtensions.EnsureAppInitializedAsync(IStorePackagedAPI storePackagedAPI, DevCenterApplication application, FileInfo directoryInfo, IProjectPublisher projectPublisher, CancellationToken ct) in /_/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs:line 240
   at MSStore.CLI.ProjectConfigurators.MSIXProjectPublisher.PublishAsync(String pathOrUrl, DevCenterApplication app, DirectoryInfo inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) in /_/MSStore.CLI/ProjectConfigurators/MSIXProjectPublisher.cs:line 110
   at MSStore.CLI.Commands.PublishCommand.Handler.InvokeAsync(InvocationContext context) in /_/MSStore.CLI/Commands/PublishCommand.cs:line 137
   at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at MSStore.CLI.Program.<>c.<<Main>b__0_2>d.MoveNext() in /_/MSStore.CLI/Program.cs:line 229
--- End of stack trace from previous location ---
   at System.CommandLine.Hosting.HostingExtensions.<>c__DisplayClass1_0.<<UseHost>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Error: Process completed with exit code 1.

Looks like the main error is: Unhandled exception: MSStore.API.MSStoreException: Failed to find the AppId.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 3, 2024

I found microsoft/msstore-cli#14 which seems to imply that i need to call msstore init

I eventually created the following pubspec.yaml file:

msix_config:
  display_name: Fasten Health
  publisher_display_name: Fasten Health, Inc
  identity_name: FastenHealthInc.FastenHealth
  msix_version: 1.0.8.0
  publisher: CN=94E2XXXX-XXXX-XXXX-XXXX-XXXXXXXXB278
  msstore_appId: 9PLXXXXXXXXP
  store: true

then I tried running msstore publish -v fasten_amd64.msix

Still getting Failed to find the AppId.


running msstore init . generates the following:

Ok! Found your apps!
This seems to be a Flutter project.
Let's set it up for you!

'flutter pub get' failed

@AnalogJ
Copy link
Author

AnalogJ commented Feb 7, 2024

Hey @azchohfi just checking in, is there a documented way to deploy a stand-alone msix to the Microsoft Store using the cli?

@AnalogJ
Copy link
Author

AnalogJ commented Feb 12, 2024

Hey @azchohfi sorry to keep bothering you -- I'm just trying to figure out if this is working as intended and if I need to look for another tool to help me publish artifacts to the windows store. Since this is unrelated to the setup-msstore-cli, I can open an issue in the other repo

@azchohfi
Copy link
Contributor

Init is for project configuration, not for MSIX. It writes the app id in the project file, whatever that is, so you don't need to pass it all the times. If you want to publish MSIX, just pass the --appId or -id option. The documentation was not updated with this new param. Our miss, sorry. I'll send a fix for the docs.

@AnalogJ
Copy link
Author

AnalogJ commented Feb 12, 2024

confirmed! adding the --appId flag worked. Thanks so much @azchohfi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants